langfuse-core
Advanced tools
Comparing version 3.6.0 to 3.7.0
@@ -459,3 +459,4 @@ 'use strict'; | ||
async _getDataset(name) { | ||
return this.fetch(`${this.baseUrl}/api/public/datasets/${name}`, this._getFetchOptions({ | ||
const encodedName = encodeURIComponent(name); | ||
return this.fetch(`${this.baseUrl}/api/public/datasets/${encodedName}`, this._getFetchOptions({ | ||
method: "GET" | ||
@@ -465,3 +466,5 @@ })).then(res => res.json()); | ||
async getDatasetRun(params) { | ||
return this.fetch(`${this.baseUrl}/api/public/datasets/${params.datasetName}/runs/${params.runName}`, this._getFetchOptions({ | ||
const encodedDatasetName = encodeURIComponent(params.datasetName); | ||
const encodedRunName = encodeURIComponent(params.runName); | ||
return this.fetch(`${this.baseUrl}/api/public/datasets/${encodedDatasetName}/runs/${encodedRunName}`, this._getFetchOptions({ | ||
method: "GET" | ||
@@ -476,6 +479,12 @@ })).then(res => res.json()); | ||
} | ||
async createDataset(name) { | ||
const body = { | ||
name | ||
}; | ||
/** | ||
* Creates a dataset. Upserts the dataset if it already exists. | ||
* | ||
* @param dataset Can be either a string (name) or an object with name, description and metadata | ||
* @returns A promise that resolves to the response of the create operation. | ||
*/ | ||
async createDataset(dataset) { | ||
const body = typeof dataset === "string" ? { | ||
name: dataset | ||
} : dataset; | ||
return this.fetch(`${this.baseUrl}/api/public/datasets`, this._getFetchOptions({ | ||
@@ -827,5 +836,7 @@ method: "POST", | ||
...dataset, | ||
description: dataset.description ?? undefined, | ||
metadata: dataset.metadata ?? undefined, | ||
items: items.map(item => ({ | ||
...item, | ||
link: async (obj, runName) => { | ||
link: async (obj, runName, runArgs) => { | ||
await this.awaitAllQueuedAndPendingRequests(); | ||
@@ -835,3 +846,6 @@ const data = await this.createDatasetRunItem({ | ||
datasetItemId: item.id, | ||
observationId: obj.id | ||
observationId: obj.observationId, | ||
traceId: obj.traceId, | ||
runDescription: runArgs?.description, | ||
metadata: runArgs?.metadata | ||
}); | ||
@@ -838,0 +852,0 @@ return data; |
{ | ||
"name": "langfuse-core", | ||
"version": "3.6.0", | ||
"version": "3.7.0", | ||
"engines": { | ||
@@ -40,3 +40,3 @@ "node": ">=18" | ||
}, | ||
"gitHead": "110b1078b7363176c2bfce4ec056ee96620c9dc0" | ||
"gitHead": "47f2f2d14fe61363be5e14c2d41f5d24b125480e" | ||
} |
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 too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
378518
4096