langwatch 2.0.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 (40) 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-F7BVJW3S.js → chunk-E35GFO25.js} +16 -3
  6. package/dist/chunk-E35GFO25.js.map +1 -0
  7. package/dist/{chunk-2GKEMCKT.mjs → chunk-FXCZARU3.mjs} +16 -3
  8. package/dist/{chunk-2GKEMCKT.mjs.map → chunk-FXCZARU3.mjs.map} +1 -1
  9. package/dist/{chunk-AYPQNLCC.mjs → chunk-OAAGWSLX.mjs} +2 -2
  10. package/dist/{chunk-M3DSPR5S.mjs → chunk-P65KWWFU.mjs} +2 -2
  11. package/dist/{chunk-M3DSPR5S.mjs.map → chunk-P65KWWFU.mjs.map} +1 -1
  12. package/dist/{chunk-MAO3SIBB.js → chunk-PDTYQM5C.js} +2 -2
  13. package/dist/{chunk-MAO3SIBB.js.map → chunk-PDTYQM5C.js.map} +1 -1
  14. package/dist/{chunk-DLZCOUXC.js → chunk-TQJS5H5P.js} +12 -12
  15. package/dist/{chunk-DLZCOUXC.js.map → chunk-TQJS5H5P.js.map} +1 -1
  16. package/dist/cli/bundle.js +957 -451
  17. package/dist/{implementation-BXVPzwOt.d.mts → implementation-CMJfitMa.d.mts} +1 -1
  18. package/dist/{implementation-DJ-JveZl.d.ts → implementation-CaKFOMnp.d.ts} +1 -1
  19. package/dist/index.d.mts +80 -8
  20. package/dist/index.d.ts +80 -8
  21. package/dist/index.js +195 -94
  22. package/dist/index.js.map +1 -1
  23. package/dist/index.mjs +120 -19
  24. package/dist/index.mjs.map +1 -1
  25. package/dist/observability-sdk/index.d.mts +3 -3
  26. package/dist/observability-sdk/index.d.ts +3 -3
  27. package/dist/observability-sdk/index.js +4 -4
  28. package/dist/observability-sdk/index.js.map +1 -1
  29. package/dist/observability-sdk/index.mjs +8 -8
  30. package/dist/observability-sdk/instrumentation/langchain/index.d.mts +1 -1
  31. package/dist/observability-sdk/instrumentation/langchain/index.d.ts +1 -1
  32. package/dist/observability-sdk/instrumentation/langchain/index.js +4 -4
  33. package/dist/observability-sdk/instrumentation/langchain/index.mjs +1 -1
  34. package/dist/observability-sdk/setup/node/index.js +3 -3
  35. package/dist/observability-sdk/setup/node/index.mjs +2 -2
  36. package/dist/{types-CpT3iEIj.d.ts → types-0leNdzy4.d.ts} +581 -23
  37. package/dist/{types--ExXvd26.d.mts → types-DNjiOkpS.d.mts} +581 -23
  38. package/package.json +1 -1
  39. package/dist/chunk-F7BVJW3S.js.map +0 -1
  40. /package/dist/{chunk-AYPQNLCC.mjs.map → chunk-OAAGWSLX.mjs.map} +0 -0
package/dist/index.mjs CHANGED
@@ -1,10 +1,15 @@
1
1
  import {
2
2
  FilterableBatchSpanProcessor
3
3
  } from "./chunk-XQ4CP2JK.mjs";
4
+ import {
5
+ createLangWatchSpan,
6
+ external_exports,
7
+ getLangWatchTracer
8
+ } from "./chunk-FXCZARU3.mjs";
4
9
  import {
5
10
  ensureSetup,
6
11
  resolveEndpoint
7
- } from "./chunk-AYPQNLCC.mjs";
12
+ } from "./chunk-OAAGWSLX.mjs";
8
13
  import {
9
14
  API_VERSION_HEADER,
10
15
  LANGWATCH_API_VERSION,
@@ -16,13 +21,8 @@ import {
16
21
  LangWatchTraceExporter,
17
22
  buildAuthHeaders,
18
23
  getLangWatchLogger
19
- } from "./chunk-M3DSPR5S.mjs";
24
+ } from "./chunk-P65KWWFU.mjs";
20
25
  import "./chunk-C7IWJ2GJ.mjs";
