langsmith 0.1.41 → 0.1.43
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 +84 -8
- package/dist/client.d.ts +33 -2
- package/dist/client.js +85 -9
- package/dist/env.cjs +2 -7
- package/dist/env.js +3 -8
- package/dist/evaluation/_runner.cjs +1 -1
- package/dist/evaluation/_runner.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/schemas.d.ts +3 -0
- package/dist/utils/env.cjs +6 -1
- package/dist/utils/env.d.ts +1 -0
- package/dist/utils/env.js +4 -0
- package/package.json +1 -1
package/dist/client.cjs
CHANGED
|
@@ -56,13 +56,13 @@ async function mergeRuntimeEnvIntoRunCreates(runs) {
|
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
const getTracingSamplingRate = () => {
|
|
59
|
-
const samplingRateStr = (0, env_js_1.
|
|
59
|
+
const samplingRateStr = (0, env_js_1.getLangSmithEnvironmentVariable)("TRACING_SAMPLING_RATE");
|
|
60
60
|
if (samplingRateStr === undefined) {
|
|
61
61
|
return undefined;
|
|
62
62
|
}
|
|
63
63
|
const samplingRate = parseFloat(samplingRateStr);
|
|
64
64
|
if (samplingRate < 0 || samplingRate > 1) {
|
|
65
|
-
throw new Error(`
|
|
65
|
+
throw new Error(`LANGSMITH_TRACING_SAMPLING_RATE must be between 0 and 1 if set. Got: ${samplingRate}`);
|
|
66
66
|
}
|
|
67
67
|
return samplingRate;
|
|
68
68
|
};
|
|
@@ -296,11 +296,11 @@ class Client {
|
|
|
296
296
|
this.fetchOptions = config.fetchOptions || {};
|
|
297
297
|
}
|
|
298
298
|
static getDefaultClientConfig() {
|
|
299
|
-
const apiKey = (0, env_js_1.
|
|
300
|
-
const apiUrl = (0, env_js_1.
|
|
299
|
+
const apiKey = (0, env_js_1.getLangSmithEnvironmentVariable)("API_KEY");
|
|
300
|
+
const apiUrl = (0, env_js_1.getLangSmithEnvironmentVariable)("ENDPOINT") ??
|
|
301
301
|
"https://api.smith.langchain.com";
|
|
302
|
-
const hideInputs = (0, env_js_1.
|
|
303
|
-
const hideOutputs = (0, env_js_1.
|
|
302
|
+
const hideInputs = (0, env_js_1.getLangSmithEnvironmentVariable)("HIDE_INPUTS") === "true";
|
|
303
|
+
const hideOutputs = (0, env_js_1.getLangSmithEnvironmentVariable)("HIDE_OUTPUTS") === "true";
|
|
304
304
|
return {
|
|
305
305
|
apiUrl: apiUrl,
|
|
306
306
|
apiKey: apiKey,
|
|
@@ -743,7 +743,7 @@ class Client {
|
|
|
743
743
|
}
|
|
744
744
|
else {
|
|
745
745
|
const project = await this.readProject({
|
|
746
|
-
projectName: (0, env_js_1.
|
|
746
|
+
projectName: (0, env_js_1.getLangSmithEnvironmentVariable)("PROJECT") || "default",
|
|
747
747
|
});
|
|
748
748
|
sessionId = project.id;
|
|
749
749
|
}
|
|
@@ -1354,7 +1354,7 @@ class Client {
|
|
|
1354
1354
|
const result = await response.json();
|
|
1355
1355
|
return result;
|
|
1356
1356
|
}
|
|
1357
|
-
async createDataset(name, { description, dataType, } = {}) {
|
|
1357
|
+
async createDataset(name, { description, dataType, inputsSchema, outputsSchema, } = {}) {
|
|
1358
1358
|
const body = {
|
|
1359
1359
|
name,
|
|
1360
1360
|
description,
|
|
@@ -1362,6 +1362,12 @@ class Client {
|
|
|
1362
1362
|
if (dataType) {
|
|
1363
1363
|
body.data_type = dataType;
|
|
1364
1364
|
}
|
|
1365
|
+
if (inputsSchema) {
|
|
1366
|
+
body.inputs_schema_definition = inputsSchema;
|
|
1367
|
+
}
|
|
1368
|
+
if (outputsSchema) {
|
|
1369
|
+
body.outputs_schema_definition = outputsSchema;
|
|
1370
|
+
}
|
|
1365
1371
|
const response = await this.caller.call(fetch, `${this.apiUrl}/datasets`, {
|
|
1366
1372
|
method: "POST",
|
|
1367
1373
|
headers: { ...this.headers, "Content-Type": "application/json" },
|
|
@@ -1537,6 +1543,76 @@ class Client {
|
|
|
1537
1543
|
}
|
|
1538
1544
|
await response.json();
|
|
1539
1545
|
}
|
|
1546
|
+
async indexDataset({ datasetId, datasetName, tag, }) {
|
|
1547
|
+
let datasetId_ = datasetId;
|
|
1548
|
+
if (!datasetId_ && !datasetName) {
|
|
1549
|
+
throw new Error("Must provide either datasetName or datasetId");
|
|
1550
|
+
}
|
|
1551
|
+
else if (datasetId_ && datasetName) {
|
|
1552
|
+
throw new Error("Must provide either datasetName or datasetId, not both");
|
|
1553
|
+
}
|
|
1554
|
+
else if (!datasetId_) {
|
|
1555
|
+
const dataset = await this.readDataset({ datasetName });
|
|
1556
|
+
datasetId_ = dataset.id;
|
|
1557
|
+
}
|
|
1558
|
+
(0, _uuid_js_1.assertUuid)(datasetId_);
|
|
1559
|
+
const data = {
|
|
1560
|
+
tag: tag,
|
|
1561
|
+
};
|
|
1562
|
+
const response = await this.caller.call(fetch, `${this.apiUrl}/datasets/${datasetId_}/index`, {
|
|
1563
|
+
method: "POST",
|
|
1564
|
+
headers: { ...this.headers, "Content-Type": "application/json" },
|
|
1565
|
+
body: JSON.stringify(data),
|
|
1566
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1567
|
+
...this.fetchOptions,
|
|
1568
|
+
});
|
|
1569
|
+
if (!response.ok) {
|
|
1570
|
+
throw new Error(`Failed to index dataset ${datasetId_}: ${response.status} ${response.statusText}`);
|
|
1571
|
+
}
|
|
1572
|
+
await response.json();
|
|
1573
|
+
}
|
|
1574
|
+
/**
|
|
1575
|
+
* Lets you run a similarity search query on a dataset.
|
|
1576
|
+
*
|
|
1577
|
+
* Requires the dataset to be indexed. Please see the `indexDataset` method to set up indexing.
|
|
1578
|
+
*
|
|
1579
|
+
* @param inputs The input on which to run the similarity search. Must have the
|
|
1580
|
+
* same schema as the dataset.
|
|
1581
|
+
*
|
|
1582
|
+
* @param datasetId The dataset to search for similar examples.
|
|
1583
|
+
*
|
|
1584
|
+
* @param limit The maximum number of examples to return. Will return the top `limit` most
|
|
1585
|
+
* similar examples in order of most similar to least similar. If no similar
|
|
1586
|
+
* examples are found, random examples will be returned.
|
|
1587
|
+
*
|
|
1588
|
+
* @returns A list of similar examples.
|
|
1589
|
+
*
|
|
1590
|
+
*
|
|
1591
|
+
* @example
|
|
1592
|
+
* dataset_id = "123e4567-e89b-12d3-a456-426614174000"
|
|
1593
|
+
* inputs = {"text": "How many people live in Berlin?"}
|
|
1594
|
+
* limit = 5
|
|
1595
|
+
* examples = await client.similarExamples(inputs, dataset_id, limit)
|
|
1596
|
+
*/
|
|
1597
|
+
async similarExamples(inputs, datasetId, limit) {
|
|
1598
|
+
const data = {
|
|
1599
|
+
limit: limit,
|
|
1600
|
+
inputs: inputs,
|
|
1601
|
+
};
|
|
1602
|
+
(0, _uuid_js_1.assertUuid)(datasetId);
|
|
1603
|
+
const response = await this.caller.call(fetch, `${this.apiUrl}/datasets/${datasetId}/search`, {
|
|
1604
|
+
method: "POST",
|
|
1605
|
+
headers: { ...this.headers, "Content-Type": "application/json" },
|
|
1606
|
+
body: JSON.stringify(data),
|
|
1607
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1608
|
+
...this.fetchOptions,
|
|
1609
|
+
});
|
|
1610
|
+
if (!response.ok) {
|
|
1611
|
+
throw new Error(`Failed to fetch similar examples: ${response.status} ${response.statusText}`);
|
|
1612
|
+
}
|
|
1613
|
+
const result = await response.json();
|
|
1614
|
+
return result["examples"];
|
|
1615
|
+
}
|
|
1540
1616
|
async createExample(inputs, outputs, { datasetId, datasetName, createdAt, exampleId, metadata, split, }) {
|
|
1541
1617
|
let datasetId_ = datasetId;
|
|
1542
1618
|
if (datasetId_ === undefined && datasetName === undefined) {
|
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AsyncCallerParams } from "./utils/async_caller.js";
|
|
2
|
-
import { ComparativeExperiment, DataType, Dataset, DatasetDiffInfo, DatasetShareSchema, Example, ExampleUpdate, ExampleUpdateWithId, Feedback, FeedbackConfig, FeedbackIngestToken, KVMap, LangChainBaseMessage, LangSmithSettings, LikePromptResponse, Prompt, PromptCommit, PromptSortField, Run, RunCreate, RunUpdate, ScoreType, TimeDelta, TracerSession, TracerSessionResult, ValueType } from "./schemas.js";
|
|
2
|
+
import { ComparativeExperiment, DataType, Dataset, DatasetDiffInfo, DatasetShareSchema, Example, ExampleUpdate, ExampleUpdateWithId, Feedback, FeedbackConfig, FeedbackIngestToken, KVMap, LangChainBaseMessage, LangSmithSettings, LikePromptResponse, Prompt, PromptCommit, PromptSortField, Run, RunCreate, RunUpdate, ScoreType, ExampleSearch, TimeDelta, TracerSession, TracerSessionResult, ValueType } from "./schemas.js";
|
|
3
3
|
import { EvaluationResult, EvaluationResults, RunEvaluator } from "./evaluation/evaluator.js";
|
|
4
4
|
interface ClientConfig {
|
|
5
5
|
apiUrl?: string;
|
|
@@ -379,9 +379,11 @@ export declare class Client {
|
|
|
379
379
|
projectName?: string;
|
|
380
380
|
}): Promise<void>;
|
|
381
381
|
uploadCsv({ csvFile, fileName, inputKeys, outputKeys, description, dataType, name, }: UploadCSVParams): Promise<Dataset>;
|
|
382
|
-
createDataset(name: string, { description, dataType, }?: {
|
|
382
|
+
createDataset(name: string, { description, dataType, inputsSchema, outputsSchema, }?: {
|
|
383
383
|
description?: string;
|
|
384
384
|
dataType?: DataType;
|
|
385
|
+
inputsSchema?: KVMap;
|
|
386
|
+
outputsSchema?: KVMap;
|
|
385
387
|
}): Promise<Dataset>;
|
|
386
388
|
readDataset({ datasetId, datasetName, }: {
|
|
387
389
|
datasetId?: string;
|
|
@@ -423,6 +425,35 @@ export declare class Client {
|
|
|
423
425
|
datasetId?: string;
|
|
424
426
|
datasetName?: string;
|
|
425
427
|
}): Promise<void>;
|
|
428
|
+
indexDataset({ datasetId, datasetName, tag, }: {
|
|
429
|
+
datasetId?: string;
|
|
430
|
+
datasetName?: string;
|
|
431
|
+
tag?: string;
|
|
432
|
+
}): Promise<void>;
|
|
433
|
+
/**
|
|
434
|
+
* Lets you run a similarity search query on a dataset.
|
|
435
|
+
*
|
|
436
|
+
* Requires the dataset to be indexed. Please see the `indexDataset` method to set up indexing.
|
|
437
|
+
*
|
|
438
|
+
* @param inputs The input on which to run the similarity search. Must have the
|
|
439
|
+
* same schema as the dataset.
|
|
440
|
+
*
|
|
441
|
+
* @param datasetId The dataset to search for similar examples.
|
|
442
|
+
*
|
|
443
|
+
* @param limit The maximum number of examples to return. Will return the top `limit` most
|
|
444
|
+
* similar examples in order of most similar to least similar. If no similar
|
|
445
|
+
* examples are found, random examples will be returned.
|
|
446
|
+
*
|
|
447
|
+
* @returns A list of similar examples.
|
|
448
|
+
*
|
|
449
|
+
*
|
|
450
|
+
* @example
|
|
451
|
+
* dataset_id = "123e4567-e89b-12d3-a456-426614174000"
|
|
452
|
+
* inputs = {"text": "How many people live in Berlin?"}
|
|
453
|
+
* limit = 5
|
|
454
|
+
* examples = await client.similarExamples(inputs, dataset_id, limit)
|
|
455
|
+
*/
|
|
456
|
+
similarExamples(inputs: KVMap, datasetId: string, limit: number): Promise<ExampleSearch[]>;
|
|
426
457
|
createExample(inputs: KVMap, outputs: KVMap, { datasetId, datasetName, createdAt, exampleId, metadata, split, }: CreateExampleOptions): Promise<Example>;
|
|
427
458
|
createExamples(props: {
|
|
428
459
|
inputs: Array<KVMap>;
|
package/dist/client.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as uuid from "uuid";
|
|
2
2
|
import { AsyncCaller } from "./utils/async_caller.js";
|
|
3
3
|
import { convertLangChainMessageToExample, isLangChainMessage, } from "./utils/messages.js";
|
|
4
|
-
import {
|
|
4
|
+
import { getLangChainEnvVarsMetadata, getLangSmithEnvironmentVariable, getRuntimeEnvironment, } from "./utils/env.js";
|
|
5
5
|
import { __version__ } from "./index.js";
|
|
6
6
|
import { assertUuid } from "./utils/_uuid.js";
|
|
7
7
|
import { warnOnce } from "./utils/warn.js";
|
|
@@ -30,13 +30,13 @@ async function mergeRuntimeEnvIntoRunCreates(runs) {
|
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
const getTracingSamplingRate = () => {
|
|
33
|
-
const samplingRateStr =
|
|
33
|
+
const samplingRateStr = getLangSmithEnvironmentVariable("TRACING_SAMPLING_RATE");
|
|
34
34
|
if (samplingRateStr === undefined) {
|
|
35
35
|
return undefined;
|
|
36
36
|
}
|
|
37
37
|
const samplingRate = parseFloat(samplingRateStr);
|
|
38
38
|
if (samplingRate < 0 || samplingRate > 1) {
|
|
39
|
-
throw new Error(`
|
|
39
|
+
throw new Error(`LANGSMITH_TRACING_SAMPLING_RATE must be between 0 and 1 if set. Got: ${samplingRate}`);
|
|
40
40
|
}
|
|
41
41
|
return samplingRate;
|
|
42
42
|
};
|
|
@@ -269,11 +269,11 @@ export class Client {
|
|
|
269
269
|
this.fetchOptions = config.fetchOptions || {};
|
|
270
270
|
}
|
|
271
271
|
static getDefaultClientConfig() {
|
|
272
|
-
const apiKey =
|
|
273
|
-
const apiUrl =
|
|
272
|
+
const apiKey = getLangSmithEnvironmentVariable("API_KEY");
|
|
273
|
+
const apiUrl = getLangSmithEnvironmentVariable("ENDPOINT") ??
|
|
274
274
|
"https://api.smith.langchain.com";
|
|
275
|
-
const hideInputs =
|
|
276
|
-
const hideOutputs =
|
|
275
|
+
const hideInputs = getLangSmithEnvironmentVariable("HIDE_INPUTS") === "true";
|
|
276
|
+
const hideOutputs = getLangSmithEnvironmentVariable("HIDE_OUTPUTS") === "true";
|
|
277
277
|
return {
|
|
278
278
|
apiUrl: apiUrl,
|
|
279
279
|
apiKey: apiKey,
|
|
@@ -716,7 +716,7 @@ export class Client {
|
|
|
716
716
|
}
|
|
717
717
|
else {
|
|
718
718
|
const project = await this.readProject({
|
|
719
|
-
projectName:
|
|
719
|
+
projectName: getLangSmithEnvironmentVariable("PROJECT") || "default",
|
|
720
720
|
});
|
|
721
721
|
sessionId = project.id;
|
|
722
722
|
}
|
|
@@ -1327,7 +1327,7 @@ export class Client {
|
|
|
1327
1327
|
const result = await response.json();
|
|
1328
1328
|
return result;
|
|
1329
1329
|
}
|
|
1330
|
-
async createDataset(name, { description, dataType, } = {}) {
|
|
1330
|
+
async createDataset(name, { description, dataType, inputsSchema, outputsSchema, } = {}) {
|
|
1331
1331
|
const body = {
|
|
1332
1332
|
name,
|
|
1333
1333
|
description,
|
|
@@ -1335,6 +1335,12 @@ export class Client {
|
|
|
1335
1335
|
if (dataType) {
|
|
1336
1336
|
body.data_type = dataType;
|
|
1337
1337
|
}
|
|
1338
|
+
if (inputsSchema) {
|
|
1339
|
+
body.inputs_schema_definition = inputsSchema;
|
|
1340
|
+
}
|
|
1341
|
+
if (outputsSchema) {
|
|
1342
|
+
body.outputs_schema_definition = outputsSchema;
|
|
1343
|
+
}
|
|
1338
1344
|
const response = await this.caller.call(fetch, `${this.apiUrl}/datasets`, {
|
|
1339
1345
|
method: "POST",
|
|
1340
1346
|
headers: { ...this.headers, "Content-Type": "application/json" },
|
|
@@ -1510,6 +1516,76 @@ export class Client {
|
|
|
1510
1516
|
}
|
|
1511
1517
|
await response.json();
|
|
1512
1518
|
}
|
|
1519
|
+
async indexDataset({ datasetId, datasetName, tag, }) {
|
|
1520
|
+
let datasetId_ = datasetId;
|
|
1521
|
+
if (!datasetId_ && !datasetName) {
|
|
1522
|
+
throw new Error("Must provide either datasetName or datasetId");
|
|
1523
|
+
}
|
|
1524
|
+
else if (datasetId_ && datasetName) {
|
|
1525
|
+
throw new Error("Must provide either datasetName or datasetId, not both");
|
|
1526
|
+
}
|
|
1527
|
+
else if (!datasetId_) {
|
|
1528
|
+
const dataset = await this.readDataset({ datasetName });
|
|
1529
|
+
datasetId_ = dataset.id;
|
|
1530
|
+
}
|
|
1531
|
+
assertUuid(datasetId_);
|
|
1532
|
+
const data = {
|
|
1533
|
+
tag: tag,
|
|
1534
|
+
};
|
|
1535
|
+
const response = await this.caller.call(fetch, `${this.apiUrl}/datasets/${datasetId_}/index`, {
|
|
1536
|
+
method: "POST",
|
|
1537
|
+
headers: { ...this.headers, "Content-Type": "application/json" },
|
|
1538
|
+
body: JSON.stringify(data),
|
|
1539
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1540
|
+
...this.fetchOptions,
|
|
1541
|
+
});
|
|
1542
|
+
if (!response.ok) {
|
|
1543
|
+
throw new Error(`Failed to index dataset ${datasetId_}: ${response.status} ${response.statusText}`);
|
|
1544
|
+
}
|
|
1545
|
+
await response.json();
|
|
1546
|
+
}
|
|
1547
|
+
/**
|
|
1548
|
+
* Lets you run a similarity search query on a dataset.
|
|
1549
|
+
*
|
|
1550
|
+
* Requires the dataset to be indexed. Please see the `indexDataset` method to set up indexing.
|
|
1551
|
+
*
|
|
1552
|
+
* @param inputs The input on which to run the similarity search. Must have the
|
|
1553
|
+
* same schema as the dataset.
|
|
1554
|
+
*
|
|
1555
|
+
* @param datasetId The dataset to search for similar examples.
|
|
1556
|
+
*
|
|
1557
|
+
* @param limit The maximum number of examples to return. Will return the top `limit` most
|
|
1558
|
+
* similar examples in order of most similar to least similar. If no similar
|
|
1559
|
+
* examples are found, random examples will be returned.
|
|
1560
|
+
*
|
|
1561
|
+
* @returns A list of similar examples.
|
|
1562
|
+
*
|
|
1563
|
+
*
|
|
1564
|
+
* @example
|
|
1565
|
+
* dataset_id = "123e4567-e89b-12d3-a456-426614174000"
|
|
1566
|
+
* inputs = {"text": "How many people live in Berlin?"}
|
|
1567
|
+
* limit = 5
|
|
1568
|
+
* examples = await client.similarExamples(inputs, dataset_id, limit)
|
|
1569
|
+
*/
|
|
1570
|
+
async similarExamples(inputs, datasetId, limit) {
|
|
1571
|
+
const data = {
|
|
1572
|
+
limit: limit,
|
|
1573
|
+
inputs: inputs,
|
|
1574
|
+
};
|
|
1575
|
+
assertUuid(datasetId);
|
|
1576
|
+
const response = await this.caller.call(fetch, `${this.apiUrl}/datasets/${datasetId}/search`, {
|
|
1577
|
+
method: "POST",
|
|
1578
|
+
headers: { ...this.headers, "Content-Type": "application/json" },
|
|
1579
|
+
body: JSON.stringify(data),
|
|
1580
|
+
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1581
|
+
...this.fetchOptions,
|
|
1582
|
+
});
|
|
1583
|
+
if (!response.ok) {
|
|
1584
|
+
throw new Error(`Failed to fetch similar examples: ${response.status} ${response.statusText}`);
|
|
1585
|
+
}
|
|
1586
|
+
const result = await response.json();
|
|
1587
|
+
return result["examples"];
|
|
1588
|
+
}
|
|
1513
1589
|
async createExample(inputs, outputs, { datasetId, datasetName, createdAt, exampleId, metadata, split, }) {
|
|
1514
1590
|
let datasetId_ = datasetId;
|
|
1515
1591
|
if (datasetId_ === undefined && datasetName === undefined) {
|
package/dist/env.cjs
CHANGED
|
@@ -6,12 +6,7 @@ const isTracingEnabled = (tracingEnabled) => {
|
|
|
6
6
|
if (tracingEnabled !== undefined) {
|
|
7
7
|
return tracingEnabled;
|
|
8
8
|
}
|
|
9
|
-
const envVars = [
|
|
10
|
-
|
|
11
|
-
"LANGCHAIN_TRACING_V2",
|
|
12
|
-
"LANGSMITH_TRACING",
|
|
13
|
-
"LANGCHAIN_TRACING",
|
|
14
|
-
];
|
|
15
|
-
return !!envVars.find((envVar) => (0, env_js_1.getEnvironmentVariable)(envVar) === "true");
|
|
9
|
+
const envVars = ["TRACING_V2", "TRACING"];
|
|
10
|
+
return !!envVars.find((envVar) => (0, env_js_1.getLangSmithEnvironmentVariable)(envVar) === "true");
|
|
16
11
|
};
|
|
17
12
|
exports.isTracingEnabled = isTracingEnabled;
|
package/dist/env.js
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getLangSmithEnvironmentVariable } from "./utils/env.js";
|
|
2
2
|
export const isTracingEnabled = (tracingEnabled) => {
|
|
3
3
|
if (tracingEnabled !== undefined) {
|
|
4
4
|
return tracingEnabled;
|
|
5
5
|
}
|
|
6
|
-
const envVars = [
|
|
7
|
-
|
|
8
|
-
"LANGCHAIN_TRACING_V2",
|
|
9
|
-
"LANGSMITH_TRACING",
|
|
10
|
-
"LANGCHAIN_TRACING",
|
|
11
|
-
];
|
|
12
|
-
return !!envVars.find((envVar) => getEnvironmentVariable(envVar) === "true");
|
|
6
|
+
const envVars = ["TRACING_V2", "TRACING"];
|
|
7
|
+
return !!envVars.find((envVar) => getLangSmithEnvironmentVariable(envVar) === "true");
|
|
13
8
|
};
|
|
@@ -680,7 +680,7 @@ async function _forward(fn, example, experimentName, metadata, client) {
|
|
|
680
680
|
if (!run) {
|
|
681
681
|
throw new Error(`Run not created by target function.
|
|
682
682
|
This is most likely due to tracing not being enabled.\n
|
|
683
|
-
Try setting "
|
|
683
|
+
Try setting "LANGSMITH_TRACING=true" in your environment.`);
|
|
684
684
|
}
|
|
685
685
|
return {
|
|
686
686
|
run,
|
|
@@ -676,7 +676,7 @@ async function _forward(fn, example, experimentName, metadata, client) {
|
|
|
676
676
|
if (!run) {
|
|
677
677
|
throw new Error(`Run not created by target function.
|
|
678
678
|
This is most likely due to tracing not being enabled.\n
|
|
679
|
-
Try setting "
|
|
679
|
+
Try setting "LANGSMITH_TRACING=true" in your environment.`);
|
|
680
680
|
}
|
|
681
681
|
return {
|
|
682
682
|
run,
|
package/dist/index.cjs
CHANGED
|
@@ -6,4 +6,4 @@ Object.defineProperty(exports, "Client", { enumerable: true, get: function () {
|
|
|
6
6
|
var run_trees_js_1 = require("./run_trees.cjs");
|
|
7
7
|
Object.defineProperty(exports, "RunTree", { enumerable: true, get: function () { return run_trees_js_1.RunTree; } });
|
|
8
8
|
// Update using yarn bump-version
|
|
9
|
-
exports.__version__ = "0.1.
|
|
9
|
+
exports.__version__ = "0.1.43";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { Client } from "./client.js";
|
|
2
2
|
export type { Dataset, Example, TracerSession, Run, Feedback, RetrieverOutput, } from "./schemas.js";
|
|
3
3
|
export { RunTree, type RunTreeConfig } from "./run_trees.js";
|
|
4
|
-
export declare const __version__ = "0.1.
|
|
4
|
+
export declare const __version__ = "0.1.43";
|
package/dist/index.js
CHANGED
package/dist/schemas.d.ts
CHANGED
|
@@ -181,6 +181,9 @@ export interface ExampleUpdate {
|
|
|
181
181
|
export interface ExampleUpdateWithId extends ExampleUpdate {
|
|
182
182
|
id: string;
|
|
183
183
|
}
|
|
184
|
+
export interface ExampleSearch extends BaseExample {
|
|
185
|
+
id: string;
|
|
186
|
+
}
|
|
184
187
|
export interface BaseDataset {
|
|
185
188
|
name: string;
|
|
186
189
|
description: string;
|
package/dist/utils/env.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getShas = exports.setEnvironmentVariable = exports.getEnvironmentVariable = exports.getEnvironmentVariables = exports.getLangChainEnvVarsMetadata = exports.getLangChainEnvVars = exports.getRuntimeEnvironment = exports.getEnv = exports.isNode = exports.isDeno = exports.isJsDom = exports.isWebWorker = exports.isBrowser = void 0;
|
|
3
|
+
exports.getShas = exports.setEnvironmentVariable = exports.getLangSmithEnvironmentVariable = exports.getEnvironmentVariable = exports.getEnvironmentVariables = exports.getLangChainEnvVarsMetadata = exports.getLangChainEnvVars = exports.getRuntimeEnvironment = exports.getEnv = exports.isNode = exports.isDeno = exports.isJsDom = exports.isWebWorker = exports.isBrowser = void 0;
|
|
4
4
|
// Inlined from https://github.com/flexdinesh/browser-or-node
|
|
5
5
|
const index_js_1 = require("../index.cjs");
|
|
6
6
|
let globalEnv;
|
|
@@ -173,6 +173,11 @@ function getEnvironmentVariable(name) {
|
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
exports.getEnvironmentVariable = getEnvironmentVariable;
|
|
176
|
+
function getLangSmithEnvironmentVariable(name) {
|
|
177
|
+
return (getEnvironmentVariable(`LANGSMITH_${name}`) ||
|
|
178
|
+
getEnvironmentVariable(`LANGCHAIN_${name}`));
|
|
179
|
+
}
|
|
180
|
+
exports.getLangSmithEnvironmentVariable = getLangSmithEnvironmentVariable;
|
|
176
181
|
function setEnvironmentVariable(name, value) {
|
|
177
182
|
if (typeof process !== "undefined") {
|
|
178
183
|
// eslint-disable-next-line no-process-env
|
package/dist/utils/env.d.ts
CHANGED
|
@@ -47,6 +47,7 @@ export declare function getLangChainEnvVarsMetadata(): Record<string, string>;
|
|
|
47
47
|
*/
|
|
48
48
|
export declare function getEnvironmentVariables(): Record<string, string> | undefined;
|
|
49
49
|
export declare function getEnvironmentVariable(name: string): string | undefined;
|
|
50
|
+
export declare function getLangSmithEnvironmentVariable(name: string): string | undefined;
|
|
50
51
|
export declare function setEnvironmentVariable(name: string, value: string): void;
|
|
51
52
|
interface ICommitSHAs {
|
|
52
53
|
[key: string]: string;
|
package/dist/utils/env.js
CHANGED
|
@@ -159,6 +159,10 @@ export function getEnvironmentVariable(name) {
|
|
|
159
159
|
return undefined;
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
|
+
export function getLangSmithEnvironmentVariable(name) {
|
|
163
|
+
return (getEnvironmentVariable(`LANGSMITH_${name}`) ||
|
|
164
|
+
getEnvironmentVariable(`LANGCHAIN_${name}`));
|
|
165
|
+
}
|
|
162
166
|
export function setEnvironmentVariable(name, value) {
|
|
163
167
|
if (typeof process !== "undefined") {
|
|
164
168
|
// eslint-disable-next-line no-process-env
|