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
package/dist/index.mjs CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  import {
10
10
  ensureSetup,
11
11
  resolveEndpoint
12
- } from "./chunk-UHM5RXEW.mjs";
12
+ } from "./chunk-OAAGWSLX.mjs";
13
13
  import {
14
14
  API_VERSION_HEADER,
15
15
  LANGWATCH_API_VERSION,
@@ -21,7 +21,7 @@ import {
21
21
  LangWatchTraceExporter,
22
22
  buildAuthHeaders,
23
23
  getLangWatchLogger
24
- } from "./chunk-XVXTLQGK.mjs";
24
+ } from "./chunk-P65KWWFU.mjs";
25
25
  import "./chunk-C7IWJ2GJ.mjs";
26
26
  import {
27
27
  ConsoleLogger,
@@ -8158,6 +8158,7 @@ var Experiment = class _Experiment {
8158
8158
  var toRunStartRequest = ({
8159
8159
  data,
8160
8160
  datasetId,
8161
+ datasetVersion,
8161
8162
  parameters,
8162
8163
  rowIndices,
8163
8164
  concurrency
@@ -8165,6 +8166,7 @@ var toRunStartRequest = ({
8165
8166
  const body = {};
8166
8167
  if (data !== void 0) body.data = data;
8167
8168
  if (datasetId !== void 0) body.dataset_id = datasetId;
8169
+ if (datasetVersion !== void 0) body.dataset_version = datasetVersion;
8168
8170
  if (parameters !== void 0) body.parameters = parameters;
8169
8171
  if (rowIndices !== void 0) body.row_indices = rowIndices;
8170
8172
  if (concurrency !== void 0) body.concurrency = concurrency;
@@ -8241,7 +8243,8 @@ var ExperimentsApiService = class {
8241
8243
  async startRun(slug, options = {}) {
8242
8244
  const body = toRunStartRequest({
8243
8245
  parameters: options.parameters,
8244
- concurrency: options.concurrency
8246
+ concurrency: options.concurrency,
8247
+ datasetVersion: options.datasetVersion
8245
8248
  });
8246
8249
  const { data, error, response } = await this.apiClient.POST("/api/v1/experiments/{slug}/run", __spreadValues({
8247
8250
  params: { path: { slug } }
@@ -8715,6 +8718,7 @@ var ExperimentsFacade = class {
8715
8718
  const body = toRunStartRequest({
8716
8719
  data: options.data,
8717
8720
  datasetId: options.datasetId,
8721
+ datasetVersion: options.datasetVersion,
8718
8722
  parameters: options.parameters,
8719
8723
  rowIndices: options.rowIndices,
8720
8724
  concurrency: options.concurrency
@@ -8754,7 +8758,10 @@ var ExperimentsFacade = class {
8754
8758
  var _a, _b, _c, _d, _e, _f, _g, _h;
8755
8759
  const pollInterval = (_a = options.pollInterval) != null ? _a : DEFAULT_POLL_INTERVAL2;
8756
8760
  const timeout = (_b = options.timeout) != null ? _b : DEFAULT_TIMEOUT;
8757
- const startResponse = await this.startRun(slug, options.concurrency);
8761
+ const startResponse = await this.startRun(slug, {
8762
+ concurrency: options.concurrency,
8763
+ datasetVersion: options.datasetVersion
8764
+ });
8758
8765
  const { runId } = startResponse;
8759
8766
  const apiRunUrl = (_c = startResponse.runUrl) != null ? _c : "";
8760
8767
  const runUrl = apiRunUrl ? rebaseUrlToEndpoint(apiRunUrl, this.config.endpoint) : "";
@@ -8813,8 +8820,8 @@ var ExperimentsFacade = class {
8813
8820
  /**
8814
8821
  * Start an experiment run
8815
8822
  */
8816
- async startRun(slug, concurrency) {
8817
- const body = toRunStartRequest({ concurrency });
8823
+ async startRun(slug, { concurrency, datasetVersion } = {}) {
8824
+ const body = toRunStartRequest({ concurrency, datasetVersion });
8818
8825
  let response;
8819
8826
  try {
8820
8827
  response = await this.config.langwatchApiClient.POST("/api/v1/experiments/{slug}/run", __spreadValues({
@@ -9153,11 +9160,12 @@ var EvaluatorsApiService = class {
9153
9160
  });
9154
9161
  }
9155
9162
  /**
9156
- * Fetches a single evaluator by its ID or slug.
9163
+ * Fetches a single evaluator by its ID or slug, at the latest version unless a `label` or a
9164
+ * `version` is asked for. The slug also takes a suffix: `toxicity:production` or `toxicity:2`.
9157
9165
  */
9158
- async get(idOrSlug) {
9166
+ async get(idOrSlug, selector = {}) {
9159
9167
  const { data, error, response } = await this.apiClient.GET("/api/v1/evaluators/{idOrSlug}", {
9160
- params: { path: { idOrSlug } }
9168
+ params: { path: { idOrSlug }, query: selector }
9161
9169
  });
9162
9170
  return unwrapApiResult({
9163
9171
  operation: `fetch evaluator with ID or slug "${idOrSlug}"`,
@@ -9213,6 +9221,48 @@ var EvaluatorsApiService = class {
9213
9221
  onError: this.handleApiError.bind(this)
9214
9222
  });
9215
9223
  }
9224
+ /** Every version of the evaluator, newest first, with the labels on each. */
9225
+ async listVersions(id) {
9226
+ const { data, error, response } = await this.apiClient.GET(
9227
+ "/api/v1/evaluators/{evaluatorId}/versions",
9228
+ { params: { path: { evaluatorId: id } } }
9229
+ );
9230
+ return unwrapApiResult({
9231
+ operation: `list versions of evaluator "${id}"`,
9232
+ data,
9233
+ error,
9234
+ response,
9235
+ onError: this.handleApiError.bind(this)
9236
+ });
9237
+ }
9238
+ /** Points a deploy label, such as `production`, at one of the evaluator's versions. */
9239
+ async assignLabel(id, label, version) {
9240
+ const { data, error, response } = await this.apiClient.PUT(
9241
+ "/api/v1/evaluators/{evaluatorId}/labels/{label}",
9242
+ { params: { path: { evaluatorId: id, label } }, body: { version } }
9243
+ );
9244
+ return unwrapApiResult({
9245
+ operation: `deploy label "${label}" of evaluator "${id}"`,
9246
+ data,
9247
+ error,
9248
+ response,
9249
+ onError: this.handleApiError.bind(this)
9250
+ });
9251
+ }
9252
+ /** Removes a deploy label from the evaluator. */
9253
+ async removeLabel(id, label) {
9254
+ const { data, error, response } = await this.apiClient.DELETE(
9255
+ "/api/v1/evaluators/{evaluatorId}/labels/{label}",
9256
+ { params: { path: { evaluatorId: id, label } } }
9257
+ );
9258
+ return unwrapApiResult({
9259
+ operation: `remove label "${label}" of evaluator "${id}"`,
9260
+ data,
9261
+ error,
9262
+ response,
9263
+ onError: this.handleApiError.bind(this)
9264
+ });
9265
+ }
9216
9266
  };
9217
9267
 
9218
9268
  // src/client-sdk/services/scenarios/errors.ts
@@ -9918,6 +9968,7 @@ var WorkflowsApiService = class {
9918
9968
  if (options.versionId !== void 0) body.version_id = options.versionId;
9919
9969
  if (options.data !== void 0) body.data = options.data;
9920
9970
  if (options.datasetId !== void 0) body.dataset_id = options.datasetId;
9971
+ if (options.datasetVersion !== void 0) body.dataset_version = options.datasetVersion;
9921
9972
  if (options.parameters !== void 0) body.parameters = options.parameters;
9922
9973
  if (options.rowIndices !== void 0) body.row_indices = options.rowIndices;
9923
9974
  const startResponse = await this.postUndeclaredEndpoint({
@@ -9992,9 +10043,10 @@ var AgentsApiService = class {
9992
10043
  onError: this.handleApiError.bind(this)
9993
10044
  });
9994
10045
  }
9995
- async get(id) {
10046
+ /** Reads the latest version unless a `label` or a `version` is asked for. */
10047
+ async get(id, selector = {}) {
9996
10048
  const { data, error, response } = await this.apiClient.GET("/api/v1/agents/{id}", {
9997
- params: { path: { id } }
10049
+ params: { path: { id }, query: selector }
9998
10050
  });
9999
10051
  return unwrapApiResult({
10000
10052
  operation: `get agent "${id}"`,
@@ -10075,6 +10127,48 @@ var AgentsApiService = class {
10075
10127
  onError: this.handleApiError.bind(this)
10076
10128
  });
10077
10129
  }
10130
+ /** Every version of the agent, newest first, with the labels on each. */
10131
+ async listVersions(id) {
10132
+ const { data, error, response } = await this.apiClient.GET(
10133
+ "/api/v1/agents/{agentId}/versions",
10134
+ { params: { path: { agentId: id } } }
10135
+ );
10136
+ return unwrapApiResult({
10137
+ operation: `list versions of agent "${id}"`,
10138
+ data,
10139
+ error,
10140
+ response,
10141
+ onError: this.handleApiError.bind(this)
10142
+ });
10143
+ }
10144
+ /** Points a deploy label, such as `production`, at one of the agent's versions. */
10145
+ async assignLabel(id, label, version) {
10146
+ const { data, error, response } = await this.apiClient.PUT(
10147
+ "/api/v1/agents/{agentId}/labels/{label}",
10148
+ { params: { path: { agentId: id, label } }, body: { version } }
10149
+ );
10150
+ return unwrapApiResult({
10151
+ operation: `deploy label "${label}" of agent "${id}"`,
10152
+ data,
10153
+ error,
10154
+ response,
10155
+ onError: this.handleApiError.bind(this)
10156
+ });
10157
+ }
10158
+ /** Removes a deploy label from the agent. */
10159
+ async removeLabel(id, label) {
10160
+ const { data, error, response } = await this.apiClient.DELETE(
10161
+ "/api/v1/agents/{agentId}/labels/{label}",
10162
+ { params: { path: { agentId: id, label } } }
10163
+ );
10164
+ return unwrapApiResult({
10165
+ operation: `remove label "${label}" of agent "${id}"`,
10166
+ data,
10167
+ error,
10168
+ response,
10169
+ onError: this.handleApiError.bind(this)
10170
+ });
10171
+ }
10078
10172
  };
10079
10173
 
10080
10174
  // src/client-sdk/services/annotations/annotations-api.service.ts