21
- import {
22
- createLangWatchSpan,
23
- external_exports,
24
- getLangWatchTracer
25
- } from "./chunk-2GKEMCKT.mjs";
26
26
  import {
27
27
  ConsoleLogger,
28
28
  NoOpLogger,
@@ -8158,14 +8158,18 @@ var Experiment = class _Experiment {
8158
8158
  var toRunStartRequest = ({
8159
8159
  data,
8160
8160
  datasetId,
8161
+ datasetVersion,
8161
8162
  parameters,
8162
- rowIndices
8163
+ rowIndices,
8164
+ concurrency
8163
8165
  }) => {
8164
8166
  const body = {};
8165
8167
  if (data !== void 0) body.data = data;
8166
8168
  if (datasetId !== void 0) body.dataset_id = datasetId;
8169
+ if (datasetVersion !== void 0) body.dataset_version = datasetVersion;
8167
8170
  if (parameters !== void 0) body.parameters = parameters;
8168
8171
  if (rowIndices !== void 0) body.row_indices = rowIndices;
8172
+ if (concurrency !== void 0) body.concurrency = concurrency;
8169
8173
  return Object.keys(body).length > 0 ? body : void 0;
8170
8174
  };
8171
8175
  var ExperimentsApiServiceError = class extends Error {
@@ -8237,7 +8241,11 @@ var ExperimentsApiService = class {
8237
8241
  * Start a saved experiment by slug.
8238
8242
  */
8239
8243
  async startRun(slug, options = {}) {
8240
- const body = toRunStartRequest({ parameters: options.parameters });
8244
+ const body = toRunStartRequest({
8245
+ parameters: options.parameters,
8246
+ concurrency: options.concurrency,
8247
+ datasetVersion: options.datasetVersion
8248
+ });
8241
8249
  const { data, error, response } = await this.apiClient.POST("/api/v1/experiments/{slug}/run", __spreadValues({
8242
8250
  params: { path: { slug } }
8243
8251
  }, body !== void 0 ? { body } : {}));
@@ -8710,8 +8718,10 @@ var ExperimentsFacade = class {
8710
8718
  const body = toRunStartRequest({
8711
8719
  data: options.data,
8712
8720
  datasetId: options.datasetId,
8721
+ datasetVersion: options.datasetVersion,
8713
8722
  parameters: options.parameters,
8714
- rowIndices: options.rowIndices
8723
+ rowIndices: options.rowIndices,
8724
+ concurrency: options.concurrency
8715
8725
  });
8716
8726
  const startResponse = await this.apiService.startV3Run({ slug, body });
8717
8727
  const { runId } = startResponse;
@@ -8748,7 +8758,10 @@ var ExperimentsFacade = class {
8748
8758
  var _a, _b, _c, _d, _e, _f, _g, _h;
8749
8759
  const pollInterval = (_a = options.pollInterval) != null ? _a : DEFAULT_POLL_INTERVAL2;
8750
8760
  const timeout = (_b = options.timeout) != null ? _b : DEFAULT_TIMEOUT;
8751
- const startResponse = await this.startRun(slug);
8761
+ const startResponse = await this.startRun(slug, {
8762
+ concurrency: options.concurrency,
8763
+ datasetVersion: options.datasetVersion
8764
+ });
8752
8765
  const { runId } = startResponse;
8753
8766
  const apiRunUrl = (_c = startResponse.runUrl) != null ? _c : "";
8754
8767
  const runUrl = apiRunUrl ? rebaseUrlToEndpoint(apiRunUrl, this.config.endpoint) : "";
@@ -8807,14 +8820,15 @@ var ExperimentsFacade = class {
8807
8820
  /**
8808
8821
  * Start an experiment run
8809
8822
  */
8810
- async startRun(slug) {
8823
+ async startRun(slug, { concurrency, datasetVersion } = {}) {
8824
+ const body = toRunStartRequest({ concurrency, datasetVersion });
8811
8825
  let response;
8812
8826
  try {
8813
- response = await this.config.langwatchApiClient.POST("/api/v1/experiments/{slug}/run", {
8827
+ response = await this.config.langwatchApiClient.POST("/api/v1/experiments/{slug}/run", __spreadValues({
8814
8828
  params: {
8815
8829
  path: { slug }
8816
8830
  }
8817
- });
8831
+ }, body !== void 0 ? { body } : {}));
8818
8832
  } catch (error) {
8819
8833
  if (isLangWatchHandledError(error)) {
8820
8834
  this.handleStartRunError(slug, error.body, error.httpStatus);
@@ -9146,11 +9160,12 @@ var EvaluatorsApiService = class {
9146
9160
  });
9147
9161
  }
9148
9162
  /**
9149
- * 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`.
9150
9165
  */
9151
- async get(idOrSlug) {
9166
+ async get(idOrSlug, selector = {}) {
9152
9167
  const { data, error, response } = await this.apiClient.GET("/api/v1/evaluators/{idOrSlug}", {
9153
- params: { path: { idOrSlug } }
9168
+ params: { path: { idOrSlug }, query: selector }
9154
9169
  });
9155
9170
  return unwrapApiResult({
9156
9171
  operation: `fetch evaluator with ID or slug "${idOrSlug}"`,
@@ -9206,6 +9221,48 @@ var EvaluatorsApiService = class {
9206
9221
  onError: this.handleApiError.bind(this)
9207
9222
  });
9208
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
+ }
9209
9266
  };
9210
9267
 
9211
9268
  // src/client-sdk/services/scenarios/errors.ts
@@ -9911,6 +9968,7 @@ var WorkflowsApiService = class {
9911
9968
  if (options.versionId !== void 0) body.version_id = options.versionId;
9912
9969
  if (options.data !== void 0) body.data = options.data;
9913
9970
  if (options.datasetId !== void 0) body.dataset_id = options.datasetId;
9971
+ if (options.datasetVersion !== void 0) body.dataset_version = options.datasetVersion;
9914
9972
  if (options.parameters !== void 0) body.parameters = options.parameters;
9915
9973
  if (options.rowIndices !== void 0) body.row_indices = options.rowIndices;
9916
9974
  const startResponse = await this.postUndeclaredEndpoint({
@@ -9985,9 +10043,10 @@ var AgentsApiService = class {
9985
10043
  onError: this.handleApiError.bind(this)
9986
10044
  });
9987
10045
  }
9988
- async get(id) {
10046
+ /** Reads the latest version unless a `label` or a `version` is asked for. */
10047
+ async get(id, selector = {}) {
9989
10048
  const { data, error, response } = await this.apiClient.GET("/api/v1/agents/{id}", {
9990
- params: { path: { id } }
10049
+ params: { path: { id }, query: selector }
9991
10050
  });
9992
10051
  return unwrapApiResult({
9993
10052
  operation: `get agent "${id}"`,
@@ -10068,6 +10127,48 @@ var AgentsApiService = class {
10068
10127
  onError: this.handleApiError.bind(this)
10069
10128
  });
10070
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
+ }
10071
10172
  };
10072
10173
 
10073
10174
  // src/client-sdk/services/annotations/annotations-api.service.ts