Comparing version 0.0.7 to 0.0.8
@@ -45,3 +45,3 @@ import { paths } from './api/server'; | ||
parentObservationId?: string | null | undefined; | ||
} | undefined>; | ||
}>; | ||
createSpan: (body: paths['/api/public/spans']['post']['requestBody']['content']['application/json'], trace?: ReturnType<typeof this.createTrace>, parent?: Promise<{ | ||
@@ -62,3 +62,3 @@ id: string; | ||
parentObservationId?: string | null | undefined; | ||
} | undefined>; | ||
}>; | ||
createEvent: (body: paths['/api/public/events']['post']['requestBody']['content']['application/json'], trace?: ReturnType<typeof this.createTrace>, parent?: Promise<{ | ||
@@ -78,3 +78,3 @@ id: string; | ||
parentObservationId?: string | null | undefined; | ||
} | undefined>; | ||
}>; | ||
createScore: (body: paths['/api/public/scores']['post']['requestBody']['content']['application/json'], trace?: ReturnType<typeof this.createTrace>, observation?: Promise<{ | ||
@@ -89,3 +89,3 @@ id: string; | ||
timestamp: string; | ||
} | undefined>; | ||
}>; | ||
flush: () => Promise<void>; | ||
@@ -92,0 +92,0 @@ } |
@@ -27,60 +27,88 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
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, 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; | ||
const promise = new Promise((resolve, reject) => __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, parentObservationId: parentId !== null && parentId !== void 0 ? parentId : body.parentObservationId }), | ||
}).then((res) => { | ||
if (res.error) { | ||
reject(res.error); | ||
} | ||
else if (!res.data) { | ||
reject('Not found'); | ||
} | ||
else { | ||
resolve(res.data); | ||
} | ||
}); | ||
})); | ||
this.promises.push(promise); | ||
return promise; | ||
}); | ||
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; | ||
const promise = new Promise((resolve, reject) => __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) { | ||
reject(res.error); | ||
} | ||
else if (!res.data) { | ||
reject('Not found'); | ||
} | ||
else { | ||
resolve(res.data); | ||
} | ||
}); | ||
})); | ||
this.promises.push(promise); | ||
return promise; | ||
}); | ||
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; | ||
const promise = new Promise((resolve, reject) => __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) { | ||
reject(res.error); | ||
} | ||
else if (!res.data) { | ||
reject('Not found'); | ||
} | ||
else { | ||
resolve(res.data); | ||
} | ||
}); | ||
})); | ||
this.promises.push(promise); | ||
return promise; | ||
}); | ||
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, observationId: observationId !== null && observationId !== void 0 ? observationId : body.observationId }), | ||
}).then((res) => { | ||
if (res.error) { | ||
throw new Error(res.error); | ||
} | ||
return res.data; | ||
}); | ||
this.promises.push(res); | ||
return res; | ||
const promise = new Promise((resolve, reject) => __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, observationId: observationId !== null && observationId !== void 0 ? observationId : body.observationId }), | ||
}).then((res) => { | ||
if (res.error) { | ||
reject(res.error); | ||
} | ||
else if (!res.data) { | ||
reject('Not found'); | ||
} | ||
else { | ||
resolve(res.data); | ||
} | ||
}); | ||
})); | ||
this.promises.push(promise); | ||
return promise; | ||
}); | ||
@@ -87,0 +115,0 @@ this.flush = () => __awaiter(this, void 0, void 0, function* () { |
{ | ||
"name": "langfuse", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
31290
854