langfuse-core
Advanced tools
Comparing version 2.0.0-alpha.1 to 2.0.0-alpha.2
@@ -149,5 +149,6 @@ 'use strict'; | ||
function getCommonReleaseEnvs() { | ||
for (const env of common_release_envs) { | ||
if (process.env[env]) { | ||
return process.env[env]; | ||
for (const key of common_release_envs) { | ||
const value = getEnv(key); | ||
if (value) { | ||
return value; | ||
} | ||
@@ -341,2 +342,7 @@ } | ||
} | ||
/** | ||
* Creates a dataset item. Upserts the item if it already exists. | ||
* @param body The body of the dataset item to be created. | ||
* @returns A promise that resolves to the response of the create operation. | ||
*/ | ||
async createDatasetItem(body) { | ||
@@ -348,2 +354,7 @@ return this.fetch(`${this.baseUrl}/api/public/dataset-items`, this.getFetchOptions({ | ||
} | ||
async getDatasetItem(id) { | ||
return this.fetch(`${this.baseUrl}/api/public/dataset-items/${id}`, this.getFetchOptions({ | ||
method: "GET" | ||
})).then(res => res.json()); | ||
} | ||
_parsePayload(response) { | ||
@@ -350,0 +361,0 @@ try { |
@@ -10,7 +10,17 @@ /// <reference types="node" /> | ||
}; | ||
/** OneOf type helpers */ | ||
type Without<T, U> = { | ||
[P in Exclude<keyof T, keyof U>]?: never; | ||
}; | ||
type XOR<T, U> = T | U extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U; | ||
type OneOf<T extends any[]> = T extends [infer Only] ? Only : T extends [infer A, infer B, ...infer Rest] ? OneOf<[XOR<A, B>, ...Rest]> : never; | ||
interface paths { | ||
"/api/public/dataset-items": { | ||
/** @description Create a dataset item */ | ||
/** @description Create a dataset item, upserts on id */ | ||
post: operations["datasetItems_create"]; | ||
}; | ||
"/api/public/dataset-items/{id}": { | ||
/** @description Get a specific dataset item */ | ||
get: operations["datasetItems_get"]; | ||
}; | ||
"/api/public/dataset-run-items": { | ||
@@ -40,2 +50,10 @@ /** @description Create a dataset run item */ | ||
}; | ||
"/api/public/health": { | ||
/** @description Check health of API and database */ | ||
get: operations["health_health"]; | ||
}; | ||
"/api/public/ingestion": { | ||
/** @description Ingest multiple events to Langfuse */ | ||
post: operations["ingestion_batch"]; | ||
}; | ||
"/api/public/observations/{observationId}": { | ||
@@ -49,6 +67,9 @@ /** @description Get a specific observation */ | ||
}; | ||
"/api/public/projects": { | ||
get: operations["projects_get"]; | ||
}; | ||
"/api/public/scores": { | ||
/** @description Get scores */ | ||
get: operations["score_get"]; | ||
/** @description Add a score to the database */ | ||
/** @description Add a score to the database, upserts on id */ | ||
post: operations["score_create"]; | ||
@@ -80,3 +101,2 @@ }; | ||
traceId?: string | null; | ||
traceIdType?: components["schemas"]["TraceIdTypeEnum"]; | ||
name?: string | null; | ||
@@ -116,3 +136,2 @@ /** Format: date-time */ | ||
timestamp: string; | ||
externalId?: string | null; | ||
name?: string | null; | ||
@@ -230,7 +249,2 @@ release?: string | null; | ||
MapValue: (string | null) | (number | null) | (boolean | null); | ||
/** | ||
* TraceIdTypeEnum | ||
* @enum {string} | ||
*/ | ||
TraceIdTypeEnum: "LANGFUSE" | "EXTERNAL"; | ||
/** LLMUsage */ | ||
@@ -252,2 +266,3 @@ LLMUsage: { | ||
expectedOutput?: Record<string, unknown> | null; | ||
id?: string | null; | ||
}; | ||
@@ -270,2 +285,4 @@ /** CreateDatasetRunItemRequest */ | ||
/** Format: date-time */ | ||
startTime?: string | null; | ||
/** Format: date-time */ | ||
endTime?: string | null; | ||
@@ -286,2 +303,45 @@ /** Format: date-time */ | ||
}; | ||
/** IngestionEvent */ | ||
IngestionEvent: OneOf<[ | ||
WithRequired<{ | ||
/** @enum {string} */ | ||
type?: "trace-create"; | ||
} & components["schemas"]["TraceEvent"], "type">, | ||
WithRequired<{ | ||
/** @enum {string} */ | ||
type?: "score-create"; | ||
} & components["schemas"]["ScoreEvent"], "type">, | ||
WithRequired<{ | ||
/** @enum {string} */ | ||
type?: "observation-create"; | ||
} & components["schemas"]["ObservationCreateEvent"], "type">, | ||
WithRequired<{ | ||
/** @enum {string} */ | ||
type?: "observation-update"; | ||
} & components["schemas"]["ObservationUpdateEvent"], "type"> | ||
]>; | ||
/** TraceEvent */ | ||
TraceEvent: { | ||
id: string; | ||
timestamp: string; | ||
body: components["schemas"]["Trace"]; | ||
}; | ||
/** ObservationCreateEvent */ | ||
ObservationCreateEvent: { | ||
id: string; | ||
timestamp: string; | ||
body: components["schemas"]["Observation"]; | ||
}; | ||
/** ObservationUpdateEvent */ | ||
ObservationUpdateEvent: { | ||
id: string; | ||
timestamp: string; | ||
body: components["schemas"]["Observation"]; | ||
}; | ||
/** ScoreEvent */ | ||
ScoreEvent: { | ||
id: string; | ||
timestamp: string; | ||
body: components["schemas"]["Score"]; | ||
}; | ||
/** Observations */ | ||
@@ -292,2 +352,11 @@ Observations: { | ||
}; | ||
/** Projects */ | ||
Projects: { | ||
data: components["schemas"]["Project"][]; | ||
}; | ||
/** Project */ | ||
Project: { | ||
id: string; | ||
name: string; | ||
}; | ||
/** CreateScoreRequest */ | ||
@@ -297,3 +366,2 @@ CreateScoreRequest: { | ||
traceId: string; | ||
traceIdType?: components["schemas"]["TraceIdTypeEnum"]; | ||
name: string; | ||
@@ -315,2 +383,4 @@ /** Format: double */ | ||
/** Format: date-time */ | ||
startTime?: string | null; | ||
/** Format: date-time */ | ||
endTime?: string | null; | ||
@@ -360,3 +430,3 @@ name?: string | null; | ||
interface operations { | ||
/** @description Create a dataset item */ | ||
/** @description Create a dataset item, upserts on id */ | ||
datasetItems_create: { | ||
@@ -376,3 +446,3 @@ requestBody: { | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -382,3 +452,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -388,3 +458,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -394,3 +464,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -400,3 +470,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -406,2 +476,42 @@ }; | ||
}; | ||
/** @description Get a specific dataset item */ | ||
datasetItems_get: { | ||
parameters: { | ||
path: { | ||
id: string; | ||
}; | ||
}; | ||
responses: { | ||
200: { | ||
content: { | ||
"application/json": components["schemas"]["DatasetItem"]; | ||
}; | ||
}; | ||
400: { | ||
content: { | ||
"application/json": unknown; | ||
}; | ||
}; | ||
401: { | ||
content: { | ||
"application/json": unknown; | ||
}; | ||
}; | ||
403: { | ||
content: { | ||
"application/json": unknown; | ||
}; | ||
}; | ||
404: { | ||
content: { | ||
"application/json": unknown; | ||
}; | ||
}; | ||
405: { | ||
content: { | ||
"application/json": unknown; | ||
}; | ||
}; | ||
}; | ||
}; | ||
/** @description Create a dataset run item */ | ||
@@ -422,3 +532,3 @@ datasetRunItems_create: { | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -428,3 +538,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -434,3 +544,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -440,3 +550,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -446,3 +556,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -467,3 +577,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -473,3 +583,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -479,3 +589,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -485,3 +595,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -491,3 +601,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -512,3 +622,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -518,3 +628,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -524,3 +634,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -530,3 +640,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -536,3 +646,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -558,3 +668,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -564,3 +674,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -570,3 +680,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -576,3 +686,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -582,3 +692,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -603,3 +713,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -609,3 +719,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -615,3 +725,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -621,3 +731,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -627,3 +737,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -647,3 +757,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -653,3 +763,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -659,3 +769,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -665,3 +775,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -671,3 +781,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -691,3 +801,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -697,3 +807,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -703,3 +813,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -709,3 +819,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -715,3 +825,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -721,2 +831,80 @@ }; | ||
}; | ||
/** @description Check health of API and database */ | ||
health_health: { | ||
responses: { | ||
204: { | ||
content: never; | ||
}; | ||
400: { | ||
content: { | ||
"application/json": unknown; | ||
}; | ||
}; | ||
401: { | ||
content: { | ||
"application/json": unknown; | ||
}; | ||
}; | ||
403: { | ||
content: { | ||
"application/json": unknown; | ||
}; | ||
}; | ||
404: { | ||
content: { | ||
"application/json": unknown; | ||
}; | ||
}; | ||
405: { | ||
content: { | ||
"application/json": unknown; | ||
}; | ||
}; | ||
503: { | ||
content: never; | ||
}; | ||
}; | ||
}; | ||
/** @description Ingest multiple events to Langfuse */ | ||
ingestion_batch: { | ||
requestBody: { | ||
content: { | ||
"application/json": { | ||
batch: components["schemas"]["IngestionEvent"][]; | ||
}; | ||
}; | ||
}; | ||
responses: { | ||
200: { | ||
content: { | ||
"application/json": components["schemas"]["Score"]; | ||
}; | ||
}; | ||
400: { | ||
content: { | ||
"application/json": unknown; | ||
}; | ||
}; | ||
401: { | ||
content: { | ||
"application/json": unknown; | ||
}; | ||
}; | ||
403: { | ||
content: { | ||
"application/json": unknown; | ||
}; | ||
}; | ||
404: { | ||
content: { | ||
"application/json": unknown; | ||
}; | ||
}; | ||
405: { | ||
content: { | ||
"application/json": unknown; | ||
}; | ||
}; | ||
}; | ||
}; | ||
/** @description Get a specific observation */ | ||
@@ -738,3 +926,3 @@ observations_get: { | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -744,3 +932,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -750,3 +938,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -756,3 +944,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -762,3 +950,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -777,2 +965,4 @@ }; | ||
type?: string | null; | ||
traceId?: string | null; | ||
parentObservationId?: string | null; | ||
}; | ||
@@ -788,3 +978,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -794,3 +984,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -800,3 +990,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -806,3 +996,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -812,3 +1002,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -818,2 +1008,36 @@ }; | ||
}; | ||
projects_get: { | ||
responses: { | ||
200: { | ||
content: { | ||
"application/json": components["schemas"]["Projects"]; | ||
}; | ||
}; | ||
400: { | ||
content: { | ||
"application/json": unknown; | ||
}; | ||
}; | ||
401: { | ||
content: { | ||
"application/json": unknown; | ||
}; | ||
}; | ||
403: { | ||
content: { | ||
"application/json": unknown; | ||
}; | ||
}; | ||
404: { | ||
content: { | ||
"application/json": unknown; | ||
}; | ||
}; | ||
405: { | ||
content: { | ||
"application/json": unknown; | ||
}; | ||
}; | ||
}; | ||
}; | ||
/** @description Get scores */ | ||
@@ -837,3 +1061,3 @@ score_get: { | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -843,3 +1067,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -849,3 +1073,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -855,3 +1079,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -861,3 +1085,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -867,3 +1091,3 @@ }; | ||
}; | ||
/** @description Add a score to the database */ | ||
/** @description Add a score to the database, upserts on id */ | ||
score_create: { | ||
@@ -883,3 +1107,3 @@ requestBody: { | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -889,3 +1113,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -895,3 +1119,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -901,3 +1125,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -907,3 +1131,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -928,3 +1152,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -934,3 +1158,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -940,3 +1164,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -946,3 +1170,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -952,3 +1176,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -973,3 +1197,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -979,3 +1203,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -985,3 +1209,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -991,3 +1215,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -997,3 +1221,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -1021,3 +1245,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -1027,3 +1251,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -1033,3 +1257,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -1039,3 +1263,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -1045,3 +1269,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -1066,3 +1290,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -1072,3 +1296,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -1078,3 +1302,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -1084,3 +1308,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -1090,3 +1314,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -1112,3 +1336,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -1118,3 +1342,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -1124,3 +1348,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -1130,3 +1354,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -1136,3 +1360,3 @@ }; | ||
content: { | ||
"application/json": string; | ||
"application/json": unknown; | ||
}; | ||
@@ -1312,3 +1536,9 @@ }; | ||
createDataset(name: string): Promise<CreateLangfuseDatasetResponse>; | ||
/** | ||
* Creates a dataset item. Upserts the item if it already exists. | ||
* @param body The body of the dataset item to be created. | ||
* @returns A promise that resolves to the response of the create operation. | ||
*/ | ||
createDatasetItem(body: CreateLangfuseDatasetItemBody): Promise<CreateLangfuseDatasetItemResponse>; | ||
getDatasetItem(id: string): Promise<CreateLangfuseDatasetItemResponse>; | ||
protected _parsePayload(response: any): any; | ||
@@ -1315,0 +1545,0 @@ /*** |
{ | ||
"name": "langfuse-core", | ||
"version": "2.0.0-alpha.1", | ||
"version": "2.0.0-alpha.2", | ||
"engines": { | ||
@@ -34,3 +34,3 @@ "node": ">=18" | ||
], | ||
"gitHead": "512a33771b8cca20900516494f91ba4678a7ffea" | ||
"gitHead": "7698742c48720296bdef6c338c2cd1f8b94a6954" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
260561
2989