langwatch 2.1.0 → 2.2.0

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 (32) hide show
  1. package/dist/agent/index.js +1 -1
  2. package/dist/agent/index.js.map +1 -1
  3. package/dist/agent/index.mjs +1 -1
  4. package/dist/agent/index.mjs.map +1 -1
  5. package/dist/{chunk-UHM5RXEW.mjs → chunk-OAAGWSLX.mjs} +2 -2
  6. package/dist/{chunk-XVXTLQGK.mjs → chunk-P65KWWFU.mjs} +2 -2
  7. package/dist/{chunk-XVXTLQGK.mjs.map → chunk-P65KWWFU.mjs.map} +1 -1
  8. package/dist/{chunk-4HRQZXNE.js → chunk-PDTYQM5C.js} +2 -2
  9. package/dist/{chunk-4HRQZXNE.js.map → chunk-PDTYQM5C.js.map} +1 -1
  10. package/dist/{chunk-VJK42Y3W.js → chunk-TQJS5H5P.js} +12 -12
  11. package/dist/{chunk-VJK42Y3W.js.map → chunk-TQJS5H5P.js.map} +1 -1
  12. package/dist/cli/bundle.js +941 -437
  13. package/dist/{implementation-CNNrmXZu.d.mts → implementation-CMJfitMa.d.mts} +1 -1
  14. package/dist/{implementation-Atjtldz3.d.ts → implementation-CaKFOMnp.d.ts} +1 -1
  15. package/dist/index.d.mts +67 -5
  16. package/dist/index.d.ts +67 -5
  17. package/dist/index.js +135 -41
  18. package/dist/index.js.map +1 -1
  19. package/dist/index.mjs +105 -11
  20. package/dist/index.mjs.map +1 -1
  21. package/dist/observability-sdk/index.d.mts +3 -3
  22. package/dist/observability-sdk/index.d.ts +3 -3
  23. package/dist/observability-sdk/index.js +2 -2
  24. package/dist/observability-sdk/index.mjs +1 -1
  25. package/dist/observability-sdk/instrumentation/langchain/index.d.mts +1 -1
  26. package/dist/observability-sdk/instrumentation/langchain/index.d.ts +1 -1
  27. package/dist/observability-sdk/setup/node/index.js +3 -3
  28. package/dist/observability-sdk/setup/node/index.mjs +2 -2
  29. package/dist/{types--djDPuMb.d.ts → types-0leNdzy4.d.ts} +554 -11
  30. package/dist/{types-GklcWLfF.d.mts → types-DNjiOkpS.d.mts} +554 -11
  31. package/package.json +1 -1
  32. /package/dist/{chunk-UHM5RXEW.mjs.map → chunk-OAAGWSLX.mjs.map} +0 -0
@@ -6,7 +6,7 @@ import { Logger, LogRecord, LoggerProvider } from '@opentelemetry/api-logs';
6
6
  import { V as VAL_GEN_AI_SYSTEMS, a as VAL_GEN_AI_FINISH_REASONS } from './values-1yj9l0Sa.mjs';
7
7
  import { b as SemConvLogRecordAttributes, a as SemConvAttributes } from './types-CoS5PmeU.mjs';
8
8
  import { TracerProvider } from '@opentelemetry/api';
9
- import { j as LangWatchTracer } from './types-GklcWLfF.mjs';
9
+ import { j as LangWatchTracer } from './types-DNjiOkpS.mjs';
10
10
 
