Comparing version 0.0.6 to 0.0.7
@@ -35,2 +35,3 @@ /** | ||
traceId?: string | null; | ||
traceIdType?: components['schemas']['TraceIdTypeEvent']; | ||
name?: string | null; | ||
@@ -66,2 +67,7 @@ /** Format: date-time */ | ||
ObservationLevelEvent: 'DEBUG' | 'DEFAULT' | 'WARNING' | 'ERROR'; | ||
/** | ||
* TraceIdTypeEvent | ||
* @enum {string} | ||
*/ | ||
TraceIdTypeEvent: 'LANGFUSE' | 'EXTERNAL'; | ||
/** CreateLog */ | ||
@@ -171,2 +177,3 @@ CreateLog: { | ||
traceId?: string | null; | ||
traceIdType?: components['schemas']['TraceIdTypeSpan']; | ||
name?: string | null; | ||
@@ -217,2 +224,7 @@ /** Format: date-time */ | ||
ObservationLevelSpan: 'DEBUG' | 'DEFAULT' | 'WARNING' | 'ERROR'; | ||
/** | ||
* TraceIdTypeSpan | ||
* @enum {string} | ||
*/ | ||
TraceIdTypeSpan: 'LANGFUSE' | 'EXTERNAL'; | ||
/** CreateTraceRequest */ | ||
@@ -219,0 +231,0 @@ CreateTraceRequest: { |
@@ -21,4 +21,6 @@ import { paths } from './api/server'; | ||
} | undefined>; | ||
logGeneration: (body: paths['/api/public/generations']['post']['requestBody']['content']['application/json'], trace?: ReturnType<typeof this.createTrace>) => Promise<{ | ||
logGeneration: (body: paths['/api/public/generations']['post']['requestBody']['content']['application/json'], trace?: ReturnType<typeof this.createTrace>, parent?: Promise<{ | ||
id: string; | ||
} | undefined>) => Promise<{ | ||
id: string; | ||
traceId: string; | ||
@@ -45,5 +47,38 @@ type: string; | ||
} | undefined>; | ||
createScore: (body: paths['/api/public/scores']['post']['requestBody']['content']['application/json'], trace?: ReturnType<typeof this.createTrace>) => Promise<{ | ||
createSpan: (body: paths['/api/public/spans']['post']['requestBody']['content']['application/json'], trace?: ReturnType<typeof this.createTrace>, parent?: Promise<{ | ||
id: string; | ||
} | undefined>) => Promise<{ | ||
id: string; | ||
traceId: string; | ||
type: string; | ||
name?: string | null | undefined; | ||
startTime: string; | ||
endTime?: string | null | undefined; | ||
metadata?: Record<string, unknown> | null | undefined; | ||
input?: Record<string, unknown> | null | undefined; | ||
output?: Record<string, unknown> | null | undefined; | ||
level: "DEBUG" | "DEFAULT" | "WARNING" | "ERROR"; | ||
statusMessage?: string | null | undefined; | ||
parentObservationId?: string | null | undefined; | ||
} | undefined>; | ||
createEvent: (body: paths['/api/public/events']['post']['requestBody']['content']['application/json'], trace?: ReturnType<typeof this.createTrace>, parent?: Promise<{ | ||
id: string; | ||
} | undefined>) => Promise<{ | ||
id: string; | ||
traceId: string; | ||
type: string; | ||
name?: string | null | undefined; | ||
startTime: string; | ||
metadata?: Record<string, unknown> | null | undefined; | ||
input?: Record<string, unknown> | null | undefined; | ||
output?: Record<string, unknown> | null | undefined; | ||
level: "DEBUG" | "DEFAULT" | "WARNING" | "ERROR"; | ||
statusMessage?: string | null | undefined; | ||
parentObservationId?: string | null | undefined; | ||
} | undefined>; | ||
createScore: (body: paths['/api/public/scores']['post']['requestBody']['content']['application/json'], trace?: ReturnType<typeof this.createTrace>, observation?: Promise<{ | ||
id: string; | ||
} | undefined>) => Promise<{ | ||
id: string; | ||
traceId: string; | ||
name: string; | ||
@@ -50,0 +85,0 @@ value: number; |
@@ -26,7 +26,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
}); | ||
this.logGeneration = (body, trace) => __awaiter(this, void 0, void 0, function* () { | ||
var _b; | ||
this.logGeneration = (body, trace, parent) => __awaiter(this, void 0, void 0, function* () { | ||
var _b, _c; | ||
const traceId = trace ? (_b = (yield trace)) === null || _b === void 0 ? void 0 : _b.id : undefined; | ||
const parentId = parent ? (_c = (yield parent)) === null || _c === void 0 ? void 0 : _c.id : undefined; | ||
const res = this.post('/api/public/generations', { | ||
body: Object.assign(Object.assign({}, body), { traceId: traceId !== null && traceId !== void 0 ? traceId : body.traceId }), | ||
body: Object.assign(Object.assign({}, body), { traceId: traceId !== null && traceId !== void 0 ? traceId : body.traceId, parentObservationId: parentId !== null && parentId !== void 0 ? parentId : body.parentObservationId }), | ||
}).then((res) => { | ||
@@ -41,7 +42,38 @@ if (res.error) { | ||
}); | ||
this.createScore = (body, trace) => __awaiter(this, void 0, void 0, function* () { | ||
var _c; | ||
const traceId = trace ? (_c = (yield trace)) === null || _c === void 0 ? void 0 : _c.id : undefined; | ||
this.createSpan = (body, trace, parent) => __awaiter(this, void 0, void 0, function* () { | ||
var _d, _e; | ||
const traceId = trace ? (_d = (yield trace)) === null || _d === void 0 ? void 0 : _d.id : undefined; | ||
const parentId = parent ? (_e = (yield parent)) === null || _e === void 0 ? void 0 : _e.id : undefined; | ||
const res = this.post('/api/public/spans', { | ||
body: Object.assign(Object.assign({}, body), { traceId: traceId !== null && traceId !== void 0 ? traceId : body.traceId, parentObservationId: parentId !== null && parentId !== void 0 ? parentId : body.parentObservationId }), | ||
}).then((res) => { | ||
if (res.error) { | ||
throw new Error(res.error); | ||
} | ||
return res.data; | ||
}); | ||
this.promises.push(res); | ||
return res; | ||
}); | ||
this.createEvent = (body, trace, parent) => __awaiter(this, void 0, void 0, function* () { | ||
var _f, _g; | ||
const traceId = trace ? (_f = (yield trace)) === null || _f === void 0 ? void 0 : _f.id : undefined; | ||
const parentId = parent ? (_g = (yield parent)) === null || _g === void 0 ? void 0 : _g.id : undefined; | ||
const res = this.post('/api/public/events', { | ||
body: Object.assign(Object.assign({}, body), { traceId: traceId !== null && traceId !== void 0 ? traceId : body.traceId, parentObservationId: parentId !== null && parentId !== void 0 ? parentId : body.parentObservationId }), | ||
}).then((res) => { | ||
if (res.error) { | ||
throw new Error(res.error); | ||
} | ||
return res.data; | ||
}); | ||
this.promises.push(res); | ||
return res; | ||
}); | ||
this.createScore = (body, trace, observation) => __awaiter(this, void 0, void 0, function* () { | ||
var _h, _j; | ||
const traceId = trace ? (_h = (yield trace)) === null || _h === void 0 ? void 0 : _h.id : undefined; | ||
const observationId = observation ? (_j = (yield observation)) === null || _j === void 0 ? void 0 : _j.id : undefined; | ||
const res = this.post('/api/public/scores', { | ||
body: Object.assign(Object.assign({}, body), { traceId: traceId !== null && traceId !== void 0 ? traceId : body.traceId }), | ||
body: Object.assign(Object.assign({}, body), { traceId: traceId !== null && traceId !== void 0 ? traceId : body.traceId, observationId: observationId !== null && observationId !== void 0 ? observationId : body.observationId }), | ||
}).then((res) => { | ||
@@ -48,0 +80,0 @@ if (res.error) { |
{ | ||
"name": "langfuse", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
30010
826