langsmith 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.cjs +23 -12
- package/dist/client.d.ts +7 -5
- package/dist/client.js +23 -12
- package/dist/schemas.d.ts +2 -1
- package/package.json +1 -1
package/dist/client.cjs
CHANGED
|
@@ -214,7 +214,7 @@ class Client {
|
|
|
214
214
|
});
|
|
215
215
|
await raiseForStatus(response, "delete run");
|
|
216
216
|
}
|
|
217
|
-
async createProject({ projectName, projectExtra,
|
|
217
|
+
async createProject({ projectName, projectExtra, upsert, }) {
|
|
218
218
|
const upsert_ = upsert ? `?upsert=true` : "";
|
|
219
219
|
const endpoint = `${this.apiUrl}/sessions${upsert_}`;
|
|
220
220
|
const body = {
|
|
@@ -223,9 +223,6 @@ class Client {
|
|
|
223
223
|
if (projectExtra !== undefined) {
|
|
224
224
|
body["extra"] = projectExtra;
|
|
225
225
|
}
|
|
226
|
-
if (mode !== undefined) {
|
|
227
|
-
body["mode"] = mode;
|
|
228
|
-
}
|
|
229
226
|
const response = await this.caller.call(fetch, endpoint, {
|
|
230
227
|
method: "POST",
|
|
231
228
|
headers: { ...this.headers, "Content-Type": "application/json" },
|
|
@@ -290,15 +287,25 @@ class Client {
|
|
|
290
287
|
});
|
|
291
288
|
await raiseForStatus(response, `delete session ${projectId_} (${projectName})`);
|
|
292
289
|
}
|
|
293
|
-
async uploadCsv({ csvFile, fileName, inputKeys, outputKeys, description, }) {
|
|
290
|
+
async uploadCsv({ csvFile, fileName, inputKeys, outputKeys, description, dataType, name, }) {
|
|
294
291
|
const url = `${this.apiUrl}/datasets/upload`;
|
|
295
292
|
const formData = new FormData();
|
|
296
293
|
formData.append("file", csvFile, fileName);
|
|
297
|
-
|
|
298
|
-
|
|
294
|
+
inputKeys.forEach((key) => {
|
|
295
|
+
formData.append("input_keys", key);
|
|
296
|
+
});
|
|
297
|
+
outputKeys.forEach((key) => {
|
|
298
|
+
formData.append("output_keys", key);
|
|
299
|
+
});
|
|
299
300
|
if (description) {
|
|
300
301
|
formData.append("description", description);
|
|
301
302
|
}
|
|
303
|
+
if (dataType) {
|
|
304
|
+
formData.append("data_type", dataType);
|
|
305
|
+
}
|
|
306
|
+
if (name) {
|
|
307
|
+
formData.append("name", name);
|
|
308
|
+
}
|
|
302
309
|
const response = await this.caller.call(fetch, url, {
|
|
303
310
|
method: "POST",
|
|
304
311
|
headers: this.headers,
|
|
@@ -315,14 +322,18 @@ class Client {
|
|
|
315
322
|
const result = await response.json();
|
|
316
323
|
return result;
|
|
317
324
|
}
|
|
318
|
-
async createDataset(name, { description } = {}) {
|
|
325
|
+
async createDataset(name, { description, dataType, } = {}) {
|
|
326
|
+
const body = {
|
|
327
|
+
name,
|
|
328
|
+
description,
|
|
329
|
+
};
|
|
330
|
+
if (dataType) {
|
|
331
|
+
body.data_type = dataType;
|
|
332
|
+
}
|
|
319
333
|
const response = await this.caller.call(fetch, `${this.apiUrl}/datasets`, {
|
|
320
334
|
method: "POST",
|
|
321
335
|
headers: { ...this.headers, "Content-Type": "application/json" },
|
|
322
|
-
body: JSON.stringify(
|
|
323
|
-
name,
|
|
324
|
-
description,
|
|
325
|
-
}),
|
|
336
|
+
body: JSON.stringify(body),
|
|
326
337
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
327
338
|
});
|
|
328
339
|
if (!response.ok) {
|
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AsyncCallerParams } from "./utils/async_caller.js";
|
|
2
|
-
import { Dataset, Example, ExampleUpdate, Feedback, KVMap, Run, RunCreate, RunType, RunUpdate, ScoreType, TracerSession, TracerSessionResult, ValueType } from "./schemas.js";
|
|
2
|
+
import { Dataset, Example, ExampleUpdate, Feedback, KVMap, Run, RunCreate, RunType, RunUpdate, ScoreType, TracerSession, TracerSessionResult, ValueType, DataType } from "./schemas.js";
|
|
3
3
|
import { RunEvaluator } from "./evaluation/evaluator.js";
|
|
4
4
|
interface ClientConfig {
|
|
5
5
|
apiUrl?: string;
|
|
@@ -23,6 +23,8 @@ interface UploadCSVParams {
|
|
|
23
23
|
inputKeys: string[];
|
|
24
24
|
outputKeys: string[];
|
|
25
25
|
description?: string;
|
|
26
|
+
dataType?: DataType;
|
|
27
|
+
name?: string;
|
|
26
28
|
}
|
|
27
29
|
interface CreateRunParams {
|
|
28
30
|
name: string;
|
|
@@ -62,10 +64,9 @@ export declare class Client {
|
|
|
62
64
|
private _loadChildRuns;
|
|
63
65
|
listRuns({ projectId, projectName, executionOrder, runType, error, id, limit, offset, }: ListRunsParams): Promise<Run[]>;
|
|
64
66
|
deleteRun(runId: string): Promise<void>;
|
|
65
|
-
createProject({ projectName, projectExtra,
|
|
67
|
+
createProject({ projectName, projectExtra, upsert, }: {
|
|
66
68
|
projectName: string;
|
|
67
69
|
projectExtra?: object;
|
|
68
|
-
mode?: string;
|
|
69
70
|
upsert?: boolean;
|
|
70
71
|
}): Promise<TracerSession>;
|
|
71
72
|
readProject({ projectId, projectName, }: {
|
|
@@ -77,9 +78,10 @@ export declare class Client {
|
|
|
77
78
|
projectId?: string;
|
|
78
79
|
projectName?: string;
|
|
79
80
|
}): Promise<void>;
|
|
80
|
-
uploadCsv({ csvFile, fileName, inputKeys, outputKeys, description, }: UploadCSVParams): Promise<Dataset>;
|
|
81
|
-
createDataset(name: string, { description }?: {
|
|
81
|
+
uploadCsv({ csvFile, fileName, inputKeys, outputKeys, description, dataType, name, }: UploadCSVParams): Promise<Dataset>;
|
|
82
|
+
createDataset(name: string, { description, dataType, }?: {
|
|
82
83
|
description?: string;
|
|
84
|
+
dataType?: DataType;
|
|
83
85
|
}): Promise<Dataset>;
|
|
84
86
|
readDataset({ datasetId, datasetName, }: {
|
|
85
87
|
datasetId?: string;
|
package/dist/client.js
CHANGED
|
@@ -188,7 +188,7 @@ export class Client {
|
|
|
188
188
|
});
|
|
189
189
|
await raiseForStatus(response, "delete run");
|
|
190
190
|
}
|
|
191
|
-
async createProject({ projectName, projectExtra,
|
|
191
|
+
async createProject({ projectName, projectExtra, upsert, }) {
|
|
192
192
|
const upsert_ = upsert ? `?upsert=true` : "";
|
|
193
193
|
const endpoint = `${this.apiUrl}/sessions${upsert_}`;
|
|
194
194
|
const body = {
|
|
@@ -197,9 +197,6 @@ export class Client {
|
|
|
197
197
|
if (projectExtra !== undefined) {
|
|
198
198
|
body["extra"] = projectExtra;
|
|
199
199
|
}
|
|
200
|
-
if (mode !== undefined) {
|
|
201
|
-
body["mode"] = mode;
|
|
202
|
-
}
|
|
203
200
|
const response = await this.caller.call(fetch, endpoint, {
|
|
204
201
|
method: "POST",
|
|
205
202
|
headers: { ...this.headers, "Content-Type": "application/json" },
|
|
@@ -264,15 +261,25 @@ export class Client {
|
|
|
264
261
|
});
|
|
265
262
|
await raiseForStatus(response, `delete session ${projectId_} (${projectName})`);
|
|
266
263
|
}
|
|
267
|
-
async uploadCsv({ csvFile, fileName, inputKeys, outputKeys, description, }) {
|
|
264
|
+
async uploadCsv({ csvFile, fileName, inputKeys, outputKeys, description, dataType, name, }) {
|
|
268
265
|
const url = `${this.apiUrl}/datasets/upload`;
|
|
269
266
|
const formData = new FormData();
|
|
270
267
|
formData.append("file", csvFile, fileName);
|
|
271
|
-
|
|
272
|
-
|
|
268
|
+
inputKeys.forEach((key) => {
|
|
269
|
+
formData.append("input_keys", key);
|
|
270
|
+
});
|
|
271
|
+
outputKeys.forEach((key) => {
|
|
272
|
+
formData.append("output_keys", key);
|
|
273
|
+
});
|
|
273
274
|
if (description) {
|
|
274
275
|
formData.append("description", description);
|
|
275
276
|
}
|
|
277
|
+
if (dataType) {
|
|
278
|
+
formData.append("data_type", dataType);
|
|
279
|
+
}
|
|
280
|
+
if (name) {
|
|
281
|
+
formData.append("name", name);
|
|
282
|
+
}
|
|
276
283
|
const response = await this.caller.call(fetch, url, {
|
|
277
284
|
method: "POST",
|
|
278
285
|
headers: this.headers,
|
|
@@ -289,14 +296,18 @@ export class Client {
|
|
|
289
296
|
const result = await response.json();
|
|
290
297
|
return result;
|
|
291
298
|
}
|
|
292
|
-
async createDataset(name, { description } = {}) {
|
|
299
|
+
async createDataset(name, { description, dataType, } = {}) {
|
|
300
|
+
const body = {
|
|
301
|
+
name,
|
|
302
|
+
description,
|
|
303
|
+
};
|
|
304
|
+
if (dataType) {
|
|
305
|
+
body.data_type = dataType;
|
|
306
|
+
}
|
|
293
307
|
const response = await this.caller.call(fetch, `${this.apiUrl}/datasets`, {
|
|
294
308
|
method: "POST",
|
|
295
309
|
headers: { ...this.headers, "Content-Type": "application/json" },
|
|
296
|
-
body: JSON.stringify(
|
|
297
|
-
name,
|
|
298
|
-
description,
|
|
299
|
-
}),
|
|
310
|
+
body: JSON.stringify(body),
|
|
300
311
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
301
312
|
});
|
|
302
313
|
if (!response.ok) {
|
package/dist/schemas.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ export interface TracerSession {
|
|
|
3
3
|
id: string;
|
|
4
4
|
start_time: number;
|
|
5
5
|
name?: string;
|
|
6
|
-
mode?: string;
|
|
7
6
|
}
|
|
8
7
|
export interface TracerSessionResult extends TracerSession {
|
|
9
8
|
run_count?: number;
|
|
@@ -21,6 +20,7 @@ export type KVMap = Record<string, any>;
|
|
|
21
20
|
export type RunType = "llm" | "chain" | "tool" | "retriever" | "embedding";
|
|
22
21
|
export type ScoreType = number | boolean | null;
|
|
23
22
|
export type ValueType = number | boolean | string | object | null;
|
|
23
|
+
export type DataType = "kv" | "llm" | "chat";
|
|
24
24
|
export interface BaseExample {
|
|
25
25
|
dataset_id: string;
|
|
26
26
|
inputs: KVMap;
|
|
@@ -85,6 +85,7 @@ export interface BaseDataset {
|
|
|
85
85
|
name: string;
|
|
86
86
|
description: string;
|
|
87
87
|
tenant_id: string;
|
|
88
|
+
data_type?: DataType;
|
|
88
89
|
}
|
|
89
90
|
export interface Dataset extends BaseDataset {
|
|
90
91
|
id: string;
|