langsmith 0.8.8 → 0.8.10

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.
Files changed (65) hide show
  1. package/dist/_openapi_client/resources/annotation-queues/annotation-queues.cjs +10 -0
  2. package/dist/_openapi_client/resources/annotation-queues/annotation-queues.d.ts +10 -0
  3. package/dist/_openapi_client/resources/annotation-queues/annotation-queues.js +10 -0
  4. package/dist/_openapi_client/resources/annotation-queues/runs.cjs +13 -1
  5. package/dist/_openapi_client/resources/annotation-queues/runs.d.ts +13 -1
  6. package/dist/_openapi_client/resources/annotation-queues/runs.js +13 -1
  7. package/dist/_openapi_client/resources/datasets/experiment-runs.cjs +2 -0
  8. package/dist/_openapi_client/resources/datasets/experiment-runs.d.ts +2 -0
  9. package/dist/_openapi_client/resources/datasets/experiment-runs.js +2 -0
  10. package/dist/_openapi_client/resources/issues.d.ts +1 -1
  11. package/dist/_openapi_client/resources/public/runs.cjs +9 -7
  12. package/dist/_openapi_client/resources/public/runs.d.ts +8 -6
  13. package/dist/_openapi_client/resources/public/runs.js +9 -7
  14. package/dist/_openapi_client/resources/runs/runs.cjs +11 -6
  15. package/dist/_openapi_client/resources/runs/runs.d.ts +11 -6
  16. package/dist/_openapi_client/resources/runs/runs.js +11 -6
  17. package/dist/_openapi_client/resources/runs/share.cjs +4 -0
  18. package/dist/_openapi_client/resources/runs/share.d.ts +4 -0
  19. package/dist/_openapi_client/resources/runs/share.js +4 -0
  20. package/dist/_openapi_client/resources/threads.cjs +11 -8
  21. package/dist/_openapi_client/resources/threads.d.ts +11 -8
  22. package/dist/_openapi_client/resources/threads.js +11 -8
  23. package/dist/_openapi_client/resources/traces.cjs +6 -3
  24. package/dist/_openapi_client/resources/traces.d.ts +6 -3
  25. package/dist/_openapi_client/resources/traces.js +6 -3
  26. package/dist/client.cjs +295 -24
  27. package/dist/client.d.ts +63 -9
  28. package/dist/client.js +295 -24
  29. package/dist/evaluation/evaluate_comparative.cjs +7 -4
  30. package/dist/evaluation/evaluate_comparative.js +7 -4
  31. package/dist/experimental/vercel/_agent_type.cjs +30 -0
  32. package/dist/experimental/vercel/_agent_type.d.ts +5 -0
  33. package/dist/experimental/vercel/_agent_type.js +26 -0
  34. package/dist/experimental/vercel/telemetry.cjs +2 -7
  35. package/dist/experimental/vercel/telemetry.js +2 -7
  36. package/dist/experimental/vercel/wrap.cjs +5 -11
  37. package/dist/experimental/vercel/wrap.js +6 -12
  38. package/dist/index.cjs +1 -1
  39. package/dist/index.d.ts +1 -1
  40. package/dist/index.js +1 -1
  41. package/dist/sandbox/command_handle.cjs +34 -7
  42. package/dist/sandbox/command_handle.d.ts +1 -0
  43. package/dist/sandbox/command_handle.js +34 -7
  44. package/dist/sandbox/ws_execute.cjs +7 -3
  45. package/dist/sandbox/ws_execute.d.ts +4 -2
  46. package/dist/sandbox/ws_execute.js +7 -3
  47. package/dist/utils/_git.cjs +28 -1
  48. package/dist/utils/_git.js +28 -1
  49. package/dist/utils/ls_agent_type.cjs +31 -0
  50. package/dist/utils/ls_agent_type.d.ts +9 -0
  51. package/dist/utils/ls_agent_type.js +25 -0
  52. package/dist/utils/profiles.cjs +125 -1
  53. package/dist/utils/profiles.d.ts +6 -0
  54. package/dist/utils/profiles.js +124 -1
  55. package/dist/utils/v2_migration.cjs +18 -0
  56. package/dist/utils/v2_migration.d.ts +8 -0
  57. package/dist/utils/v2_migration.js +16 -0
  58. package/dist/utils/warn.cjs +30 -4
  59. package/dist/utils/warn.d.ts +4 -1
  60. package/dist/utils/warn.js +29 -4
  61. package/dist/wrappers/openai.cjs +4 -0
  62. package/dist/wrappers/openai.js +4 -0
  63. package/dist/wrappers/openai_agents.cjs +15 -12
  64. package/dist/wrappers/openai_agents.js +15 -12
  65. package/package.json +1 -1