11
11
  /**
12
12
  * A BatchSpanProcessor subclass that filters spans before export by
@@ -6,7 +6,7 @@ import { Logger, LogRecord, LoggerProvider } from '@opentelemetry/api-logs';
6
6
  import { V as VAL_GEN_AI_SYSTEMS, a as VAL_GEN_AI_FINISH_REASONS } from './values-1yj9l0Sa.js';
7
7
  import { b as SemConvLogRecordAttributes, a as SemConvAttributes } from './types-CoS5PmeU.js';
8
8
  import { TracerProvider } from '@opentelemetry/api';
9
- import { j as LangWatchTracer } from './types--djDPuMb.js';
9
+ import { j as LangWatchTracer } from './types-0leNdzy4.js';
10
10
 
11
11
  /**
12
12
  * A BatchSpanProcessor subclass that filters spans before export by
package/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { L as Logger, C as ConsoleLogger, N as NoOpLogger } from './index-D7rKIGrO.mjs';
2
- export { F as FilterableBatchSpanProcessor, L as LangWatchExporter, S as SpanProcessingExcludeRule, g as getLangWatchLogger, a as getLangWatchTracer } from './implementation-CNNrmXZu.mjs';
2
+ export { F as FilterableBatchSpanProcessor, L as LangWatchExporter, S as SpanProcessingExcludeRule, g as getLangWatchLogger, a as getLangWatchTracer } from './implementation-CMJfitMa.mjs';
3
3
  import { z } from 'zod';
4
4
  import openApiCreateClient from 'openapi-fetch';
5
- import { p as paths, P as PromptResponse, C as CreatePromptBody, U as UpdatePromptBody, T as TagDefinition, a as CreatedTag, o as operations, b as PromptData, F as FetchPolicy, c as Prompt, L as LangWatchSpan, d as components } from './types-GklcWLfF.mjs';
5
+ import { p as paths, P as PromptResponse, C as CreatePromptBody, U as UpdatePromptBody, T as TagDefinition, a as CreatedTag, o as operations, b as PromptData, F as FetchPolicy, c as Prompt, L as LangWatchSpan, d as components } from './types-DNjiOkpS.mjs';
6
6
  export { l as attributes } from './types-CoS5PmeU.mjs';
7
7
  import { LangWatchHandledErrorReason, LangWatchHandledErrorShape } from '@langwatch/handled-error/langwatch-handled-error';
8
8
  export { LangWatchHandledErrorReason, LangWatchHandledErrorShape } from '@langwatch/handled-error/langwatch-handled-error';
@@ -1183,6 +1183,11 @@ type RunExperimentOptions = {
1183
1183
  * Callback for progress updates
1184
1184
  */
1185
1185
  onProgress?: (progress: number, total: number) => void;
1186
+ /**
1187
+ * Version of the experiment's saved dataset to run. Overrides the version the
1188
+ * experiment pins; without either, the run saves and reads the current content.
1189
+ */
1190
+ datasetVersion?: number;
1186
1191
  };
1187
1192
  /**
1188
1193
  * Inputs that override a platform experiment or workflow run on the server.
@@ -1498,6 +1503,15 @@ type EvaluatorField = EvaluatorResponse["fields"][number];
1498
1503
  type CreateEvaluatorBody = NonNullable<paths["/api/v1/evaluators"]["post"]["requestBody"]>["content"]["application/json"];
1499
1504
  type UpdateEvaluatorBody = NonNullable<paths["/api/v1/evaluators/{id}"]["put"]["requestBody"]>["content"]["application/json"];
1500
1505
  type DeleteEvaluatorResponse = paths["/api/v1/evaluators/{id}"]["delete"]["responses"]["200"]["content"]["application/json"];
1506
+ /** Which version of an evaluator to read: a deploy label such as `production`, or a number. */
1507
+ type EvaluatorVersionSelector = {
1508
+ label?: string;
1509
+ version?: number;
1510
+ };
1511
+ /** An evaluator's versions, newest first, and where each deploy label points. */
1512
+ type EvaluatorVersionsResponse = paths["/api/v1/evaluators/{evaluatorId}/versions"]["get"]["responses"]["200"]["content"]["application/json"];
1513
+ /** A deploy label after it was moved. */
1514
+ type EvaluatorLabelResponse = paths["/api/v1/evaluators/{evaluatorId}/labels/{label}"]["put"]["responses"]["200"]["content"]["application/json"];
1501
1515
 
1502
1516
  /**
1503
1517
  * Service for retrieving evaluator resources via the LangWatch API.
@@ -1513,9 +1527,10 @@ declare class EvaluatorsApiService {
1513
1527
  */
1514
1528
  getAll(): Promise<EvaluatorResponse[]>;
1515
1529
  /**
1516
- * Fetches a single evaluator by its ID or slug.
1530
+ * Fetches a single evaluator by its ID or slug, at the latest version unless a `label` or a
1531
+ * `version` is asked for. The slug also takes a suffix: `toxicity:production` or `toxicity:2`.
1517
1532
  */
1518
- get(idOrSlug: string): Promise<EvaluatorResponse>;
1533
+ get(idOrSlug: string, selector?: EvaluatorVersionSelector): Promise<EvaluatorResponse>;
1519
1534
  /**
1520
1535
  * Creates a new evaluator.
1521
1536
  */
@@ -1528,6 +1543,15 @@ declare class EvaluatorsApiService {
1528
1543
  * Deletes (archives) an evaluator by its ID.
1529
1544
  */
1530
1545
  delete(id: string): Promise<DeleteEvaluatorResponse>;
1546
+ /** Every version of the evaluator, newest first, with the labels on each. */
1547
+ listVersions(id: string): Promise<EvaluatorVersionsResponse>;
1548
+ /** Points a deploy label, such as `production`, at one of the evaluator's versions. */
1549
+ assignLabel(id: string, label: string, version: number): Promise<EvaluatorLabelResponse>;
1550
+ /** Removes a deploy label from the evaluator. */
1551
+ removeLabel(id: string, label: string): Promise<{
1552
+ label: string;
1553
+ removed: true;
1554
+ }>;
1531
1555
  }
1532
1556
 
1533
1557
  declare class EvaluatorsApiError extends Error {
@@ -1833,7 +1857,31 @@ interface AgentResponse {
1833
1857
  /** Why the agent cannot be run with this key; null when it can. */
1834
1858
  notSelectableReason?: "owned_by_another_person" | null;
1835
1859
  parameters?: AgentParameterSpec[];
1860
+ /** The version this read shows: the latest unless a label or a version was asked for. */
1861
+ version?: number | null;
1862
+ /** The deploy labels and the version each one points at. */
1863
+ labels?: {
1864
+ label: string;
1865
+ version: number;
1866
+ }[];
1867
+ createdBy?: {
1868
+ id: string;
1869
+ name: string | null;
1870
+ } | null;
1871
+ updatedBy?: {
1872
+ id: string;
1873
+ name: string | null;
1874
+ } | null;
1836
1875
  }
1876
+ /** Which version of an agent to read: a deploy label such as `production`, or a number. */
1877
+ type AgentVersionSelector = {
1878
+ label?: string;
1879
+ version?: number;
1880
+ };
1881
+ /** An agent's versions, newest first, and where each deploy label points. */
1882
+ type AgentVersionsResponse = paths["/api/v1/agents/{agentId}/versions"]["get"]["responses"][200]["content"]["application/json"];
1883
+ /** A deploy label after it was moved. */
1884
+ type AgentLabelResponse = paths["/api/v1/agents/{agentId}/labels/{label}"]["put"]["responses"][200]["content"]["application/json"];
1837
1885
  interface AgentListResponse {
1838
1886
  data: AgentResponse[];
1839
1887
  pagination: {
@@ -1857,17 +1905,22 @@ declare class AgentsApiService {
1857
1905
  page?: number;
1858
1906
  limit?: number;
1859
1907
  }): Promise<AgentListResponse>;
1860
- get(id: string): Promise<AgentResponse>;
1908
+ /** Reads the latest version unless a `label` or a `version` is asked for. */
1909
+ get(id: string, selector?: AgentVersionSelector): Promise<AgentResponse>;
1861
1910
  create(params: {
1862
1911
  name: string;
1863
1912
  type: string;
1864
1913
  config: Record<string, unknown>;
1865
1914
  workflowId?: string;
1915
+ /** Recorded on version 1. */
1916
+ commitMessage?: string;
1866
1917
  }): Promise<AgentResponse>;
1867
1918
  update(id: string, params: {
1868
1919
  name?: string;
1869
1920
  type?: string;
1870
1921
  config?: Record<string, unknown>;
1922
+ /** Recorded on the version this update appends. */
1923
+ commitMessage?: string;
1871
1924
  }): Promise<AgentResponse>;
1872
1925
  delete(id: string): Promise<{
1873
1926
  id: string;
@@ -1884,6 +1937,15 @@ declare class AgentsApiService {
1884
1937
  * test suite, and the answer carries the run ids to follow.
1885
1938
  */
1886
1939
  test(id: string): Promise<AgentTestRunResponse>;
1940
+ /** Every version of the agent, newest first, with the labels on each. */
1941
+ listVersions(id: string): Promise<AgentVersionsResponse>;
1942
+ /** Points a deploy label, such as `production`, at one of the agent's versions. */
1943
+ assignLabel(id: string, label: string, version: number): Promise<AgentLabelResponse>;
1944
+ /** Removes a deploy label from the agent. */
1945
+ removeLabel(id: string, label: string): Promise<{
1946
+ label: string;
1947
+ removed: true;
1948
+ }>;
1887
1949
  }
1888
1950
 
1889
1951
  type AnnotationResponse = components["schemas"]["Annotation"];
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { L as Logger, C as ConsoleLogger, N as NoOpLogger } from './index-D7rKIGrO.js';
2
- export { F as FilterableBatchSpanProcessor, L as LangWatchExporter, S as SpanProcessingExcludeRule, g as getLangWatchLogger, a as getLangWatchTracer } from './implementation-Atjtldz3.js';
2
+ export { F as FilterableBatchSpanProcessor, L as LangWatchExporter, S as SpanProcessingExcludeRule, g as getLangWatchLogger, a as getLangWatchTracer } from './implementation-CaKFOMnp.js';
3
3
  import { z } from 'zod';
4
4
  import openApiCreateClient from 'openapi-fetch';
5
- import { p as paths, P as PromptResponse, C as CreatePromptBody, U as UpdatePromptBody, T as TagDefinition, a as CreatedTag, o as operations, b as PromptData, F as FetchPolicy, c as Prompt, L as LangWatchSpan, d as components } from './types--djDPuMb.js';
5
+ import { p as paths, P as PromptResponse, C as CreatePromptBody, U as UpdatePromptBody, T as TagDefinition, a as CreatedTag, o as operations, b as PromptData, F as FetchPolicy, c as Prompt, L as LangWatchSpan, d as components } from './types-0leNdzy4.js';
6
6
  export { l as attributes } from './types-CoS5PmeU.js';
7
7
  import { LangWatchHandledErrorReason, LangWatchHandledErrorShape } from '@langwatch/handled-error/langwatch-handled-error';
8
8
  export { LangWatchHandledErrorReason, LangWatchHandledErrorShape } from '@langwatch/handled-error/langwatch-handled-error';
@@ -1183,6 +1183,11 @@ type RunExperimentOptions = {
1183
1183
  * Callback for progress updates
1184
1184
  */
1185
1185
  onProgress?: (progress: number, total: number) => void;
1186
+ /**
1187
+ * Version of the experiment's saved dataset to run. Overrides the version the
1188
+ * experiment pins; without either, the run saves and reads the current content.
1189
+ */
1190
+ datasetVersion?: number;
1186
1191
  };
1187
1192
  /**
1188
1193
  * Inputs that override a platform experiment or workflow run on the server.
@@ -1498,6 +1503,15 @@ type EvaluatorField = EvaluatorResponse["fields"][number];
1498
1503
  type CreateEvaluatorBody = NonNullable<paths["/api/v1/evaluators"]["post"]["requestBody"]>["content"]["application/json"];
1499
1504
  type UpdateEvaluatorBody = NonNullable<paths["/api/v1/evaluators/{id}"]["put"]["requestBody"]>["content"]["application/json"];
1500
1505
  type DeleteEvaluatorResponse = paths["/api/v1/evaluators/{id}"]["delete"]["responses"]["200"]["content"]["application/json"];
1506
+ /** Which version of an evaluator to read: a deploy label such as `production`, or a number. */
1507
+ type EvaluatorVersionSelector = {
1508
+ label?: string;
1509
+ version?: number;
1510
+ };
1511
+ /** An evaluator's versions, newest first, and where each deploy label points. */
1512
+ type EvaluatorVersionsResponse = paths["/api/v1/evaluators/{evaluatorId}/versions"]["get"]["responses"]["200"]["content"]["application/json"];
1513
+ /** A deploy label after it was moved. */
1514
+ type EvaluatorLabelResponse = paths["/api/v1/evaluators/{evaluatorId}/labels/{label}"]["put"]["responses"]["200"]["content"]["application/json"];
1501
1515
 
1502
1516
  /**
1503
1517
  * Service for retrieving evaluator resources via the LangWatch API.
@@ -1513,9 +1527,10 @@ declare class EvaluatorsApiService {
1513
1527
  */
1514
1528
  getAll(): Promise<EvaluatorResponse[]>;
1515
1529
  /**
1516
- * Fetches a single evaluator by its ID or slug.
1530
+ * Fetches a single evaluator by its ID or slug, at the latest version unless a `label` or a
1531
+ * `version` is asked for. The slug also takes a suffix: `toxicity:production` or `toxicity:2`.
1517
1532
  */
1518
- get(idOrSlug: string): Promise<EvaluatorResponse>;
1533
+ get(idOrSlug: string, selector?: EvaluatorVersionSelector): Promise<EvaluatorResponse>;
1519
1534
  /**
1520
1535
  * Creates a new evaluator.
1521
1536
  */
@@ -1528,6 +1543,15 @@ declare class EvaluatorsApiService {
1528
1543
  * Deletes (archives) an evaluator by its ID.
1529
1544
  */
1530
1545
  delete(id: string): Promise<DeleteEvaluatorResponse>;
1546
+ /** Every version of the evaluator, newest first, with the labels on each. */
1547
+ listVersions(id: string): Promise<EvaluatorVersionsResponse>;
1548
+ /** Points a deploy label, such as `production`, at one of the evaluator's versions. */
1549
+ assignLabel(id: string, label: string, version: number): Promise<EvaluatorLabelResponse>;
1550
+ /** Removes a deploy label from the evaluator. */
1551
+ removeLabel(id: string, label: string): Promise<{
1552
+ label: string;
1553
+ removed: true;
1554
+ }>;
1531
1555
  }
1532
1556
 
1533
1557
  declare class EvaluatorsApiError extends Error {
@@ -1833,7 +1857,31 @@ interface AgentResponse {
1833
1857
  /** Why the agent cannot be run with this key; null when it can. */
1834
1858
  notSelectableReason?: "owned_by_another_person" | null;
1835
1859
  parameters?: AgentParameterSpec[];
1860
+ /** The version this read shows: the latest unless a label or a version was asked for. */
1861
+ version?: number | null;
1862
+ /** The deploy labels and the version each one points at. */
1863
+ labels?: {
1864
+ label: string;
1865
+ version: number;
1866
+ }[];
1867
+ createdBy?: {
1868
+ id: string;
1869
+ name: string | null;
1870
+ } | null;
1871
+ updatedBy?: {
1872
+ id: string;
1873
+ name: string | null;
1874
+ } | null;
1836
1875
  }
1876
+ /** Which version of an agent to read: a deploy label such as `production`, or a number. */
1877
+ type AgentVersionSelector = {
1878
+ label?: string;
1879
+ version?: number;
1880
+ };
1881
+ /** An agent's versions, newest first, and where each deploy label points. */
1882
+ type AgentVersionsResponse = paths["/api/v1/agents/{agentId}/versions"]["get"]["responses"][200]["content"]["application/json"];
1883
+ /** A deploy label after it was moved. */
1884
+ type AgentLabelResponse = paths["/api/v1/agents/{agentId}/labels/{label}"]["put"]["responses"][200]["content"]["application/json"];
1837
1885
  interface AgentListResponse {
1838
1886
  data: AgentResponse[];
1839
1887
  pagination: {
@@ -1857,17 +1905,22 @@ declare class AgentsApiService {
1857
1905
  page?: number;
1858
1906
  limit?: number;
1859
1907
  }): Promise<AgentListResponse>;
1860
- get(id: string): Promise<AgentResponse>;
1908
+ /** Reads the latest version unless a `label` or a `version` is asked for. */
1909
+ get(id: string, selector?: AgentVersionSelector): Promise<AgentResponse>;
1861
1910
  create(params: {
1862
1911
  name: string;
1863
1912
  type: string;
1864
1913
  config: Record<string, unknown>;
1865
1914
  workflowId?: string;
1915
+ /** Recorded on version 1. */
1916
+ commitMessage?: string;
1866
1917
  }): Promise<AgentResponse>;
1867
1918
  update(id: string, params: {
1868
1919
  name?: string;
1869
1920
  type?: string;
1870
1921
  config?: Record<string, unknown>;
1922
+ /** Recorded on the version this update appends. */
1923
+ commitMessage?: string;
1871
1924
  }): Promise<AgentResponse>;
1872
1925
  delete(id: string): Promise<{
1873
1926
  id: string;
@@ -1884,6 +1937,15 @@ declare class AgentsApiService {
1884
1937
  * test suite, and the answer carries the run ids to follow.
1885
1938
  */
1886
1939
  test(id: string): Promise<AgentTestRunResponse>;
1940
+ /** Every version of the agent, newest first, with the labels on each. */
1941
+ listVersions(id: string): Promise<AgentVersionsResponse>;
1942
+ /** Points a deploy label, such as `production`, at one of the agent's versions. */
1943
+ assignLabel(id: string, label: string, version: number): Promise<AgentLabelResponse>;
1944
+ /** Removes a deploy label from the agent. */
1945
+ removeLabel(id: string, label: string): Promise<{
1946
+ label: string;
1947
+ removed: true;
1948
+ }>;
1887
1949
  }
1888
1950
 
1889
1951
  type AnnotationResponse = components["schemas"]["Annotation"];