New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

langfuse

Package Overview
Dependencies
Maintainers
1
Versions
220
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

langfuse - npm Package Compare versions

Comparing version

to
1.0.22

lib/langfuse-core/src/storage-memory.d.ts

86

lib/index.cjs.js

@@ -365,2 +365,39 @@ 'use strict';

};
LangfuseCoreStateless.prototype._getDataset = function (name) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.fetch("".concat(this.baseUrl, "/api/public/datasets/").concat(name), this.getFetchOptions({ method: "GET" })).then(function (res) { return res.json(); })];
});
});
};
LangfuseCoreStateless.prototype.getDatasetRun = function (params) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.fetch("".concat(this.baseUrl, "/api/public/datasets/").concat(params.datasetName, "/runs/").concat(params.runName), this.getFetchOptions({ method: "GET" })).then(function (res) { return res.json(); })];
});
});
};
LangfuseCoreStateless.prototype.createDatasetRunItem = function (body) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.fetch("".concat(this.baseUrl, "/api/public/dataset-run-items"), this.getFetchOptions({ method: "POST", body: JSON.stringify(body) })).then(function (res) { return res.json(); })];
});
});
};
LangfuseCoreStateless.prototype.createDataset = function (name) {
return __awaiter(this, void 0, void 0, function () {
var body;
return __generator(this, function (_a) {
body = { name: name };
return [2 /*return*/, this.fetch("".concat(this.baseUrl, "/api/public/datasets"), this.getFetchOptions({ method: "POST", body: JSON.stringify(body) })).then(function (res) { return res.json(); })];
});
});
};
LangfuseCoreStateless.prototype.createDatasetItem = function (body) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.fetch("".concat(this.baseUrl, "/api/public/dataset-items"), this.getFetchOptions({ method: "POST", body: JSON.stringify(body) })).then(function (res) { return res.json(); })];
});
});
};
LangfuseCoreStateless.prototype._parsePayload = function (response) {

@@ -400,3 +437,3 @@ try {

};
// Flushes the queue
// Flushes all events that are not yet sent to the server
// @returns {Promise[]} - list of promises for each item in the queue that is flushed

@@ -428,7 +465,6 @@ LangfuseCoreStateless.prototype.flush = function () {

var url = "".concat(_this.baseUrl).concat(item.apiRoute);
var fetchOptions = {
var fetchOptions = _this.getFetchOptions({
method: item.method,
headers: __assign({ "Content-Type": "application/json", "X-Langfuse-Sdk-Name": "langfuse-js", "X-Langfuse-Sdk-Version": _this.getLibraryVersion(), "X-Langfuse-Sdk-Variant": _this.getLibraryId(), "X-Langfuse-Public-Key": _this.publicKey }, _this.constructAuthorizationHeader(_this.publicKey, _this.secretKey)),
body: payload,
};
});
var requestPromise = _this.fetchWithRetry(url, fetchOptions);

@@ -445,2 +481,10 @@ _this.pendingPromises[item.id] = requestPromise;

};
LangfuseCoreStateless.prototype.getFetchOptions = function (p) {
var fetchOptions = {
method: p.method,
headers: __assign({ "Content-Type": "application/json", "X-Langfuse-Sdk-Name": "langfuse-js", "X-Langfuse-Sdk-Version": this.getLibraryVersion(), "X-Langfuse-Sdk-Variant": this.getLibraryId(), "X-Langfuse-Public-Key": this.publicKey }, this.constructAuthorizationHeader(this.publicKey, this.secretKey)),
body: p.body,
};
return fetchOptions;
};
LangfuseCoreStateless.prototype.constructAuthorizationHeader = function (publicKey, secretKey) {

@@ -609,2 +653,34 @@ if (secretKey === undefined) {

};
LangfuseCore.prototype.getDataset = function (name) {
return __awaiter(this, void 0, void 0, function () {
var _a, items, dataset, returnDataset;
var _this = this;
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, this._getDataset(name)];
case 1:
_a = _b.sent(), items = _a.items, dataset = __rest(_a, ["items"]);
returnDataset = __assign(__assign({}, dataset), { items: items.map(function (item) { return (__assign(__assign({}, item), { link: function (obj, runName) { return __awaiter(_this, void 0, void 0, function () {
var data;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.awaitAllQueuedAndPendingRequests()];
case 1:
_a.sent();
return [4 /*yield*/, this.createDatasetRunItem({
runName: runName,
datasetItemId: item.id,
observationId: obj.id,
})];
case 2:
data = _a.sent();
return [2 /*return*/, data];
}
});
}); } })); }) });
return [2 /*return*/, returnDataset];
}
});
});
};
LangfuseCore.prototype._updateSpan = function (body) {

@@ -847,3 +923,3 @@ this.updateSpanStateless(body);

var version = "1.0.21";
var version = "1.0.22";

@@ -850,0 +926,0 @@ var Langfuse = /** @class */function (_super) {

@@ -10,2 +10,22 @@ /**

interface paths {
"/api/public/dataset-items": {
/** @description Create a dataset item */
post: operations["datasetItems_create"];
};
"/api/public/dataset-run-items": {
/** @description Create a dataset run item */
post: operations["datasetRunItems_create"];
};
"/api/public/datasets/{datasetName}": {
/** @description Get a dataset and its items */
get: operations["datasets_get"];
};
"/api/public/datasets": {
/** @description Create a dataset */
post: operations["datasets_create"];
};
"/api/public/datasets/{datasetName}/runs/{runName}": {
/** @description Get a dataset run and its items */
get: operations["datasets_getRuns"];
};
"/api/public/events": {

@@ -16,2 +36,4 @@ /** @description Add an event to the database */

"/api/public/generations": {
/** @description Get a list of generations */
get: operations["generations_get"];
post: operations["generations_log"];

@@ -146,2 +168,50 @@ patch: operations["generations_update"];

};
/** Dataset */
Dataset: {
id: string;
name: string;
status: components["schemas"]["DatasetStatus"];
projectId: string;
/** Format: date-time */
createdAt: string;
/** Format: date-time */
updatedAt: string;
items: components["schemas"]["DatasetItem"][];
runs: string[];
};
/** DatasetItem */
DatasetItem: {
id: string;
status: components["schemas"]["DatasetStatus"];
input: unknown;
expectedOutput?: Record<string, unknown> | null;
sourceObservationId?: string | null;
datasetId: string;
/** Format: date-time */
createdAt: string;
/** Format: date-time */
updatedAt: string;
};
/** DatasetRunItem */
DatasetRunItem: {
id: string;
datasetRunId: string;
datasetItemId: string;
observationId: string;
/** Format: date-time */
createdAt: string;
/** Format: date-time */
updatedAt: string;
};
/** DatasetRun */
DatasetRun: {
id: string;
name: string;
datasetId: string;
/** Format: date-time */
createdAt: string;
/** Format: date-time */
updatedAt: string;
datasetRunItems: components["schemas"]["DatasetRunItem"][];
};
/**

@@ -165,2 +235,23 @@ * ObservationLevel

};
/**
* DatasetStatus
* @enum {string}
*/
DatasetStatus: "ACTIVE" | "ARCHIVED";
/** CreateDatasetItemRequest */
CreateDatasetItemRequest: {
datasetName: string;
input: unknown;
expectedOutput?: Record<string, unknown> | null;
};
/** CreateDatasetRunItemRequest */
CreateDatasetRunItemRequest: {
runName: string;
datasetItemId: string;
observationId: string;
};
/** CreateDatasetRequest */
CreateDatasetRequest: {
name: string;
};
/** UpdateGenerationRequest */

@@ -187,2 +278,7 @@ UpdateGenerationRequest: {

};
/** Generations */
Generations: {
data: components["schemas"]["Observation"][];
meta: components["schemas"]["utilsMetaResponse"];
};
/** CreateScoreRequest */

@@ -252,2 +348,203 @@ CreateScoreRequest: {

interface operations {
/** @description Create a dataset item */
datasetItems_create: {
requestBody: {
content: {
"application/json": components["schemas"]["CreateDatasetItemRequest"];
};
};
responses: {
200: {
content: {
"application/json": components["schemas"]["DatasetItem"];
};
};
400: {
content: {
"application/json": string;
};
};
401: {
content: {
"application/json": string;
};
};
403: {
content: {
"application/json": string;
};
};
404: {
content: {
"application/json": string;
};
};
405: {
content: {
"application/json": string;
};
};
};
};
/** @description Create a dataset run item */
datasetRunItems_create: {
requestBody: {
content: {
"application/json": components["schemas"]["CreateDatasetRunItemRequest"];
};
};
responses: {
200: {
content: {
"application/json": components["schemas"]["DatasetRunItem"];
};
};
400: {
content: {
"application/json": string;
};
};
401: {
content: {
"application/json": string;
};
};
403: {
content: {
"application/json": string;
};
};
404: {
content: {
"application/json": string;
};
};
405: {
content: {
"application/json": string;
};
};
};
};
/** @description Get a dataset and its items */
datasets_get: {
parameters: {
path: {
datasetName: string;
};
};
responses: {
200: {
content: {
"application/json": components["schemas"]["Dataset"];
};
};
400: {
content: {
"application/json": string;
};
};
401: {
content: {
"application/json": string;
};
};
403: {
content: {
"application/json": string;
};
};
404: {
content: {
"application/json": string;
};
};
405: {
content: {
"application/json": string;
};
};
};
};
/** @description Create a dataset */
datasets_create: {
requestBody: {
content: {
"application/json": components["schemas"]["CreateDatasetRequest"];
};
};
responses: {
200: {
content: {
"application/json": components["schemas"]["Dataset"];
};
};
400: {
content: {
"application/json": string;
};
};
401: {
content: {
"application/json": string;
};
};
403: {
content: {
"application/json": string;
};
};
404: {
content: {
"application/json": string;
};
};
405: {
content: {
"application/json": string;
};
};
};
};
/** @description Get a dataset run and its items */
datasets_getRuns: {
parameters: {
path: {
datasetName: string;
runName: string;
};
};
responses: {
200: {
content: {
"application/json": components["schemas"]["DatasetRun"];
};
};
400: {
content: {
"application/json": string;
};
};
401: {
content: {
"application/json": string;
};
};
403: {
content: {
"application/json": string;
};
};
404: {
content: {
"application/json": string;
};
};
405: {
content: {
"application/json": string;
};
};
};
};
/** @description Add an event to the database */

@@ -293,2 +590,45 @@ event_create: {

};
/** @description Get a list of generations */
generations_get: {
parameters: {
query?: {
page?: number | null;
limit?: number | null;
name?: string | null;
userId?: string | null;
};
};
responses: {
200: {
content: {
"application/json": components["schemas"]["Generations"];
};
};
400: {
content: {
"application/json": string;
};
};
401: {
content: {
"application/json": string;
};
};
403: {
content: {
"application/json": string;
};
};
404: {
content: {
"application/json": string;
};
};
405: {
content: {
"application/json": string;
};
};
};
};
generations_log: {

@@ -724,6 +1064,6 @@ requestBody: {

};
type LangfuseFetchResponse = {
type LangfuseFetchResponse<T = any> = {
status: number;
text: () => Promise<string>;
json: () => Promise<any>;
json: () => Promise<T>;
};

@@ -738,5 +1078,14 @@ type CreateLangfuseTraceBody = FixTypes<paths["/api/public/traces"]["post"]["requestBody"]["content"]["application/json"]>;

type LangfuseObject = "createTrace" | "createEvent" | "createSpan" | "createGeneration" | "createScore" | "updateSpan" | "updateGeneration";
type GetLangfuseDatasetParams = FixTypes<paths["/api/public/datasets/{datasetName}"]["get"]["parameters"]["path"]>;
type GetLangfuseDatasetResponse = FixTypes<paths["/api/public/datasets/{datasetName}"]["get"]["responses"]["200"]["content"]["application/json"]>;
type CreateLangfuseDatasetRunItemBody = FixTypes<paths["/api/public/dataset-run-items"]["post"]["requestBody"]["content"]["application/json"]>;
type CreateLangfuseDatasetRunItemResponse = FixTypes<paths["/api/public/dataset-run-items"]["post"]["responses"]["200"]["content"]["application/json"]>;
type CreateLangfuseDatasetResponse = FixTypes<paths["/api/public/datasets"]["post"]["responses"]["200"]["content"]["application/json"]>;
type CreateLangfuseDatasetItemBody = paths["/api/public/dataset-items"]["post"]["requestBody"]["content"]["application/json"];
type CreateLangfuseDatasetItemResponse = FixTypes<paths["/api/public/dataset-items"]["post"]["responses"]["200"]["content"]["application/json"]>;
type GetLangfuseDatasetRunParams = FixTypes<paths["/api/public/datasets/{datasetName}/runs/{runName}"]["get"]["parameters"]["path"]>;
type GetLangfuseDatasetRunResponse = FixTypes<paths["/api/public/datasets/{datasetName}/runs/{runName}"]["get"]["responses"]["200"]["content"]["application/json"]>;
type OptionalTypes<T> = T extends null | undefined ? T : never;
type FixTypes<T> = Omit<{
[P in keyof T]: P extends "startTime" | "endTime" | "timestamp" | "completionStartTime" ? // Dates instead of strings
[P in keyof T]: P extends "startTime" | "endTime" | "timestamp" | "completionStartTime" | "createdAt" | "updatedAt" ? // Dates instead of strings
Date | OptionalTypes<T[P]> : T[P];

@@ -796,2 +1145,7 @@ }, "externalId" | "traceIdType">;

protected updateGenerationStateless(body: UpdateLangfuseGenerationBody): string;
protected _getDataset(name: GetLangfuseDatasetParams["datasetName"]): Promise<GetLangfuseDatasetResponse>;
getDatasetRun(params: GetLangfuseDatasetRunParams): Promise<GetLangfuseDatasetRunResponse>;
createDatasetRunItem(body: CreateLangfuseDatasetRunItemBody): Promise<CreateLangfuseDatasetRunItemResponse>;
createDataset(name: string): Promise<CreateLangfuseDatasetResponse>;
createDatasetItem(body: CreateLangfuseDatasetItemBody): Promise<CreateLangfuseDatasetItemResponse>;
protected _parsePayload(response: any): any;

@@ -804,2 +1158,3 @@ /***

flush(): Promise<LangfuseFetchResponse>[];
private getFetchOptions;
private constructAuthorizationHeader;

@@ -827,2 +1182,16 @@ private fetchWithRetry;

score(body: CreateLangfuseScoreBody): this;
getDataset(name: string): Promise<{
id: string;
name: string;
projectId: string;
items: Array<{
id: string;
input: any;
expectedOutput?: any;
sourceObservationId?: string | null;
link: (obj: LangfuseObservationClient, runName: string) => Promise<{
id: string;
}>;
}>;
}>;
_updateSpan(body: UpdateLangfuseSpanBody): this;

@@ -829,0 +1198,0 @@ _updateGeneration(body: UpdateLangfuseGenerationBody): this;

@@ -361,2 +361,39 @@ /******************************************************************************

};
LangfuseCoreStateless.prototype._getDataset = function (name) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.fetch("".concat(this.baseUrl, "/api/public/datasets/").concat(name), this.getFetchOptions({ method: "GET" })).then(function (res) { return res.json(); })];
});
});
};
LangfuseCoreStateless.prototype.getDatasetRun = function (params) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.fetch("".concat(this.baseUrl, "/api/public/datasets/").concat(params.datasetName, "/runs/").concat(params.runName), this.getFetchOptions({ method: "GET" })).then(function (res) { return res.json(); })];
});
});
};
LangfuseCoreStateless.prototype.createDatasetRunItem = function (body) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.fetch("".concat(this.baseUrl, "/api/public/dataset-run-items"), this.getFetchOptions({ method: "POST", body: JSON.stringify(body) })).then(function (res) { return res.json(); })];
});
});
};
LangfuseCoreStateless.prototype.createDataset = function (name) {
return __awaiter(this, void 0, void 0, function () {
var body;
return __generator(this, function (_a) {
body = { name: name };
return [2 /*return*/, this.fetch("".concat(this.baseUrl, "/api/public/datasets"), this.getFetchOptions({ method: "POST", body: JSON.stringify(body) })).then(function (res) { return res.json(); })];
});
});
};
LangfuseCoreStateless.prototype.createDatasetItem = function (body) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.fetch("".concat(this.baseUrl, "/api/public/dataset-items"), this.getFetchOptions({ method: "POST", body: JSON.stringify(body) })).then(function (res) { return res.json(); })];
});
});
};
LangfuseCoreStateless.prototype._parsePayload = function (response) {

@@ -396,3 +433,3 @@ try {

};
// Flushes the queue
// Flushes all events that are not yet sent to the server
// @returns {Promise[]} - list of promises for each item in the queue that is flushed

@@ -424,7 +461,6 @@ LangfuseCoreStateless.prototype.flush = function () {

var url = "".concat(_this.baseUrl).concat(item.apiRoute);
var fetchOptions = {
var fetchOptions = _this.getFetchOptions({
method: item.method,
headers: __assign({ "Content-Type": "application/json", "X-Langfuse-Sdk-Name": "langfuse-js", "X-Langfuse-Sdk-Version": _this.getLibraryVersion(), "X-Langfuse-Sdk-Variant": _this.getLibraryId(), "X-Langfuse-Public-Key": _this.publicKey }, _this.constructAuthorizationHeader(_this.publicKey, _this.secretKey)),
body: payload,
};
});
var requestPromise = _this.fetchWithRetry(url, fetchOptions);

@@ -441,2 +477,10 @@ _this.pendingPromises[item.id] = requestPromise;

};
LangfuseCoreStateless.prototype.getFetchOptions = function (p) {
var fetchOptions = {
method: p.method,
headers: __assign({ "Content-Type": "application/json", "X-Langfuse-Sdk-Name": "langfuse-js", "X-Langfuse-Sdk-Version": this.getLibraryVersion(), "X-Langfuse-Sdk-Variant": this.getLibraryId(), "X-Langfuse-Public-Key": this.publicKey }, this.constructAuthorizationHeader(this.publicKey, this.secretKey)),
body: p.body,
};
return fetchOptions;
};
LangfuseCoreStateless.prototype.constructAuthorizationHeader = function (publicKey, secretKey) {

@@ -605,2 +649,34 @@ if (secretKey === undefined) {

};
LangfuseCore.prototype.getDataset = function (name) {
return __awaiter(this, void 0, void 0, function () {
var _a, items, dataset, returnDataset;
var _this = this;
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, this._getDataset(name)];
case 1:
_a = _b.sent(), items = _a.items, dataset = __rest(_a, ["items"]);
returnDataset = __assign(__assign({}, dataset), { items: items.map(function (item) { return (__assign(__assign({}, item), { link: function (obj, runName) { return __awaiter(_this, void 0, void 0, function () {
var data;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.awaitAllQueuedAndPendingRequests()];
case 1:
_a.sent();
return [4 /*yield*/, this.createDatasetRunItem({
runName: runName,
datasetItemId: item.id,
observationId: obj.id,
})];
case 2:
data = _a.sent();
return [2 /*return*/, data];
}
});
}); } })); }) });
return [2 /*return*/, returnDataset];
}
});
});
};
LangfuseCore.prototype._updateSpan = function (body) {

@@ -843,3 +919,3 @@ this.updateSpanStateless(body);

var version = "1.0.21";
var version = "1.0.22";

@@ -846,0 +922,0 @@ var Langfuse = /** @class */function (_super) {

@@ -1,2 +0,2 @@

import { type LangfuseFetchOptions, type LangfuseFetchResponse, type LangfuseCoreOptions, LangfusePersistedProperty, type CreateLangfuseTraceBody, type LangfuseObject, type CreateLangfuseEventBody, type CreateLangfuseSpanBody, type CreateLangfuseGenerationBody, type CreateLangfuseScoreBody, type UpdateLangfuseSpanBody, type UpdateLangfuseGenerationBody } from "./types";
import { type LangfuseFetchOptions, type LangfuseFetchResponse, type LangfuseCoreOptions, LangfusePersistedProperty, type CreateLangfuseTraceBody, type LangfuseObject, type CreateLangfuseEventBody, type CreateLangfuseSpanBody, type CreateLangfuseGenerationBody, type CreateLangfuseScoreBody, type UpdateLangfuseSpanBody, type UpdateLangfuseGenerationBody, type GetLangfuseDatasetParams, type GetLangfuseDatasetResponse, type CreateLangfuseDatasetRunItemBody, type CreateLangfuseDatasetRunItemResponse, type CreateLangfuseDatasetResponse, type CreateLangfuseDatasetItemBody, type CreateLangfuseDatasetItemResponse, type GetLangfuseDatasetRunResponse, type GetLangfuseDatasetRunParams } from "./types";
import { type RetriableOptions } from "./utils";

@@ -41,2 +41,7 @@ export * as utils from "./utils";

protected updateGenerationStateless(body: UpdateLangfuseGenerationBody): string;
protected _getDataset(name: GetLangfuseDatasetParams["datasetName"]): Promise<GetLangfuseDatasetResponse>;
getDatasetRun(params: GetLangfuseDatasetRunParams): Promise<GetLangfuseDatasetRunResponse>;
createDatasetRunItem(body: CreateLangfuseDatasetRunItemBody): Promise<CreateLangfuseDatasetRunItemResponse>;
createDataset(name: string): Promise<CreateLangfuseDatasetResponse>;
createDatasetItem(body: CreateLangfuseDatasetItemBody): Promise<CreateLangfuseDatasetItemResponse>;
protected _parsePayload(response: any): any;

@@ -49,2 +54,3 @@ /***

flush(): Promise<LangfuseFetchResponse>[];
private getFetchOptions;
private constructAuthorizationHeader;

@@ -72,2 +78,16 @@ private fetchWithRetry;

score(body: CreateLangfuseScoreBody): this;
getDataset(name: string): Promise<{
id: string;
name: string;
projectId: string;
items: Array<{
id: string;
input: any;
expectedOutput?: any;
sourceObservationId?: string | null;
link: (obj: LangfuseObservationClient, runName: string) => Promise<{
id: string;
}>;
}>;
}>;
_updateSpan(body: UpdateLangfuseSpanBody): this;

@@ -74,0 +94,0 @@ _updateGeneration(body: UpdateLangfuseGenerationBody): this;

@@ -10,2 +10,22 @@ /**

export interface paths {
"/api/public/dataset-items": {
/** @description Create a dataset item */
post: operations["datasetItems_create"];
};
"/api/public/dataset-run-items": {
/** @description Create a dataset run item */
post: operations["datasetRunItems_create"];
};
"/api/public/datasets/{datasetName}": {
/** @description Get a dataset and its items */
get: operations["datasets_get"];
};
"/api/public/datasets": {
/** @description Create a dataset */
post: operations["datasets_create"];
};
"/api/public/datasets/{datasetName}/runs/{runName}": {
/** @description Get a dataset run and its items */
get: operations["datasets_getRuns"];
};
"/api/public/events": {

@@ -16,2 +36,4 @@ /** @description Add an event to the database */

"/api/public/generations": {
/** @description Get a list of generations */
get: operations["generations_get"];
post: operations["generations_log"];

@@ -147,2 +169,50 @@ patch: operations["generations_update"];

};
/** Dataset */
Dataset: {
id: string;
name: string;
status: components["schemas"]["DatasetStatus"];
projectId: string;
/** Format: date-time */
createdAt: string;
/** Format: date-time */
updatedAt: string;
items: components["schemas"]["DatasetItem"][];
runs: string[];
};
/** DatasetItem */
DatasetItem: {
id: string;
status: components["schemas"]["DatasetStatus"];
input: unknown;
expectedOutput?: Record<string, unknown> | null;
sourceObservationId?: string | null;
datasetId: string;
/** Format: date-time */
createdAt: string;
/** Format: date-time */
updatedAt: string;
};
/** DatasetRunItem */
DatasetRunItem: {
id: string;
datasetRunId: string;
datasetItemId: string;
observationId: string;
/** Format: date-time */
createdAt: string;
/** Format: date-time */
updatedAt: string;
};
/** DatasetRun */
DatasetRun: {
id: string;
name: string;
datasetId: string;
/** Format: date-time */
createdAt: string;
/** Format: date-time */
updatedAt: string;
datasetRunItems: components["schemas"]["DatasetRunItem"][];
};
/**

@@ -166,2 +236,23 @@ * ObservationLevel

};
/**
* DatasetStatus
* @enum {string}
*/
DatasetStatus: "ACTIVE" | "ARCHIVED";
/** CreateDatasetItemRequest */
CreateDatasetItemRequest: {
datasetName: string;
input: unknown;
expectedOutput?: Record<string, unknown> | null;
};
/** CreateDatasetRunItemRequest */
CreateDatasetRunItemRequest: {
runName: string;
datasetItemId: string;
observationId: string;
};
/** CreateDatasetRequest */
CreateDatasetRequest: {
name: string;
};
/** UpdateGenerationRequest */

@@ -188,2 +279,7 @@ UpdateGenerationRequest: {

};
/** Generations */
Generations: {
data: components["schemas"]["Observation"][];
meta: components["schemas"]["utilsMetaResponse"];
};
/** CreateScoreRequest */

@@ -254,2 +350,203 @@ CreateScoreRequest: {

export interface operations {
/** @description Create a dataset item */
datasetItems_create: {
requestBody: {
content: {
"application/json": components["schemas"]["CreateDatasetItemRequest"];
};
};
responses: {
200: {
content: {
"application/json": components["schemas"]["DatasetItem"];
};
};
400: {
content: {
"application/json": string;
};
};
401: {
content: {
"application/json": string;
};
};
403: {
content: {
"application/json": string;
};
};
404: {
content: {
"application/json": string;
};
};
405: {
content: {
"application/json": string;
};
};
};
};
/** @description Create a dataset run item */
datasetRunItems_create: {
requestBody: {
content: {
"application/json": components["schemas"]["CreateDatasetRunItemRequest"];
};
};
responses: {
200: {
content: {
"application/json": components["schemas"]["DatasetRunItem"];
};
};
400: {
content: {
"application/json": string;
};
};
401: {
content: {
"application/json": string;
};
};
403: {
content: {
"application/json": string;
};
};
404: {
content: {
"application/json": string;
};
};
405: {
content: {
"application/json": string;
};
};
};
};
/** @description Get a dataset and its items */
datasets_get: {
parameters: {
path: {
datasetName: string;
};
};
responses: {
200: {
content: {
"application/json": components["schemas"]["Dataset"];
};
};
400: {
content: {
"application/json": string;
};
};
401: {
content: {
"application/json": string;
};
};
403: {
content: {
"application/json": string;
};
};
404: {
content: {
"application/json": string;
};
};
405: {
content: {
"application/json": string;
};
};
};
};
/** @description Create a dataset */
datasets_create: {
requestBody: {
content: {
"application/json": components["schemas"]["CreateDatasetRequest"];
};
};
responses: {
200: {
content: {
"application/json": components["schemas"]["Dataset"];
};
};
400: {
content: {
"application/json": string;
};
};
401: {
content: {
"application/json": string;
};
};
403: {
content: {
"application/json": string;
};
};
404: {
content: {
"application/json": string;
};
};
405: {
content: {
"application/json": string;
};
};
};
};
/** @description Get a dataset run and its items */
datasets_getRuns: {
parameters: {
path: {
datasetName: string;
runName: string;
};
};
responses: {
200: {
content: {
"application/json": components["schemas"]["DatasetRun"];
};
};
400: {
content: {
"application/json": string;
};
};
401: {
content: {
"application/json": string;
};
};
403: {
content: {
"application/json": string;
};
};
404: {
content: {
"application/json": string;
};
};
405: {
content: {
"application/json": string;
};
};
};
};
/** @description Add an event to the database */

@@ -295,2 +592,45 @@ event_create: {

};
/** @description Get a list of generations */
generations_get: {
parameters: {
query?: {
page?: number | null;
limit?: number | null;
name?: string | null;
userId?: string | null;
};
};
responses: {
200: {
content: {
"application/json": components["schemas"]["Generations"];
};
};
400: {
content: {
"application/json": string;
};
};
401: {
content: {
"application/json": string;
};
};
403: {
content: {
"application/json": string;
};
};
404: {
content: {
"application/json": string;
};
};
405: {
content: {
"application/json": string;
};
};
};
};
generations_log: {

@@ -297,0 +637,0 @@ requestBody: {

@@ -24,6 +24,6 @@ import { type paths } from "./openapi/server";

};
export type LangfuseFetchResponse = {
export type LangfuseFetchResponse<T = any> = {
status: number;
text: () => Promise<string>;
json: () => Promise<any>;
json: () => Promise<T>;
};

@@ -52,2 +52,12 @@ export type LangfuseQueueItem = {

export declare const LangfusePostApiRoutes: Record<LangfuseObject, [LangfuseQueueItem["method"], keyof paths]>;
export type GetLangfuseDatasetParams = FixTypes<paths["/api/public/datasets/{datasetName}"]["get"]["parameters"]["path"]>;
export type GetLangfuseDatasetResponse = FixTypes<paths["/api/public/datasets/{datasetName}"]["get"]["responses"]["200"]["content"]["application/json"]>;
export type CreateLangfuseDatasetRunItemBody = FixTypes<paths["/api/public/dataset-run-items"]["post"]["requestBody"]["content"]["application/json"]>;
export type CreateLangfuseDatasetRunItemResponse = FixTypes<paths["/api/public/dataset-run-items"]["post"]["responses"]["200"]["content"]["application/json"]>;
export type CreateLangfuseDatasetBody = paths["/api/public/datasets"]["post"]["requestBody"]["content"]["application/json"];
export type CreateLangfuseDatasetResponse = FixTypes<paths["/api/public/datasets"]["post"]["responses"]["200"]["content"]["application/json"]>;
export type CreateLangfuseDatasetItemBody = paths["/api/public/dataset-items"]["post"]["requestBody"]["content"]["application/json"];
export type CreateLangfuseDatasetItemResponse = FixTypes<paths["/api/public/dataset-items"]["post"]["responses"]["200"]["content"]["application/json"]>;
export type GetLangfuseDatasetRunParams = FixTypes<paths["/api/public/datasets/{datasetName}/runs/{runName}"]["get"]["parameters"]["path"]>;
export type GetLangfuseDatasetRunResponse = FixTypes<paths["/api/public/datasets/{datasetName}/runs/{runName}"]["get"]["responses"]["200"]["content"]["application/json"]>;
export type JsonType = string | number | boolean | null | {

@@ -58,5 +68,5 @@ [key: string]: JsonType;

type FixTypes<T> = Omit<{
[P in keyof T]: P extends "startTime" | "endTime" | "timestamp" | "completionStartTime" ? // Dates instead of strings
[P in keyof T]: P extends "startTime" | "endTime" | "timestamp" | "completionStartTime" | "createdAt" | "updatedAt" ? // Dates instead of strings
Date | OptionalTypes<T[P]> : T[P];
}, "externalId" | "traceIdType">;
export {};

4

package.json
{
"name": "langfuse",
"version": "1.0.21",
"version": "1.0.22",
"author": {

@@ -21,3 +21,3 @@ "name": "Langfuse",

],
"gitHead": "18bb7bcc77e0ed90ea25a105a317d35d0806fcda"
"gitHead": "da246fc8a702861fa76ed14485ccd271e629694b"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet