langsmith
Advanced tools
Comparing version 0.0.41 to 0.0.42
import { AsyncCallerParams } from "./utils/async_caller.js"; | ||
import { Dataset, Example, ExampleUpdate, Feedback, KVMap, Run, RunCreate, RunUpdate, ScoreType, TracerSession, TracerSessionResult, ValueType, DataType, LangChainBaseMessage } from "./schemas.js"; | ||
import { DataType, Dataset, Example, ExampleUpdate, Feedback, KVMap, LangChainBaseMessage, Run, RunCreate, RunUpdate, ScoreType, TracerSession, TracerSessionResult, ValueType } from "./schemas.js"; | ||
import { RunEvaluator } from "./evaluation/evaluator.js"; | ||
@@ -79,2 +79,3 @@ interface ClientConfig { | ||
private get headers(); | ||
private _getResponse; | ||
private _get; | ||
@@ -99,2 +100,5 @@ private _getPaginated; | ||
readRunSharedLink(runId: string): Promise<string | undefined>; | ||
listSharedRuns(shareToken: string, { runIds, }?: { | ||
runIds?: string[]; | ||
}): Promise<Run[]>; | ||
createProject({ projectName, projectExtra, upsert, referenceDatasetId, }: { | ||
@@ -132,2 +136,6 @@ projectName: string; | ||
}): Promise<Dataset>; | ||
readDatasetOpenaiFinetuning({ datasetId, datasetName, }: { | ||
datasetId?: string; | ||
datasetName?: string; | ||
}): Promise<any[]>; | ||
listDatasets({ limit, offset, datasetIds, datasetName, datasetNameContains, }?: { | ||
@@ -134,0 +142,0 @@ limit?: number; |
@@ -133,3 +133,3 @@ import * as uuid from "uuid"; | ||
} | ||
async _get(path, queryParams) { | ||
async _getResponse(path, queryParams) { | ||
const paramsString = queryParams?.toString() ?? ""; | ||
@@ -145,2 +145,6 @@ const url = `${this.apiUrl}${path}?${paramsString}`; | ||
} | ||
return response; | ||
} | ||
async _get(path, queryParams) { | ||
const response = await this._getResponse(path, queryParams); | ||
return response.json(); | ||
@@ -372,2 +376,19 @@ } | ||
} | ||
async listSharedRuns(shareToken, { runIds, } = {}) { | ||
const queryParams = new URLSearchParams({ | ||
share_token: shareToken, | ||
}); | ||
if (runIds !== undefined) { | ||
for (const runId of runIds) { | ||
queryParams.append("id", runId); | ||
} | ||
} | ||
const response = await this.caller.call(fetch, `${this.apiUrl}/public/${shareToken}/runs${queryParams}`, { | ||
method: "GET", | ||
headers: this.headers, | ||
signal: AbortSignal.timeout(this.timeout_ms), | ||
}); | ||
const runs = await response.json(); | ||
return runs; | ||
} | ||
async createProject({ projectName, projectExtra, upsert, referenceDatasetId, }) { | ||
@@ -574,2 +595,21 @@ const upsert_ = upsert ? `?upsert=true` : ""; | ||
} | ||
async readDatasetOpenaiFinetuning({ datasetId, datasetName, }) { | ||
let path = "/datasets"; | ||
if (datasetId !== undefined) { | ||
// do nothing | ||
} | ||
else if (datasetName !== undefined) { | ||
datasetId = (await this.readDataset({ datasetName })).id; | ||
} | ||
else { | ||
throw new Error("Must provide datasetName or datasetId"); | ||
} | ||
const response = await this._getResponse(`${path}/${datasetId}/openai_ft`); | ||
const datasetText = await response.text(); | ||
const dataset = datasetText | ||
.trim() | ||
.split("\n") | ||
.map((line) => JSON.parse(line)); | ||
return dataset; | ||
} | ||
async *listDatasets({ limit = 100, offset = 0, datasetIds, datasetName, datasetNameContains, } = {}) { | ||
@@ -576,0 +616,0 @@ const path = "/datasets"; |
{ | ||
"name": "langsmith", | ||
"version": "0.0.41", | ||
"version": "0.0.42", | ||
"description": "Client library to connect to the LangSmith LLM Tracing and Evaluation Platform.", | ||
@@ -5,0 +5,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
186258
4638
46