package/dist/client.d.ts CHANGED
@@ -20,11 +20,11 @@ export interface ClientConfig {
20
20
  timeout_ms?: number;
21
21
  webUrl?: string;
22
22
  /**
23
- * A function applied for masking serialized run inputs and outputs,
24
- * before sending to the API. Can be called with raw inputs, raw
25
- * outputs, or a nested `{ error: string }` object for errors.
23
+ * A function applied for masking serialized run inputs, outputs and
24
+ * metadata, before sending to the API. Can be called with raw inputs, raw
25
+ * outputs, raw metadata, or a nested `{ error: string }` object for errors.
26
26
  *
27
- * If a `hideInputs` or `hideOutputs` function is present,
27
+ * If a `hideInputs`, `hideOutputs` or `hideMetadata` function is present,
28
28
  * the client will call it instead of the anonymizer as appropriate.
29
29
  */
30
30
  anonymizer?: (values: KVMap) => KVMap | Promise<KVMap>;
@@ -413,6 +413,7 @@ export type CreateProjectParams = {
413
413
  numExamples?: number | null;
414
414
  numRepetitions?: number | null;
415
415
  evaluatorKeys?: string[] | null;
416
+ tagValueIds?: string[] | null;
416
417
  };
417
418
  type AutoBatchQueueItem = {
418
419
  action: "create" | "update";
@@ -501,8 +502,11 @@ export declare class Client implements LangSmithTracingClientInterface {
501
502
  private autoBatchAggregationDelayMs;
502
503
  private batchSizeBytesLimit?;
503
504
  private batchSizeLimit?;
505
+ /** `config.fetchOptions` without its `headers`, which are merged separately. */
504
506
  private fetchOptions;
505
- private openAPIClient;
507
+ private _fetchOptionsHeaders;
508
+ private _openAPIClient?;
509
+ private _openAPIClientSignature?;
506
510
  private settings;
507
511
  private blockOnRootRunFinalization;
508
512
  private traceBatchConcurrency;
@@ -555,7 +559,33 @@ export declare class Client implements LangSmithTracingClientInterface {
555
559
  constructor(config?: ClientConfig);
556
560
  static getDefaultClientConfig(): DefaultClientConfig;
557
561
  getHostUrl(): string;
562
+ /**
563
+ * The headers this client sets from its own config, which a caller-supplied
564
+ * header must not replace.
565
+ *
566
+ * Only what the client *actually* supplies: passing an explicit `Authorization`
567
+ * or `x-api-key` header with no configured credential is a supported way to
568
+ * authenticate (see `hasExplicitAuthHeader`), so those must survive.
569
+ */
570
+ private get _sdkControlledHeaders();
571
+ /**
572
+ * Headers supplied by the caller, through either `config.headers` or
573
+ * `config.fetchOptions.headers`, with the ones this SDK sets removed.
574
+ *
575
+ * `_customHeaders` is normalized here rather than at assignment because it is
576
+ * public and mutable: `get headers` hands back the caller's own object, so its
577
+ * contents can change (and can become malformed) at any point.
578
+ */
579
+ private get _callerHeaders();
558
580
  private get _mergedHeaders();
581
+ /**
582
+ * The auth options and caller headers to build the generated client with.
583
+ *
584
+ * The generated client applies `defaultHeaders` *after* its own auth headers,
585
+ * so the ones this SDK sets are already dropped from `_callerHeaders` to keep
586
+ * the precedence of `_mergedHeaders`, where required headers win.
587
+ */
588
+ private get _openAPIAuth();
559
589
  /**
560
590
  * Get or set custom headers for the client.
561
591
  * Custom headers are merged with default headers (User-Agent, x-api-key, x-tenant-id).
@@ -564,6 +594,17 @@ export declare class Client implements LangSmithTracingClientInterface {
564
594
  get headers(): Record<string, string>;
565
595
  set headers(value: Record<string, string> | undefined);
566
596
  private _getOpenAPIBaseUrl;
597
+ /**
598
+ * The generated OpenAPI client, rebuilt whenever its auth or headers change.
599
+ *
600
+ * The generated client captures `defaultHeaders` and `apiKey` when it is
601
+ * built, while the handwritten paths recompute `_mergedHeaders` per request.
602
+ * Rebuilding on change keeps the two halves from diverging when the inputs
603
+ * move underneath us — a caller mutating the object returned by
604
+ * `get headers`, or a profile whose auth header only becomes available after
605
+ * its token is refreshed.
606
+ */
607
+ private get openAPIClient();
567
608
  private _newOpenAPIClient;
568
609
  private _getPlatformEndpointPath;
569
610
  get evaluators(): Evaluators;
@@ -630,6 +671,8 @@ export declare class Client implements LangSmithTracingClientInterface {
630
671
  private static _writeTraceToFallbackDir;
631
672
  private _processBatch;
632
673
  private _sendBatchToOTELTranslator;
674
+ private _maskRunMetadata;
675
+ private _mergeRuntimeEnvAndMaskMetadata;
633
676
  private processRunOperation;
634
677
  protected _getServerInfo(): Promise<any>;
635
678
  private _checkStainlessVersion;
@@ -687,9 +730,11 @@ export declare class Client implements LangSmithTracingClientInterface {
687
730
  apiUrl?: string;
688
731
  workspaceId?: string;
689
732
  }): Promise<void>;
733
+ /** @deprecated Use `client.runs.retrieve()` instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration#runs-retrieve for the migration guide. Will be removed after Jan 31, 2027. */
690
734
  readRun(runId: string, { loadChildRuns }?: {
691
735
  loadChildRuns: boolean;
692
736
  }): Promise<Run>;
737
+ /** @deprecated Use `client.runs.getURL()` instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration#runs-get-url for the migration guide. Will be removed after Jan 31, 2027. */
693
738
  getRunUrl({ runId, run, projectOpts, }: {
694
739
  runId?: string;
695
740
  run?: Run;
@@ -698,6 +743,7 @@ export declare class Client implements LangSmithTracingClientInterface {
698
743
  private _loadChildRuns;
699
744
  /**
700
745
  * List runs from the LangSmith server.
746
+ * @deprecated Use `client.runs.query()` instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration#runs-query for the migration guide. Will be removed after Jan 31, 2027.
701
747
  * @param projectId - The ID of the project to filter by.
702
748
  * @param projectName - The name of the project to filter by.
703
749
  * @param parentRunId - The ID of the parent run to filter by.
@@ -780,7 +826,9 @@ export declare class Client implements LangSmithTracingClientInterface {
780
826
  */
781
827
  listRuns(props: ListRunsParams): AsyncIterable<Run>;
782
828
  listGroupRuns(props: GroupRunsParams): AsyncIterable<Thread>;
829
+ /** @deprecated Use `client.threads.listTraces()` instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration#threads-list-traces for the migration guide. Will be removed after Jan 31, 2027. */
783
830
  readThread(props: ReadThreadParams): AsyncIterable<Run>;
831
+ /** @deprecated Use `client.threads.query()` instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration#threads-query for the migration guide. Will be removed after Jan 31, 2027. */
784
832
  listThreads(props: ListThreadsParams): Promise<ListThreadsItem[]>;
785
833
  getRunStats({ id, trace, parentRun, runType, projectNames, projectIds, referenceExampleIds, startTime, endTime, error, query, filter, traceFilter, treeFilter, isRoot, dataSourceType, }: {
786
834
  id?: string[];
@@ -800,11 +848,15 @@ export declare class Client implements LangSmithTracingClientInterface {
800
848
  isRoot?: boolean;
801
849
  dataSourceType?: string;
802
850
  }): Promise<any>;
851
+ /** @deprecated Use `client.runs.share.create()` instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration#share-and-read-public-runs for the migration guide. Will be removed after Jan 31, 2027. */
803
852
  shareRun(runId: string, { shareId }?: {
804
853
  shareId?: string;
805
854
  }): Promise<string>;
855
+ /** @deprecated Use `client.runs.share.delete()` instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration#share-and-read-public-runs for the migration guide. Will be removed after Jan 31, 2027. */
806
856
  unshareRun(runId: string): Promise<void>;
857
+ /** @deprecated Use `client.runs.retrieve({ selects: ["SHARE_URL"] })` instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration#share-and-read-public-runs for the migration guide. Will be removed after Jan 31, 2027. */
807
858
  readRunSharedLink(runId: string): Promise<string | undefined>;
859
+ /** @deprecated Use `client.public.runs.query()` instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration#share-and-read-public-runs for the migration guide. Will be removed after Jan 31, 2027. */
808
860
  listSharedRuns(shareToken: string, { runIds, }?: {
809
861
  runIds?: string[];
810
862
  }): Promise<Run[]>;
@@ -823,7 +875,7 @@ export declare class Client implements LangSmithTracingClientInterface {
823
875
  listSharedExamples(shareToken: string, options?: {
824
876
  exampleIds?: string[];
825
877
  }): Promise<Example[]>;
826
- createProject({ projectName, description, metadata, upsert, projectExtra, referenceDatasetId, numExamples, numRepetitions, evaluatorKeys, }: CreateProjectParams): Promise<TracerSession>;
878
+ createProject({ projectName, description, metadata, upsert, projectExtra, referenceDatasetId, numExamples, numRepetitions, evaluatorKeys, tagValueIds, }: CreateProjectParams): Promise<TracerSession>;
827
879
  updateProject(projectId: string, { name, description, metadata, projectExtra, endTime, }: {
828
880
  name?: string | null;
829
881
  description?: string | null;
@@ -865,12 +917,13 @@ export declare class Client implements LangSmithTracingClientInterface {
865
917
  projectName?: string;
866
918
  }): Promise<void>;
867
919
  uploadCsv({ csvFile, fileName, inputKeys, outputKeys, description, dataType, name, }: UploadCSVParams): Promise<Dataset>;
868
- createDataset(name: string, { description, dataType, inputsSchema, outputsSchema, metadata, }?: {
920
+ createDataset(name: string, { description, dataType, inputsSchema, outputsSchema, metadata, tagValueIds, }?: {
869
921
  description?: string;
870
922
  dataType?: DataType;
871
923
  inputsSchema?: KVMap;
872
924
  outputsSchema?: KVMap;
873
925
  metadata?: RecordStringAny;
926
+ tagValueIds?: string[];
874
927
  }): Promise<Dataset>;
875
928
  readDataset({ datasetId, datasetName, }: {
876
929
  datasetId?: string;
@@ -1196,8 +1249,9 @@ export declare class Client implements LangSmithTracingClientInterface {
1196
1249
  * - `RunKey[]` (preferred): each entry carries the run's full lookup key, so
1197
1250
  * it can be located directly without a scan. Required for workspaces served
1198
1251
  * by SmithDB; routes to `POST /runs/by-key`.
1199
- * - `string[]`: a plain list of run IDs. This path will be deprecated in a
1200
- * future release; prefer the key form. Routes to `POST /runs`.
1252
+ * - `string[]`: a plain list of run IDs. **Deprecated**: this path will be
1253
+ * removed after Jan 31, 2027; prefer the key form. Routes to `POST /runs`.
1254
+ * See https://docs.langchain.com/langsmith/smithdb-sdk-migration#annotation-queues-add-runs.
1201
1255
  *
1202
1256
  * If every element is a string (or the list is empty) it is treated as run
1203
1257
  * IDs; otherwise the list is treated as `RunKey` objects.