langsmith 0.1.50 → 0.1.52

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 CHANGED
@@ -1597,6 +1597,13 @@ class Client {
1597
1597
  * similar examples in order of most similar to least similar. If no similar
1598
1598
  * examples are found, random examples will be returned.
1599
1599
  *
1600
+ * @param filter A filter string to apply to the search. Only examples will be returned that
1601
+ * match the filter string. Some examples of filters
1602
+ *
1603
+ * - eq(metadata.mykey, "value")
1604
+ * - and(neq(metadata.my.nested.key, "value"), neq(metadata.mykey, "value"))
1605
+ * - or(eq(metadata.mykey, "value"), eq(metadata.mykey, "othervalue"))
1606
+ *
1600
1607
  * @returns A list of similar examples.
1601
1608
  *
1602
1609
  *
@@ -1606,11 +1613,14 @@ class Client {
1606
1613
  * limit = 5
1607
1614
  * examples = await client.similarExamples(inputs, dataset_id, limit)
1608
1615
  */
1609
- async similarExamples(inputs, datasetId, limit) {
1616
+ async similarExamples(inputs, datasetId, limit, { filter, } = {}) {
1610
1617
  const data = {
1611
1618
  limit: limit,
1612
1619
  inputs: inputs,
1613
1620
  };
1621
+ if (filter !== undefined) {
1622
+ data["filter"] = filter;
1623
+ }
1614
1624
  (0, _uuid_js_1.assertUuid)(datasetId);
1615
1625
  const response = await this.caller.call(fetch, `${this.apiUrl}/datasets/${datasetId}/search`, {
1616
1626
  method: "POST",
@@ -1623,7 +1633,7 @@ class Client {
1623
1633
  const result = await response.json();
1624
1634
  return result["examples"];
1625
1635
  }
1626
- async createExample(inputs, outputs, { datasetId, datasetName, createdAt, exampleId, metadata, split, }) {
1636
+ async createExample(inputs, outputs, { datasetId, datasetName, createdAt, exampleId, metadata, split, sourceRunId, }) {
1627
1637
  let datasetId_ = datasetId;
1628
1638
  if (datasetId_ === undefined && datasetName === undefined) {
1629
1639
  throw new Error("Must provide either datasetName or datasetId");
@@ -1644,6 +1654,7 @@ class Client {
1644
1654
  id: exampleId,
1645
1655
  metadata,
1646
1656
  split,
1657
+ source_run_id: sourceRunId,
1647
1658
  };
1648
1659
  const response = await this.caller.call(fetch, `${this.apiUrl}/examples`, {
1649
1660
  method: "POST",
package/dist/client.d.ts CHANGED
@@ -141,12 +141,20 @@ interface ProjectOptions {
141
141
  type RecordStringAny = Record<string, any>;
142
142
  export type FeedbackSourceType = "model" | "api" | "app";
143
143
  export type CreateExampleOptions = {
144
+ /** The ID of the dataset to create the example in. */
144
145
  datasetId?: string;
146
+ /** The name of the dataset to create the example in (if dataset ID is not provided). */
145
147
  datasetName?: string;
148
+ /** The creation date of the example. */
146
149
  createdAt?: Date;
150
+ /** A unique identifier for the example. */
147
151
  exampleId?: string;
152
+ /** Additional metadata associated with the example. */
148
153
  metadata?: KVMap;
154
+ /** The split(s) to assign the example to. */
149
155
  split?: string | string[];
156
+ /** The ID of the source run associated with this example. */
157
+ sourceRunId?: string;
150
158
  };
151
159
  export declare class Queue<T> {
152
160
  items: [T, () => void][];
@@ -457,6 +465,13 @@ export declare class Client {
457
465
  * similar examples in order of most similar to least similar. If no similar
458
466
  * examples are found, random examples will be returned.
459
467
  *
468
+ * @param filter A filter string to apply to the search. Only examples will be returned that
469
+ * match the filter string. Some examples of filters
470
+ *
471
+ * - eq(metadata.mykey, "value")
472
+ * - and(neq(metadata.my.nested.key, "value"), neq(metadata.mykey, "value"))
473
+ * - or(eq(metadata.mykey, "value"), eq(metadata.mykey, "othervalue"))
474
+ *
460
475
  * @returns A list of similar examples.
461
476
  *
462
477
  *
@@ -466,8 +481,10 @@ export declare class Client {
466
481
  * limit = 5
467
482
  * examples = await client.similarExamples(inputs, dataset_id, limit)
468
483
  */
469
- similarExamples(inputs: KVMap, datasetId: string, limit: number): Promise<ExampleSearch[]>;
470
- createExample(inputs: KVMap, outputs: KVMap, { datasetId, datasetName, createdAt, exampleId, metadata, split, }: CreateExampleOptions): Promise<Example>;
484
+ similarExamples(inputs: KVMap, datasetId: string, limit: number, { filter, }?: {
485
+ filter?: string;
486
+ }): Promise<ExampleSearch[]>;
487
+ createExample(inputs: KVMap, outputs: KVMap, { datasetId, datasetName, createdAt, exampleId, metadata, split, sourceRunId, }: CreateExampleOptions): Promise<Example>;
471
488
  createExamples(props: {
472
489
  inputs: Array<KVMap>;
473
490
  outputs?: Array<KVMap>;
package/dist/client.js CHANGED
@@ -1570,6 +1570,13 @@ export class Client {
1570
1570
  * similar examples in order of most similar to least similar. If no similar
1571
1571
  * examples are found, random examples will be returned.
1572
1572
  *
1573
+ * @param filter A filter string to apply to the search. Only examples will be returned that
1574
+ * match the filter string. Some examples of filters
1575
+ *
1576
+ * - eq(metadata.mykey, "value")
1577
+ * - and(neq(metadata.my.nested.key, "value"), neq(metadata.mykey, "value"))
1578
+ * - or(eq(metadata.mykey, "value"), eq(metadata.mykey, "othervalue"))
1579
+ *
1573
1580
  * @returns A list of similar examples.
1574
1581
  *
1575
1582
  *
@@ -1579,11 +1586,14 @@ export class Client {
1579
1586
  * limit = 5
1580
1587
  * examples = await client.similarExamples(inputs, dataset_id, limit)
1581
1588
  */
1582
- async similarExamples(inputs, datasetId, limit) {
1589
+ async similarExamples(inputs, datasetId, limit, { filter, } = {}) {
1583
1590
  const data = {
1584
1591
  limit: limit,
1585
1592
  inputs: inputs,
1586
1593
  };
1594
+ if (filter !== undefined) {
1595
+ data["filter"] = filter;
1596
+ }
1587
1597
  assertUuid(datasetId);
1588
1598
  const response = await this.caller.call(fetch, `${this.apiUrl}/datasets/${datasetId}/search`, {
1589
1599
  method: "POST",
@@ -1596,7 +1606,7 @@ export class Client {
1596
1606
  const result = await response.json();
1597
1607
  return result["examples"];
1598
1608
  }
1599
- async createExample(inputs, outputs, { datasetId, datasetName, createdAt, exampleId, metadata, split, }) {
1609
+ async createExample(inputs, outputs, { datasetId, datasetName, createdAt, exampleId, metadata, split, sourceRunId, }) {
1600
1610
  let datasetId_ = datasetId;
1601
1611
  if (datasetId_ === undefined && datasetName === undefined) {
1602
1612
  throw new Error("Must provide either datasetName or datasetId");
@@ -1617,6 +1627,7 @@ export class Client {
1617
1627
  id: exampleId,
1618
1628
  metadata,
1619
1629
  split,
1630
+ source_run_id: sourceRunId,
1620
1631
  };
1621
1632
  const response = await this.caller.call(fetch, `${this.apiUrl}/examples`, {
1622
1633
  method: "POST",
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.50";
9
+ exports.__version__ = "0.1.52";
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export { Client, type ClientConfig } 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.50";
4
+ export declare const __version__ = "0.1.52";
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  export { Client } from "./client.js";
2
2
  export { RunTree } from "./run_trees.js";
3
3
  // Update using yarn bump-version
4
- export const __version__ = "0.1.50";
4
+ export const __version__ = "0.1.52";
package/dist/schemas.d.ts CHANGED
@@ -30,6 +30,7 @@ export interface BaseExample {
30
30
  inputs: KVMap;
31
31
  outputs?: KVMap;
32
32
  metadata?: KVMap;
33
+ source_run_id?: string;
33
34
  }
34
35
  /**
35
36
  * A run can represent either a trace (root run)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langsmith",
3
- "version": "0.1.50",
3
+ "version": "0.1.52",
4
4
  "description": "Client library to connect to the LangSmith LLM Tracing and Evaluation Platform.",
5
5
  "packageManager": "yarn@1.22.19",
6
6
  "files": [