Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions packages/core/src/api/api/resources/commons/types/BaseScore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
16 changes: 10 additions & 6 deletions packages/core/src/api/api/resources/commons/types/BaseScoreV1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
3 changes: 2 additions & 1 deletion packages/core/src/api/api/resources/commons/types/Comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
8 changes: 5 additions & 3 deletions packages/core/src/api/api/resources/commons/types/Dataset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
12 changes: 6 additions & 6 deletions packages/core/src/api/api/resources/commons/types/Model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
28 changes: 14 additions & 14 deletions packages/core/src/api/api/resources/commons/types/Observation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, LangfuseAPI.MapValue>;
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<string, number>;
usageDetails: Record<string, number>;
/** 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<string, number>;
costDetails: Record<string, number>;
/** 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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ export interface Session {
createdAt: string;
projectId: string;
/** The environment from which this session originated. */
environment?: string;
environment: string;
}
18 changes: 9 additions & 9 deletions packages/core/src/api/api/resources/commons/types/Trace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
11 changes: 5 additions & 6 deletions packages/core/src/api/api/resources/commons/types/Usage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -113,6 +113,7 @@ export class ObservationsV2 {
): Promise<core.WithRawResponse<LangfuseAPI.ObservationsV2Response>> {
const {
fields,
expandMetadata,
limit,
cursor,
parseIoAsJson,
Expand All @@ -136,6 +137,10 @@ export class ObservationsV2 {
_queryParams["fields"] = fields;
}

if (expandMetadata != null) {
_queryParams["expandMetadata"] = expandMetadata;
}

if (limit != null) {
_queryParams["limit"] = limit.toString();
}
Expand Down
Loading
Loading