diff --git a/packages/core/src/api/api/resources/commons/types/BaseScore.ts b/packages/core/src/api/api/resources/commons/types/BaseScore.ts index d560c1c7..564c9305 100644 --- a/packages/core/src/api/api/resources/commons/types/BaseScore.ts +++ b/packages/core/src/api/api/resources/commons/types/BaseScore.ts @@ -6,22 +6,29 @@ import * as LangfuseAPI from "../../../index.js"; export interface BaseScore { id: string; - traceId?: string; - sessionId?: string; - observationId?: string; - datasetRunId?: string; + /** The trace ID associated with the score */ + traceId?: string | null; + /** The session ID associated with the score */ + sessionId?: string | null; + /** The observation ID associated with the score */ + observationId?: string | null; + /** The dataset run ID associated with the score */ + datasetRunId?: string | null; name: string; source: LangfuseAPI.ScoreSource; timestamp: string; createdAt: string; updatedAt: string; - authorUserId?: string; - comment?: string; + /** The user ID of the author */ + authorUserId: string | null; + /** Comment on the score */ + comment: string | null; + /** Metadata associated with the score */ metadata?: unknown; /** Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range */ - configId?: string; + configId: string | null; /** The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue. */ - queueId?: string; + queueId: string | null; /** The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'. */ - environment?: string; + environment: string; } diff --git a/packages/core/src/api/api/resources/commons/types/BaseScoreV1.ts b/packages/core/src/api/api/resources/commons/types/BaseScoreV1.ts index 296be6eb..93eafaaa 100644 --- a/packages/core/src/api/api/resources/commons/types/BaseScoreV1.ts +++ b/packages/core/src/api/api/resources/commons/types/BaseScoreV1.ts @@ -9,17 +9,21 @@ export interface BaseScoreV1 { traceId: string; name: string; source: LangfuseAPI.ScoreSource; - observationId?: string; + /** The observation ID associated with the score */ + observationId?: string | null; timestamp: string; createdAt: string; updatedAt: string; - authorUserId?: string; - comment?: string; + /** The user ID of the author */ + authorUserId: string | null; + /** Comment on the score */ + comment: string | null; + /** Metadata associated with the score */ metadata?: unknown; /** Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range */ - configId?: string; + configId: string | null; /** The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue. */ - queueId?: string; + queueId: string | null; /** The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'. */ - environment?: string; + environment: string; } diff --git a/packages/core/src/api/api/resources/commons/types/Comment.ts b/packages/core/src/api/api/resources/commons/types/Comment.ts index b7343df8..1da333a6 100644 --- a/packages/core/src/api/api/resources/commons/types/Comment.ts +++ b/packages/core/src/api/api/resources/commons/types/Comment.ts @@ -12,5 +12,6 @@ export interface Comment { objectType: LangfuseAPI.CommentObjectType; objectId: string; content: string; - authorUserId?: string; + /** The user ID of the comment author */ + authorUserId?: string | null; } diff --git a/packages/core/src/api/api/resources/commons/types/Dataset.ts b/packages/core/src/api/api/resources/commons/types/Dataset.ts index 6252a563..10e5102a 100644 --- a/packages/core/src/api/api/resources/commons/types/Dataset.ts +++ b/packages/core/src/api/api/resources/commons/types/Dataset.ts @@ -5,12 +5,14 @@ export interface Dataset { id: string; name: string; - description?: string; + /** Description of the dataset */ + description: string | null; + /** Metadata associated with the dataset */ metadata?: unknown; /** JSON Schema for validating dataset item inputs */ - inputSchema?: unknown; + inputSchema: unknown | null; /** JSON Schema for validating dataset item expected outputs */ - expectedOutputSchema?: unknown; + expectedOutputSchema: unknown | null; projectId: string; createdAt: string; updatedAt: string; diff --git a/packages/core/src/api/api/resources/commons/types/DatasetItem.ts b/packages/core/src/api/api/resources/commons/types/DatasetItem.ts index b1b883b7..86af473e 100644 --- a/packages/core/src/api/api/resources/commons/types/DatasetItem.ts +++ b/packages/core/src/api/api/resources/commons/types/DatasetItem.ts @@ -7,11 +7,16 @@ import * as LangfuseAPI from "../../../index.js"; export interface DatasetItem { id: string; status: LangfuseAPI.DatasetStatus; + /** Input data for the dataset item */ input?: unknown; + /** Expected output for the dataset item */ expectedOutput?: unknown; + /** Metadata associated with the dataset item */ metadata?: unknown; - sourceTraceId?: string; - sourceObservationId?: string; + /** The trace ID that sourced this dataset item */ + sourceTraceId: string | null; + /** The observation ID that sourced this dataset item */ + sourceObservationId: string | null; datasetId: string; datasetName: string; createdAt: string; diff --git a/packages/core/src/api/api/resources/commons/types/DatasetRun.ts b/packages/core/src/api/api/resources/commons/types/DatasetRun.ts index fadbb31f..27fca139 100644 --- a/packages/core/src/api/api/resources/commons/types/DatasetRun.ts +++ b/packages/core/src/api/api/resources/commons/types/DatasetRun.ts @@ -8,7 +8,7 @@ export interface DatasetRun { /** Name of the dataset run */ name: string; /** Description of the run */ - description?: string; + description: string | null; /** Metadata of the dataset run */ metadata?: unknown; /** Id of the associated dataset */ diff --git a/packages/core/src/api/api/resources/commons/types/DatasetRunItem.ts b/packages/core/src/api/api/resources/commons/types/DatasetRunItem.ts index 3306977d..da44a2bc 100644 --- a/packages/core/src/api/api/resources/commons/types/DatasetRunItem.ts +++ b/packages/core/src/api/api/resources/commons/types/DatasetRunItem.ts @@ -8,7 +8,8 @@ export interface DatasetRunItem { datasetRunName: string; datasetItemId: string; traceId: string; - observationId?: string; + /** The observation ID associated with this run item */ + observationId: string | null; createdAt: string; updatedAt: string; } diff --git a/packages/core/src/api/api/resources/commons/types/Model.ts b/packages/core/src/api/api/resources/commons/types/Model.ts index 7aebbf76..4e06d9ec 100644 --- a/packages/core/src/api/api/resources/commons/types/Model.ts +++ b/packages/core/src/api/api/resources/commons/types/Model.ts @@ -22,17 +22,17 @@ export interface Model { /** Regex pattern which matches this model definition to generation.model. Useful in case of fine-tuned models. If you want to exact match, use `(?i)^modelname$` */ matchPattern: string; /** Apply only to generations which are newer than this ISO date. */ - startDate?: string; + startDate: string | null; /** Unit used by this model. */ - unit?: LangfuseAPI.ModelUsageUnit; + unit?: LangfuseAPI.ModelUsageUnit | null; /** Deprecated. See 'prices' instead. Price (USD) per input unit */ - inputPrice?: number; + inputPrice: number | null; /** Deprecated. See 'prices' instead. Price (USD) per output unit */ - outputPrice?: number; + outputPrice: number | null; /** Deprecated. See 'prices' instead. Price (USD) per total unit. Cannot be set if input or output price is set. */ - totalPrice?: number; + totalPrice: number | null; /** Optional. Tokenizer to be applied to observations which match to this model. See docs for more details. */ - tokenizerId?: string; + tokenizerId: string | null; /** Optional. Configuration for the selected tokenizer. Needs to be JSON. See docs for more details. */ tokenizerConfig?: unknown; isLangfuseManaged: boolean; diff --git a/packages/core/src/api/api/resources/commons/types/Observation.ts b/packages/core/src/api/api/resources/commons/types/Observation.ts index 19a2210b..61d99179 100644 --- a/packages/core/src/api/api/resources/commons/types/Observation.ts +++ b/packages/core/src/api/api/resources/commons/types/Observation.ts @@ -8,43 +8,43 @@ export interface Observation { /** The unique identifier of the observation */ id: string; /** The trace ID associated with the observation */ - traceId?: string; + traceId: string | null; /** The type of the observation */ type: string; /** The name of the observation */ - name?: string; + name: string | null; /** The start time of the observation */ startTime: string; /** The end time of the observation. */ - endTime?: string; + endTime: string | null; /** The completion start time of the observation */ - completionStartTime?: string; + completionStartTime: string | null; /** The model used for the observation */ - model?: string; + model: string | null; /** The parameters of the model used for the observation */ - modelParameters?: Record; + modelParameters?: unknown; /** The input data of the observation */ input?: unknown; /** The version of the observation */ - version?: string; + version: string | null; /** Additional metadata of the observation */ metadata?: unknown; /** The output data of the observation */ output?: unknown; /** (Deprecated. Use usageDetails and costDetails instead.) The usage data of the observation */ - usage?: LangfuseAPI.Usage; + usage: LangfuseAPI.Usage; /** The level of the observation */ level: LangfuseAPI.ObservationLevel; /** The status message of the observation */ - statusMessage?: string; + statusMessage: string | null; /** The parent observation ID */ - parentObservationId?: string; + parentObservationId: string | null; /** The prompt ID associated with the observation */ - promptId?: string; + promptId: string | null; /** The usage details of the observation. Key is the name of the usage metric, value is the number of units consumed. The total key is the sum of all (non-total) usage metrics or the total value ingested. */ - usageDetails?: Record; + usageDetails: Record; /** The cost details of the observation. Key is the name of the cost metric, value is the cost in USD. The total key is the sum of all (non-total) cost metrics or the total value ingested. */ - costDetails?: Record; + costDetails: Record; /** The environment from which this observation originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'. */ - environment?: string; + environment: string; } diff --git a/packages/core/src/api/api/resources/commons/types/ObservationsView.ts b/packages/core/src/api/api/resources/commons/types/ObservationsView.ts index 2d4dff5b..37fd77c8 100644 --- a/packages/core/src/api/api/resources/commons/types/ObservationsView.ts +++ b/packages/core/src/api/api/resources/commons/types/ObservationsView.ts @@ -6,25 +6,25 @@ import * as LangfuseAPI from "../../../index.js"; export interface ObservationsView extends LangfuseAPI.Observation { /** The name of the prompt associated with the observation */ - promptName?: string; + promptName: string | null; /** The version of the prompt associated with the observation */ - promptVersion?: number; + promptVersion: number | null; /** The unique identifier of the model */ - modelId?: string; + modelId: string | null; /** The price of the input in USD */ - inputPrice?: number; + inputPrice: number | null; /** The price of the output in USD. */ - outputPrice?: number; + outputPrice: number | null; /** The total price in USD. */ - totalPrice?: number; + totalPrice: number | null; /** (Deprecated. Use usageDetails and costDetails instead.) The calculated cost of the input in USD */ - calculatedInputCost?: number; + calculatedInputCost: number | null; /** (Deprecated. Use usageDetails and costDetails instead.) The calculated cost of the output in USD */ - calculatedOutputCost?: number; + calculatedOutputCost: number | null; /** (Deprecated. Use usageDetails and costDetails instead.) The calculated total cost in USD */ - calculatedTotalCost?: number; + calculatedTotalCost: number | null; /** The latency in seconds. */ - latency?: number; + latency: number | null; /** The time to the first token in seconds */ - timeToFirstToken?: number; + timeToFirstToken: number | null; } diff --git a/packages/core/src/api/api/resources/commons/types/ScoreConfig.ts b/packages/core/src/api/api/resources/commons/types/ScoreConfig.ts index bfd8cff6..cbe23ed7 100644 --- a/packages/core/src/api/api/resources/commons/types/ScoreConfig.ts +++ b/packages/core/src/api/api/resources/commons/types/ScoreConfig.ts @@ -17,10 +17,11 @@ export interface ScoreConfig { /** Whether the score config is archived. Defaults to false */ isArchived: boolean; /** Sets minimum value for numerical scores. If not set, the minimum value defaults to -∞ */ - minValue?: number; + minValue?: number | null; /** Sets maximum value for numerical scores. If not set, the maximum value defaults to +∞ */ - maxValue?: number; + maxValue?: number | null; /** Configures custom categories for categorical scores */ categories?: LangfuseAPI.ConfigCategory[]; - description?: string; + /** Description of the score config */ + description?: string | null; } diff --git a/packages/core/src/api/api/resources/commons/types/Session.ts b/packages/core/src/api/api/resources/commons/types/Session.ts index 9c326bf3..24c83224 100644 --- a/packages/core/src/api/api/resources/commons/types/Session.ts +++ b/packages/core/src/api/api/resources/commons/types/Session.ts @@ -7,5 +7,5 @@ export interface Session { createdAt: string; projectId: string; /** The environment from which this session originated. */ - environment?: string; + environment: string; } diff --git a/packages/core/src/api/api/resources/commons/types/Trace.ts b/packages/core/src/api/api/resources/commons/types/Trace.ts index e16dd811..83cc99ae 100644 --- a/packages/core/src/api/api/resources/commons/types/Trace.ts +++ b/packages/core/src/api/api/resources/commons/types/Trace.ts @@ -8,25 +8,25 @@ export interface Trace { /** The timestamp when the trace was created */ timestamp: string; /** The name of the trace */ - name?: string; + name: string | null; /** The input data of the trace. Can be any JSON. */ input?: unknown; /** The output data of the trace. Can be any JSON. */ output?: unknown; /** The session identifier associated with the trace */ - sessionId?: string; + sessionId: string | null; /** The release version of the application when the trace was created */ - release?: string; + release: string | null; /** The version of the trace */ - version?: string; + version: string | null; /** The user identifier associated with the trace */ - userId?: string; + userId: string | null; /** The metadata associated with the trace. Can be any JSON. */ metadata?: unknown; - /** The tags associated with the trace. Can be an array of strings or null. */ - tags?: string[]; + /** The tags associated with the trace. */ + tags: string[]; /** Public traces are accessible via url without login */ - public?: boolean; + public: boolean; /** The environment from which this trace originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'. */ - environment?: string; + environment: string; } diff --git a/packages/core/src/api/api/resources/commons/types/TraceWithDetails.ts b/packages/core/src/api/api/resources/commons/types/TraceWithDetails.ts index f95e12c2..d11a534b 100644 --- a/packages/core/src/api/api/resources/commons/types/TraceWithDetails.ts +++ b/packages/core/src/api/api/resources/commons/types/TraceWithDetails.ts @@ -8,11 +8,11 @@ export interface TraceWithDetails extends LangfuseAPI.Trace { /** Path of trace in Langfuse UI */ htmlPath: string; /** Latency of trace in seconds */ - latency: number; + latency?: number | null; /** Cost of trace in USD */ - totalCost: number; + totalCost?: number | null; /** List of observation ids */ - observations: string[]; + observations?: string[] | null; /** List of score ids */ - scores: string[]; + scores?: string[] | null; } diff --git a/packages/core/src/api/api/resources/commons/types/TraceWithFullDetails.ts b/packages/core/src/api/api/resources/commons/types/TraceWithFullDetails.ts index abcc6c5a..01fb2417 100644 --- a/packages/core/src/api/api/resources/commons/types/TraceWithFullDetails.ts +++ b/packages/core/src/api/api/resources/commons/types/TraceWithFullDetails.ts @@ -8,9 +8,9 @@ export interface TraceWithFullDetails extends LangfuseAPI.Trace { /** Path of trace in Langfuse UI */ htmlPath: string; /** Latency of trace in seconds */ - latency: number; + latency?: number | null; /** Cost of trace in USD */ - totalCost: number; + totalCost?: number | null; /** List of observations */ observations: LangfuseAPI.ObservationsView[]; /** List of scores */ diff --git a/packages/core/src/api/api/resources/commons/types/Usage.ts b/packages/core/src/api/api/resources/commons/types/Usage.ts index e516fb12..1380892c 100644 --- a/packages/core/src/api/api/resources/commons/types/Usage.ts +++ b/packages/core/src/api/api/resources/commons/types/Usage.ts @@ -2,19 +2,18 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as LangfuseAPI from "../../../index.js"; - /** * (Deprecated. Use usageDetails and costDetails instead.) Standard interface for usage and cost */ export interface Usage { /** Number of input units (e.g. tokens) */ - input?: number; + input: number; /** Number of output units (e.g. tokens) */ - output?: number; + output: number; /** Defaults to input+output if not set */ - total?: number; - unit?: LangfuseAPI.ModelUsageUnit; + total: number; + /** Unit of measurement */ + unit: string | null; /** USD input cost */ inputCost?: number; /** USD output cost */ diff --git a/packages/core/src/api/api/resources/observationsV2/client/Client.ts b/packages/core/src/api/api/resources/observationsV2/client/Client.ts index 565754b1..f63f04f1 100644 --- a/packages/core/src/api/api/resources/observationsV2/client/Client.ts +++ b/packages/core/src/api/api/resources/observationsV2/client/Client.ts @@ -74,7 +74,7 @@ export class ObservationsV2 { * - `basic` - name, level, statusMessage, version, environment, bookmarked, public, userId, sessionId * - `time` - completionStartTime, createdAt, updatedAt * - `io` - input, output - * - `metadata` - metadata + * - `metadata` - metadata (truncated to 200 chars by default, use `expandMetadata` to get full values) * - `model` - providedModelName, internalModelId, modelParameters * - `usage` - usageDetails, costDetails, totalCost * - `prompt` - promptId, promptName, promptVersion @@ -113,6 +113,7 @@ export class ObservationsV2 { ): Promise> { const { fields, + expandMetadata, limit, cursor, parseIoAsJson, @@ -136,6 +137,10 @@ export class ObservationsV2 { _queryParams["fields"] = fields; } + if (expandMetadata != null) { + _queryParams["expandMetadata"] = expandMetadata; + } + if (limit != null) { _queryParams["limit"] = limit.toString(); } diff --git a/packages/core/src/api/api/resources/observationsV2/client/requests/GetObservationsV2Request.ts b/packages/core/src/api/api/resources/observationsV2/client/requests/GetObservationsV2Request.ts index b5299530..3c938642 100644 --- a/packages/core/src/api/api/resources/observationsV2/client/requests/GetObservationsV2Request.ts +++ b/packages/core/src/api/api/resources/observationsV2/client/requests/GetObservationsV2Request.ts @@ -16,6 +16,13 @@ export interface GetObservationsV2Request { * Example: "basic,usage,model" */ fields?: string; + /** + * Comma-separated list of metadata keys to return non-truncated. + * By default, metadata values over 200 characters are truncated. + * Use this parameter to retrieve full values for specific keys. + * Example: "key1,key2" + */ + expandMetadata?: string; /** Number of items to return per page. Maximum 1000, default 50. */ limit?: number; /** Base64-encoded cursor for pagination. Use the cursor from the previous response to get the next page. */