langwatch 1.14.0 → 1.16.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.
- package/dist/agent/index.js +1 -1
- package/dist/agent/index.js.map +1 -1
- package/dist/agent/index.mjs +1 -1
- package/dist/agent/index.mjs.map +1 -1
- package/dist/{chunk-MGASIVXD.js → chunk-6SSJPQAW.js} +2 -2
- package/dist/chunk-6SSJPQAW.js.map +1 -0
- package/dist/{chunk-7FIG44IG.js → chunk-FUDF46YW.js} +12 -12
- package/dist/{chunk-7FIG44IG.js.map → chunk-FUDF46YW.js.map} +1 -1
- package/dist/{chunk-QKIDVFHZ.mjs → chunk-NZP72HTX.mjs} +2 -2
- package/dist/chunk-NZP72HTX.mjs.map +1 -0
- package/dist/{chunk-MCM4C66E.mjs → chunk-XC6AXWVR.mjs} +2 -2
- package/dist/cli/bundle.js +328 -294
- package/dist/{implementation-BXX0qdV7.d.mts → implementation-BvHTdJLg.d.mts} +1 -1
- package/dist/{implementation-Cv7sBdwj.d.ts → implementation-Dlxw5hlM.d.ts} +1 -1
- package/dist/index.d.mts +141 -28
- package/dist/index.d.ts +141 -28
- package/dist/index.js +229 -43
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +198 -12
- package/dist/index.mjs.map +1 -1
- package/dist/observability-sdk/index.d.mts +3 -3
- package/dist/observability-sdk/index.d.ts +3 -3
- package/dist/observability-sdk/index.js +2 -2
- package/dist/observability-sdk/index.mjs +1 -1
- package/dist/observability-sdk/instrumentation/langchain/index.d.mts +1 -1
- package/dist/observability-sdk/instrumentation/langchain/index.d.ts +1 -1
- package/dist/observability-sdk/setup/node/index.js +3 -3
- package/dist/observability-sdk/setup/node/index.mjs +2 -2
- package/dist/{types-BejNp4Dw.d.ts → types-CzElA_6o.d.ts} +1439 -247
- package/dist/{types-DXNIJdZx.d.mts → types-Dd2d9hCy.d.mts} +1439 -247
- package/package.json +1 -3
- package/dist/chunk-MGASIVXD.js.map +0 -1
- package/dist/chunk-QKIDVFHZ.mjs.map +0 -1
- /package/dist/{chunk-MCM4C66E.mjs.map → chunk-XC6AXWVR.mjs.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ var _chunkO4J3ZPZYjs = require('./chunk-O4J3ZPZY.js');
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkFUDF46YWjs = require('./chunk-FUDF46YW.js');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
@@ -20,7 +20,7 @@ var _chunk7FIG44IGjs = require('./chunk-7FIG44IG.js');
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
var
|
|
23
|
+
var _chunk6SSJPQAWjs = require('./chunk-6SSJPQAW.js');
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
@@ -329,7 +329,7 @@ var PromptServiceTracingDecorator = class {
|
|
|
329
329
|
};
|
|
330
330
|
|
|
331
331
|
// src/client-sdk/services/prompts/tracing/tracer.ts
|
|
332
|
-
var tracer = _chunkO4J3ZPZYjs.getLangWatchTracer.call(void 0, `${
|
|
332
|
+
var tracer = _chunkO4J3ZPZYjs.getLangWatchTracer.call(void 0, `${_chunk6SSJPQAWjs.LANGWATCH_SDK_NAME_CLIENT}.prompts`, _chunk6SSJPQAWjs.LANGWATCH_SDK_VERSION);
|
|
333
333
|
|
|
334
334
|
// src/client-sdk/tracing/create-tracing-proxy.ts
|
|
335
335
|
var _api = require('@opentelemetry/api');
|
|
@@ -884,15 +884,15 @@ var handledErrorMiddleware = {
|
|
|
884
884
|
};
|
|
885
885
|
var createLangWatchApiClient = (apiKey = ((_b) => (_b = ((_a) => (_a = scopedApiKey()) != null ? _a : process.env.LANGWATCH_API_KEY)()) != null ? _b : "")(), endpoint, projectId = ((_c) => (_c = scopedProjectId()) != null ? _c : process.env.LANGWATCH_PROJECT_ID)()) => {
|
|
886
886
|
const client = _openapifetch2.default.call(void 0, {
|
|
887
|
-
baseUrl:
|
|
887
|
+
baseUrl: _chunkFUDF46YWjs.resolveEndpoint.call(void 0, endpoint),
|
|
888
888
|
fetch: langwatchFetch,
|
|
889
|
-
headers: _chunkLCG5Y2EGjs.__spreadProps.call(void 0, _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {},
|
|
889
|
+
headers: _chunkLCG5Y2EGjs.__spreadProps.call(void 0, _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {}, _chunk6SSJPQAWjs.buildAuthHeaders.call(void 0, { apiKey, projectId })), {
|
|
890
890
|
"content-type": "application/json",
|
|
891
|
-
"user-agent": `langwatch-sdk-node/${
|
|
892
|
-
"x-langwatch-sdk-name":
|
|
893
|
-
"x-langwatch-sdk-language":
|
|
894
|
-
"x-langwatch-sdk-version":
|
|
895
|
-
"x-langwatch-sdk-platform":
|
|
891
|
+
"user-agent": `langwatch-sdk-node/${_chunk6SSJPQAWjs.version}`,
|
|
892
|
+
"x-langwatch-sdk-name": _chunk6SSJPQAWjs.LANGWATCH_SDK_NAME_OBSERVABILITY,
|
|
893
|
+
"x-langwatch-sdk-language": _chunk6SSJPQAWjs.LANGWATCH_SDK_LANGUAGE,
|
|
894
|
+
"x-langwatch-sdk-version": _chunk6SSJPQAWjs.LANGWATCH_SDK_VERSION,
|
|
895
|
+
"x-langwatch-sdk-platform": _chunk6SSJPQAWjs.LANGWATCH_SDK_RUNTIME.call(void 0, )
|
|
896
896
|
})
|
|
897
897
|
});
|
|
898
898
|
client.use(handledErrorMiddleware);
|
|
@@ -2169,12 +2169,12 @@ var DatasetPlanLimitError = class extends DatasetError {
|
|
|
2169
2169
|
};
|
|
2170
2170
|
|
|
2171
2171
|
// src/client-sdk/services/datasets/tracing/tracer.ts
|
|
2172
|
-
var tracer2 = _chunkO4J3ZPZYjs.getLangWatchTracer.call(void 0, `${
|
|
2172
|
+
var tracer2 = _chunkO4J3ZPZYjs.getLangWatchTracer.call(void 0, `${_chunk6SSJPQAWjs.LANGWATCH_SDK_NAME_CLIENT}.datasets`, _chunk6SSJPQAWjs.LANGWATCH_SDK_VERSION);
|
|
2173
2173
|
|
|
2174
2174
|
// src/client-sdk/services/datasets/dataset.service.ts
|
|
2175
2175
|
var DatasetService = class {
|
|
2176
2176
|
constructor(config) {
|
|
2177
|
-
this.config = _chunkLCG5Y2EGjs.__spreadProps.call(void 0, _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {}, config), { endpoint:
|
|
2177
|
+
this.config = _chunkLCG5Y2EGjs.__spreadProps.call(void 0, _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {}, config), { endpoint: _chunkFUDF46YWjs.resolveEndpoint.call(void 0, config.endpoint) });
|
|
2178
2178
|
return createTracingProxy(this, tracer2);
|
|
2179
2179
|
}
|
|
2180
2180
|
/**
|
|
@@ -2455,7 +2455,7 @@ var DatasetService = class {
|
|
|
2455
2455
|
const url = `${endpoint}${path2}`;
|
|
2456
2456
|
const response = await langwatchFetch(url, {
|
|
2457
2457
|
method: "POST",
|
|
2458
|
-
headers:
|
|
2458
|
+
headers: _chunk6SSJPQAWjs.buildAuthHeaders.call(void 0, { apiKey }),
|
|
2459
2459
|
body: formData
|
|
2460
2460
|
});
|
|
2461
2461
|
if (!response.ok) {
|
|
@@ -3154,7 +3154,7 @@ var Experiment = class _Experiment {
|
|
|
3154
3154
|
this.experimentSlug = name;
|
|
3155
3155
|
this.runId = (_a = options.runId) != null ? _a : generateHumanReadableId();
|
|
3156
3156
|
this.apiClient = options.apiClient;
|
|
3157
|
-
this.endpoint =
|
|
3157
|
+
this.endpoint = _chunkFUDF46YWjs.resolveEndpoint.call(void 0, options.endpoint);
|
|
3158
3158
|
this.apiKey = options.apiKey;
|
|
3159
3159
|
this.logger = options.logger;
|
|
3160
3160
|
this.concurrency = (_b = options.concurrency) != null ? _b : DEFAULT_CONCURRENCY;
|
|
@@ -3164,7 +3164,7 @@ var Experiment = class _Experiment {
|
|
|
3164
3164
|
* Initialize an evaluation session
|
|
3165
3165
|
*/
|
|
3166
3166
|
static async init(name, options) {
|
|
3167
|
-
|
|
3167
|
+
_chunkFUDF46YWjs.ensureSetup.call(void 0, );
|
|
3168
3168
|
const experiment = new _Experiment(name, options);
|
|
3169
3169
|
await experiment.initialize();
|
|
3170
3170
|
return experiment;
|
|
@@ -3183,7 +3183,7 @@ var Experiment = class _Experiment {
|
|
|
3183
3183
|
method: "POST",
|
|
3184
3184
|
headers: _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {
|
|
3185
3185
|
"Content-Type": "application/json"
|
|
3186
|
-
},
|
|
3186
|
+
}, _chunk6SSJPQAWjs.buildAuthHeaders.call(void 0, { apiKey: this.apiKey })),
|
|
3187
3187
|
body: JSON.stringify({
|
|
3188
3188
|
experiment_name: this.name,
|
|
3189
3189
|
experiment_slug: this.experimentSlug,
|
|
@@ -3539,7 +3539,7 @@ var Experiment = class _Experiment {
|
|
|
3539
3539
|
method: "POST",
|
|
3540
3540
|
headers: _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {
|
|
3541
3541
|
"Content-Type": "application/json"
|
|
3542
|
-
},
|
|
3542
|
+
}, _chunk6SSJPQAWjs.buildAuthHeaders.call(void 0, { apiKey: this.apiKey })),
|
|
3543
3543
|
body: JSON.stringify({
|
|
3544
3544
|
trace_id: traceId != null ? traceId : null,
|
|
3545
3545
|
span_id: spanId != null ? spanId : null,
|
|
@@ -4076,7 +4076,7 @@ var Experiment = class _Experiment {
|
|
|
4076
4076
|
method: "POST",
|
|
4077
4077
|
headers: _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {
|
|
4078
4078
|
"Content-Type": "application/json"
|
|
4079
|
-
},
|
|
4079
|
+
}, _chunk6SSJPQAWjs.buildAuthHeaders.call(void 0, { apiKey: this.apiKey })),
|
|
4080
4080
|
body: JSON.stringify(body)
|
|
4081
4081
|
}).then((response) => {
|
|
4082
4082
|
if (!response.ok) {
|
|
@@ -5064,7 +5064,7 @@ var EvaluationsFacade = class {
|
|
|
5064
5064
|
method: "POST",
|
|
5065
5065
|
headers: _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {
|
|
5066
5066
|
"Content-Type": "application/json"
|
|
5067
|
-
},
|
|
5067
|
+
}, _chunk6SSJPQAWjs.buildAuthHeaders.call(void 0, { apiKey: _chunkLCG5Y2EGjs.__privateGet.call(void 0, this, _apiKey) })),
|
|
5068
5068
|
body: JSON.stringify(requestBody)
|
|
5069
5069
|
});
|
|
5070
5070
|
if (!response.ok) {
|
|
@@ -5496,6 +5496,149 @@ function withTrimmedNote(body) {
|
|
|
5496
5496
|
return rest;
|
|
5497
5497
|
}
|
|
5498
5498
|
|
|
5499
|
+
// src/client-sdk/services/instant-evals/instant-evals-api.service.ts
|
|
5500
|
+
var InstantEvalsApiError = class extends Error {
|
|
5501
|
+
constructor(message, operation, originalError, status) {
|
|
5502
|
+
super(message);
|
|
5503
|
+
this.operation = operation;
|
|
5504
|
+
this.originalError = originalError;
|
|
5505
|
+
this.status = status;
|
|
5506
|
+
this.name = "InstantEvalsApiError";
|
|
5507
|
+
}
|
|
5508
|
+
};
|
|
5509
|
+
var InstantEvalsApiService = class {
|
|
5510
|
+
constructor(config) {
|
|
5511
|
+
var _a;
|
|
5512
|
+
this.apiClient = (_a = config == null ? void 0 : config.langwatchApiClient) != null ? _a : createLangWatchApiClient();
|
|
5513
|
+
}
|
|
5514
|
+
handleApiError(operation, error, response) {
|
|
5515
|
+
var _a;
|
|
5516
|
+
const status = (_a = response == null ? void 0 : response.status) != null ? _a : extractStatusFromResponse(error);
|
|
5517
|
+
const message = formatApiErrorForOperation({
|
|
5518
|
+
operation,
|
|
5519
|
+
error,
|
|
5520
|
+
options: { status }
|
|
5521
|
+
});
|
|
5522
|
+
throwIfHandledError({ operation, error, response, message });
|
|
5523
|
+
throw new InstantEvalsApiError(message, operation, error, status);
|
|
5524
|
+
}
|
|
5525
|
+
/**
|
|
5526
|
+
* The body of a successful answer. A failed response can arrive with no body
|
|
5527
|
+
* at all (a proxy answering 502 while the platform restarts), which leaves
|
|
5528
|
+
* `error` empty, so the response status decides and not the error alone.
|
|
5529
|
+
*/
|
|
5530
|
+
unwrap({
|
|
5531
|
+
operation,
|
|
5532
|
+
data,
|
|
5533
|
+
error,
|
|
5534
|
+
response
|
|
5535
|
+
}) {
|
|
5536
|
+
const failed = response !== void 0 && !response.ok;
|
|
5537
|
+
if (error || failed || data === void 0) {
|
|
5538
|
+
this.handleApiError(operation, error != null ? error : void 0, response);
|
|
5539
|
+
}
|
|
5540
|
+
return data;
|
|
5541
|
+
}
|
|
5542
|
+
/** Starts a run. The judging happens on the queue. */
|
|
5543
|
+
async create(body) {
|
|
5544
|
+
const { data, error, response } = await this.apiClient.POST(
|
|
5545
|
+
"/api/v1/instant-evals",
|
|
5546
|
+
{ body }
|
|
5547
|
+
);
|
|
5548
|
+
return this.unwrap({
|
|
5549
|
+
operation: "start an instant eval run",
|
|
5550
|
+
data,
|
|
5551
|
+
error,
|
|
5552
|
+
response
|
|
5553
|
+
});
|
|
5554
|
+
}
|
|
5555
|
+
/** Prices a run without starting it. Nothing is judged and nothing is charged. */
|
|
5556
|
+
async estimate(body) {
|
|
5557
|
+
const { data, error, response } = await this.apiClient.POST(
|
|
5558
|
+
"/api/v1/instant-evals/estimate",
|
|
5559
|
+
{ body }
|
|
5560
|
+
);
|
|
5561
|
+
return this.unwrap({
|
|
5562
|
+
operation: "estimate an instant eval run",
|
|
5563
|
+
data,
|
|
5564
|
+
error,
|
|
5565
|
+
response
|
|
5566
|
+
});
|
|
5567
|
+
}
|
|
5568
|
+
/** The project's runs, newest first. */
|
|
5569
|
+
async list(options) {
|
|
5570
|
+
const query = _chunkLCG5Y2EGjs.__spreadValues.call(void 0, _chunkLCG5Y2EGjs.__spreadValues.call(void 0, _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {}, (options == null ? void 0 : options.limit) === void 0 ? {} : { limit: options.limit }), (options == null ? void 0 : options.before) === void 0 ? {} : { before: options.before }), (options == null ? void 0 : options.beforeId) === void 0 ? {} : { beforeId: options.beforeId });
|
|
5571
|
+
const { data, error, response } = await this.apiClient.GET(
|
|
5572
|
+
"/api/v1/instant-evals",
|
|
5573
|
+
{ params: { query } }
|
|
5574
|
+
);
|
|
5575
|
+
return this.unwrap({
|
|
5576
|
+
operation: "list instant eval runs",
|
|
5577
|
+
data,
|
|
5578
|
+
error,
|
|
5579
|
+
response
|
|
5580
|
+
}).runs;
|
|
5581
|
+
}
|
|
5582
|
+
async get(id) {
|
|
5583
|
+
const { data, error, response } = await this.apiClient.GET(
|
|
5584
|
+
"/api/v1/instant-evals/{id}",
|
|
5585
|
+
{ params: { path: { id } } }
|
|
5586
|
+
);
|
|
5587
|
+
return this.unwrap({
|
|
5588
|
+
operation: `get instant eval run "${id}"`,
|
|
5589
|
+
data,
|
|
5590
|
+
error,
|
|
5591
|
+
response
|
|
5592
|
+
});
|
|
5593
|
+
}
|
|
5594
|
+
/** Asks a run to stop. It stops before its next page. */
|
|
5595
|
+
async cancel(id) {
|
|
5596
|
+
const { data, error, response } = await this.apiClient.POST(
|
|
5597
|
+
"/api/v1/instant-evals/{id}/cancel",
|
|
5598
|
+
{ params: { path: { id } } }
|
|
5599
|
+
);
|
|
5600
|
+
return this.unwrap({
|
|
5601
|
+
operation: `cancel instant eval run "${id}"`,
|
|
5602
|
+
data,
|
|
5603
|
+
error,
|
|
5604
|
+
response
|
|
5605
|
+
});
|
|
5606
|
+
}
|
|
5607
|
+
/**
|
|
5608
|
+
* One page of a run's judgements.
|
|
5609
|
+
*
|
|
5610
|
+
* Pass the `nextCursor` a page answers with to read the page after it. The
|
|
5611
|
+
* last page carries none.
|
|
5612
|
+
*/
|
|
5613
|
+
async results(id, options) {
|
|
5614
|
+
const query = _chunkLCG5Y2EGjs.__spreadValues.call(void 0, _chunkLCG5Y2EGjs.__spreadValues.call(void 0, _chunkLCG5Y2EGjs.__spreadValues.call(void 0, _chunkLCG5Y2EGjs.__spreadValues.call(void 0, _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {}, (options == null ? void 0 : options.questionId) === void 0 ? {} : { questionId: options.questionId }), (options == null ? void 0 : options.isMatched) === void 0 ? {} : { matched: options.isMatched ? "true" : "false" }), (options == null ? void 0 : options.status) === void 0 ? {} : { status: options.status }), (options == null ? void 0 : options.limit) === void 0 ? {} : { limit: options.limit }), (options == null ? void 0 : options.cursor) === void 0 ? {} : { cursor: options.cursor });
|
|
5615
|
+
const { data, error, response } = await this.apiClient.GET(
|
|
5616
|
+
"/api/v1/instant-evals/{id}/results",
|
|
5617
|
+
{ params: { path: { id }, query } }
|
|
5618
|
+
);
|
|
5619
|
+
return this.unwrap({
|
|
5620
|
+
operation: `read instant eval run "${id}" results`,
|
|
5621
|
+
data,
|
|
5622
|
+
error,
|
|
5623
|
+
response
|
|
5624
|
+
});
|
|
5625
|
+
}
|
|
5626
|
+
/** A few of the run's rows, with the judged text beside the verdict. */
|
|
5627
|
+
async sample(id, options) {
|
|
5628
|
+
const query = (options == null ? void 0 : options.n) === void 0 ? {} : { n: options.n };
|
|
5629
|
+
const { data, error, response } = await this.apiClient.GET(
|
|
5630
|
+
"/api/v1/instant-evals/{id}/sample",
|
|
5631
|
+
{ params: { path: { id }, query } }
|
|
5632
|
+
);
|
|
5633
|
+
return this.unwrap({
|
|
5634
|
+
operation: `sample instant eval run "${id}"`,
|
|
5635
|
+
data,
|
|
5636
|
+
error,
|
|
5637
|
+
response
|
|
5638
|
+
});
|
|
5639
|
+
}
|
|
5640
|
+
};
|
|
5641
|
+
|
|
5499
5642
|
// src/client-sdk/services/test-suites/test-suites-api.service.ts
|
|
5500
5643
|
var TestSuitesApiError = class extends Error {
|
|
5501
5644
|
constructor(message, operation, originalError, status) {
|
|
@@ -5611,7 +5754,7 @@ var WorkflowsApiError = class extends Error {
|
|
|
5611
5754
|
var WorkflowsApiService = class {
|
|
5612
5755
|
constructor(config) {
|
|
5613
5756
|
var _a;
|
|
5614
|
-
this.endpoint =
|
|
5757
|
+
this.endpoint = _chunkFUDF46YWjs.resolveEndpoint.call(void 0, config == null ? void 0 : config.endpoint);
|
|
5615
5758
|
this.apiClient = (_a = config == null ? void 0 : config.langwatchApiClient) != null ? _a : createLangWatchApiClient(void 0, this.endpoint);
|
|
5616
5759
|
this.experimentsApiService = new ExperimentsApiService({
|
|
5617
5760
|
langwatchApiClient: this.apiClient
|
|
@@ -6027,7 +6170,7 @@ var QueryApiService = class {
|
|
|
6027
6170
|
throw new QueryApiError(message, operation, error, status);
|
|
6028
6171
|
}
|
|
6029
6172
|
/**
|
|
6030
|
-
* Runs one read-only LangWatchQL `SELECT` over the analytics
|
|
6173
|
+
* Runs one read-only LangWatchQL `SELECT` over the analytics views and
|
|
6031
6174
|
* returns typed columns, rows, execution statistics, truncation state and
|
|
6032
6175
|
* diagnostics, scoped to the caller's project.
|
|
6033
6176
|
*/
|
|
@@ -6040,7 +6183,7 @@ var QueryApiService = class {
|
|
|
6040
6183
|
return data;
|
|
6041
6184
|
}
|
|
6042
6185
|
/**
|
|
6043
|
-
* Lists the LangWatchQL analytics
|
|
6186
|
+
* Lists the LangWatchQL analytics views this key may query, with each
|
|
6044
6187
|
* column's type, description, the permissions that unlock it, and whether
|
|
6045
6188
|
* this caller holds them — plus each dataset's grain, join keys,
|
|
6046
6189
|
* partition-pruning time column, freshness and a runnable example query.
|
|
@@ -6053,6 +6196,20 @@ var QueryApiService = class {
|
|
|
6053
6196
|
if (error) this.handleApiError("discover query schema", error, response);
|
|
6054
6197
|
return data;
|
|
6055
6198
|
}
|
|
6199
|
+
/**
|
|
6200
|
+
* Describes both query languages in one payload: the LangWatchQL schema,
|
|
6201
|
+
* limits and endpoints, the trace filter's syntax and fields, worked examples
|
|
6202
|
+
* validated in both, and which language answers which kind of
|
|
6203
|
+
* question.
|
|
6204
|
+
*/
|
|
6205
|
+
async reference() {
|
|
6206
|
+
const { data, error, response } = await this.apiClient.GET(
|
|
6207
|
+
"/api/v1/query/reference",
|
|
6208
|
+
{}
|
|
6209
|
+
);
|
|
6210
|
+
if (error) this.handleApiError("read query reference", error, response);
|
|
6211
|
+
return data;
|
|
6212
|
+
}
|
|
6056
6213
|
};
|
|
6057
6214
|
|
|
6058
6215
|
// src/client-sdk/services/triggers/triggers-api.service.ts
|
|
@@ -6232,12 +6389,12 @@ var MonitorsApiService = class {
|
|
|
6232
6389
|
constructor(config) {
|
|
6233
6390
|
var _a, _b, _c;
|
|
6234
6391
|
this.apiKey = (_c = (_b = (_a = config == null ? void 0 : config.apiKey) != null ? _a : scopedApiKey()) != null ? _b : process.env.LANGWATCH_API_KEY) != null ? _c : "";
|
|
6235
|
-
this.endpoint =
|
|
6392
|
+
this.endpoint = _chunkFUDF46YWjs.resolveEndpoint.call(void 0, config == null ? void 0 : config.endpoint);
|
|
6236
6393
|
}
|
|
6237
6394
|
async request(path2, options) {
|
|
6238
6395
|
var _a, _b;
|
|
6239
6396
|
const response = await langwatchFetch(`${this.endpoint}${path2}`, _chunkLCG5Y2EGjs.__spreadProps.call(void 0, _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {}, options), {
|
|
6240
|
-
headers: _chunkLCG5Y2EGjs.__spreadValues.call(void 0, _chunkLCG5Y2EGjs.__spreadProps.call(void 0, _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {},
|
|
6397
|
+
headers: _chunkLCG5Y2EGjs.__spreadValues.call(void 0, _chunkLCG5Y2EGjs.__spreadProps.call(void 0, _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {}, _chunk6SSJPQAWjs.buildAuthHeaders.call(void 0, { apiKey: this.apiKey })), {
|
|
6241
6398
|
"Content-Type": "application/json"
|
|
6242
6399
|
}), options == null ? void 0 : options.headers)
|
|
6243
6400
|
}));
|
|
@@ -6307,12 +6464,12 @@ var SecretsApiService = class {
|
|
|
6307
6464
|
constructor(config) {
|
|
6308
6465
|
var _a, _b, _c;
|
|
6309
6466
|
this.apiKey = (_c = (_b = (_a = config == null ? void 0 : config.apiKey) != null ? _a : scopedApiKey()) != null ? _b : process.env.LANGWATCH_API_KEY) != null ? _c : "";
|
|
6310
|
-
this.endpoint =
|
|
6467
|
+
this.endpoint = _chunkFUDF46YWjs.resolveEndpoint.call(void 0, config == null ? void 0 : config.endpoint);
|
|
6311
6468
|
}
|
|
6312
6469
|
async request(path2, options) {
|
|
6313
6470
|
var _a, _b;
|
|
6314
6471
|
const response = await langwatchFetch(`${this.endpoint}${path2}`, _chunkLCG5Y2EGjs.__spreadProps.call(void 0, _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {}, options), {
|
|
6315
|
-
headers: _chunkLCG5Y2EGjs.__spreadValues.call(void 0, _chunkLCG5Y2EGjs.__spreadProps.call(void 0, _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {},
|
|
6472
|
+
headers: _chunkLCG5Y2EGjs.__spreadValues.call(void 0, _chunkLCG5Y2EGjs.__spreadProps.call(void 0, _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {}, _chunk6SSJPQAWjs.buildAuthHeaders.call(void 0, { apiKey: this.apiKey })), {
|
|
6316
6473
|
"Content-Type": "application/json"
|
|
6317
6474
|
}), options == null ? void 0 : options.headers)
|
|
6318
6475
|
}));
|
|
@@ -6442,7 +6599,7 @@ var VirtualKeysApiError = class extends Error {
|
|
|
6442
6599
|
var VirtualKeysApiService = class {
|
|
6443
6600
|
constructor(config) {
|
|
6444
6601
|
var _a, _b, _c, _d;
|
|
6445
|
-
this.endpoint =
|
|
6602
|
+
this.endpoint = _chunkFUDF46YWjs.resolveEndpoint.call(void 0, config == null ? void 0 : config.endpoint);
|
|
6446
6603
|
this.apiKey = (_c = (_b = (_a = config == null ? void 0 : config.apiKey) != null ? _a : scopedApiKey()) != null ? _b : process.env.LANGWATCH_API_KEY) != null ? _c : "";
|
|
6447
6604
|
this.projectId = (_d = config == null ? void 0 : config.projectId) != null ? _d : process.env.LANGWATCH_PROJECT_ID;
|
|
6448
6605
|
}
|
|
@@ -6581,11 +6738,6 @@ var VirtualKeysApiService = class {
|
|
|
6581
6738
|
);
|
|
6582
6739
|
return virtual_key;
|
|
6583
6740
|
}
|
|
6584
|
-
/**
|
|
6585
|
-
* Mint a key. The response carries the secret ONCE; nothing ever serves it
|
|
6586
|
-
* again, so a create that times out is recovered with `idempotencyKey`
|
|
6587
|
-
* rather than by listing.
|
|
6588
|
-
*/
|
|
6589
6741
|
async create(input, options) {
|
|
6590
6742
|
return this.request(
|
|
6591
6743
|
"create virtual key",
|
|
@@ -6670,7 +6822,7 @@ var GatewayBudgetsApiError = class extends Error {
|
|
|
6670
6822
|
var GatewayBudgetsApiService = class {
|
|
6671
6823
|
constructor(config) {
|
|
6672
6824
|
var _a, _b, _c, _d;
|
|
6673
|
-
this.endpoint =
|
|
6825
|
+
this.endpoint = _chunkFUDF46YWjs.resolveEndpoint.call(void 0, config == null ? void 0 : config.endpoint);
|
|
6674
6826
|
this.apiKey = (_c = (_b = (_a = config == null ? void 0 : config.apiKey) != null ? _a : scopedApiKey()) != null ? _b : process.env.LANGWATCH_API_KEY) != null ? _c : "";
|
|
6675
6827
|
this.projectId = (_d = config == null ? void 0 : config.projectId) != null ? _d : process.env.LANGWATCH_PROJECT_ID;
|
|
6676
6828
|
}
|
|
@@ -6881,6 +7033,15 @@ var GatewayBudgetsApiService = class {
|
|
|
6881
7033
|
};
|
|
6882
7034
|
|
|
6883
7035
|
// src/client-sdk/services/spend-events/spend-events-api.service.ts
|
|
7036
|
+
function spendUsageFromWire(usage) {
|
|
7037
|
+
var _a, _b, _c;
|
|
7038
|
+
const wire = usage;
|
|
7039
|
+
return _chunkLCG5Y2EGjs.__spreadProps.call(void 0, _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {}, usage), {
|
|
7040
|
+
input_image_tokens: (_a = wire.input_image_tokens) != null ? _a : 0,
|
|
7041
|
+
output_image_tokens: (_b = wire.output_image_tokens) != null ? _b : 0,
|
|
7042
|
+
image_count: (_c = wire.image_count) != null ? _c : 0
|
|
7043
|
+
});
|
|
7044
|
+
}
|
|
6884
7045
|
var FILTER_PARAMS = [
|
|
6885
7046
|
["projectId", "project_id"],
|
|
6886
7047
|
["teamId", "team_id"],
|
|
@@ -6929,7 +7090,7 @@ var SpendEventsApiError = class extends Error {
|
|
|
6929
7090
|
var SpendEventsApiService = class {
|
|
6930
7091
|
constructor(config) {
|
|
6931
7092
|
var _a, _b, _c;
|
|
6932
|
-
this.endpoint =
|
|
7093
|
+
this.endpoint = _chunkFUDF46YWjs.resolveEndpoint.call(void 0, config == null ? void 0 : config.endpoint);
|
|
6933
7094
|
this.apiKey = (_c = (_b = (_a = config == null ? void 0 : config.apiKey) != null ? _a : scopedApiKey()) != null ? _b : process.env.LANGWATCH_API_KEY) != null ? _c : "";
|
|
6934
7095
|
}
|
|
6935
7096
|
async request(operation, path2, init) {
|
|
@@ -6981,10 +7142,17 @@ var SpendEventsApiService = class {
|
|
|
6981
7142
|
if (options.limit !== void 0) params.set("limit", String(options.limit));
|
|
6982
7143
|
appendSpendFilters({ params, filters: options });
|
|
6983
7144
|
const qs = params.toString() !== "" ? `?${params.toString()}` : "";
|
|
6984
|
-
|
|
7145
|
+
const page = await this.request(
|
|
6985
7146
|
"list spend events",
|
|
6986
7147
|
`/api/gateway/v1/spend-events${qs}`
|
|
6987
7148
|
);
|
|
7149
|
+
return _chunkLCG5Y2EGjs.__spreadProps.call(void 0, _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {}, page), {
|
|
7150
|
+
data: page.data.map((event) => _chunkLCG5Y2EGjs.__spreadProps.call(void 0, _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {}, event), {
|
|
7151
|
+
data: _chunkLCG5Y2EGjs.__spreadProps.call(void 0, _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {}, event.data), {
|
|
7152
|
+
usage: event.data.usage === null ? null : spendUsageFromWire(event.data.usage)
|
|
7153
|
+
})
|
|
7154
|
+
}))
|
|
7155
|
+
});
|
|
6988
7156
|
}
|
|
6989
7157
|
/**
|
|
6990
7158
|
* Every spend event in the window, one row at a time, fetching each page
|
|
@@ -7050,10 +7218,15 @@ var SpendEventsApiService = class {
|
|
|
7050
7218
|
appendSpendFilters({ params, filters: options });
|
|
7051
7219
|
if (options.cursor) params.set("cursor", options.cursor);
|
|
7052
7220
|
if (options.limit !== void 0) params.set("limit", String(options.limit));
|
|
7053
|
-
|
|
7221
|
+
const page = await this.request(
|
|
7054
7222
|
"read spend summaries",
|
|
7055
7223
|
`/api/gateway/v1/spend-summaries?${params.toString()}`
|
|
7056
7224
|
);
|
|
7225
|
+
return _chunkLCG5Y2EGjs.__spreadProps.call(void 0, _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {}, page), {
|
|
7226
|
+
data: page.data.map((row) => _chunkLCG5Y2EGjs.__spreadProps.call(void 0, _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {}, row), {
|
|
7227
|
+
usage: spendUsageFromWire(row.usage)
|
|
7228
|
+
}))
|
|
7229
|
+
});
|
|
7057
7230
|
}
|
|
7058
7231
|
/**
|
|
7059
7232
|
* Every rollup row for the window, one at a time, fetching each page only
|
|
@@ -7130,7 +7303,7 @@ var SpendEventsApiService = class {
|
|
|
7130
7303
|
"read end-user spend",
|
|
7131
7304
|
`/api/gateway/v1/end-users/${encodeURIComponent(endUserId)}/spend${qs}`
|
|
7132
7305
|
);
|
|
7133
|
-
return res.data;
|
|
7306
|
+
return _chunkLCG5Y2EGjs.__spreadProps.call(void 0, _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {}, res.data), { usage: spendUsageFromWire(res.data.usage) });
|
|
7134
7307
|
}
|
|
7135
7308
|
};
|
|
7136
7309
|
|
|
@@ -7146,7 +7319,7 @@ var WebhooksApiError = class extends Error {
|
|
|
7146
7319
|
var WebhooksApiService = class {
|
|
7147
7320
|
constructor(config) {
|
|
7148
7321
|
var _a, _b, _c;
|
|
7149
|
-
this.endpoint =
|
|
7322
|
+
this.endpoint = _chunkFUDF46YWjs.resolveEndpoint.call(void 0, config == null ? void 0 : config.endpoint);
|
|
7150
7323
|
this.apiKey = (_c = (_b = (_a = config == null ? void 0 : config.apiKey) != null ? _a : scopedApiKey()) != null ? _b : process.env.LANGWATCH_API_KEY) != null ? _c : "";
|
|
7151
7324
|
}
|
|
7152
7325
|
async request(operation, path2, init) {
|
|
@@ -7483,7 +7656,7 @@ var TeamsApiService = class {
|
|
|
7483
7656
|
constructor(config) {
|
|
7484
7657
|
_chunkLCG5Y2EGjs.__privateAdd.call(void 0, this, _request);
|
|
7485
7658
|
_chunkLCG5Y2EGjs.__privateSet.call(void 0, this, _request, createManagementRequest({
|
|
7486
|
-
endpoint:
|
|
7659
|
+
endpoint: _chunkFUDF46YWjs.resolveEndpoint.call(void 0, config == null ? void 0 : config.endpoint),
|
|
7487
7660
|
token: resolveManagementToken({ apiKey: config == null ? void 0 : config.apiKey }),
|
|
7488
7661
|
errorFactory: ({ message, operation, body }) => new TeamsApiError(message, operation, body)
|
|
7489
7662
|
}));
|
|
@@ -7570,7 +7743,7 @@ var ProjectsApiError = class extends Error {
|
|
|
7570
7743
|
var ProjectsApiService = class {
|
|
7571
7744
|
constructor(config) {
|
|
7572
7745
|
var _a, _b, _c;
|
|
7573
|
-
this.endpoint =
|
|
7746
|
+
this.endpoint = _chunkFUDF46YWjs.resolveEndpoint.call(void 0, config == null ? void 0 : config.endpoint);
|
|
7574
7747
|
this.apiKey = (_c = (_b = (_a = config == null ? void 0 : config.apiKey) != null ? _a : scopedApiKey()) != null ? _b : process.env.LANGWATCH_API_KEY) != null ? _c : "";
|
|
7575
7748
|
}
|
|
7576
7749
|
/**
|
|
@@ -7634,6 +7807,18 @@ var ProjectsApiService = class {
|
|
|
7634
7807
|
`/api/projects/${encodeURIComponent(id)}`
|
|
7635
7808
|
);
|
|
7636
7809
|
}
|
|
7810
|
+
/**
|
|
7811
|
+
* The project's ingest key. The platform hands it out only to a credential
|
|
7812
|
+
* with `project:update` on the project, so a 403 here is the answer "this
|
|
7813
|
+
* login may not", not a transport failure.
|
|
7814
|
+
*/
|
|
7815
|
+
async getApiKey(id) {
|
|
7816
|
+
const answer = await this.request(
|
|
7817
|
+
`get api key of project "${id}"`,
|
|
7818
|
+
`/api/projects/${encodeURIComponent(id)}/api-key`
|
|
7819
|
+
);
|
|
7820
|
+
return answer.apiKey;
|
|
7821
|
+
}
|
|
7637
7822
|
async create(input) {
|
|
7638
7823
|
return this.request(
|
|
7639
7824
|
"create project",
|
|
@@ -7668,7 +7853,7 @@ var TracesError = class extends Error {
|
|
|
7668
7853
|
};
|
|
7669
7854
|
|
|
7670
7855
|
// src/client-sdk/services/traces/tracing/tracer.ts
|
|
7671
|
-
var tracer3 = _chunkO4J3ZPZYjs.getLangWatchTracer.call(void 0, `${
|
|
7856
|
+
var tracer3 = _chunkO4J3ZPZYjs.getLangWatchTracer.call(void 0, `${_chunk6SSJPQAWjs.LANGWATCH_SDK_NAME_CLIENT}.traces`, _chunk6SSJPQAWjs.LANGWATCH_SDK_VERSION);
|
|
7672
7857
|
|
|
7673
7858
|
// src/client-sdk/services/traces/service.ts
|
|
7674
7859
|
var TracesService = class {
|
|
@@ -7740,7 +7925,7 @@ var LangWatch = class {
|
|
|
7740
7925
|
_chunkLCG5Y2EGjs.__privateAdd.call(void 0, this, _projects);
|
|
7741
7926
|
var _a, _b, _c;
|
|
7742
7927
|
const apiKey = (_c = (_b = (_a = options.apiKey) != null ? _a : scopedApiKey()) != null ? _b : process.env.LANGWATCH_API_KEY) != null ? _c : "";
|
|
7743
|
-
const endpoint =
|
|
7928
|
+
const endpoint = _chunkFUDF46YWjs.resolveEndpoint.call(void 0, options.endpoint);
|
|
7744
7929
|
this.config = _chunkLCG5Y2EGjs.__privateMethod.call(void 0, this, _LangWatch_instances, createInternalConfig_fn).call(this, {
|
|
7745
7930
|
apiKey,
|
|
7746
7931
|
endpoint,
|
|
@@ -7772,6 +7957,7 @@ var LangWatch = class {
|
|
|
7772
7957
|
this.scenarios = new ScenariosApiService(this.config);
|
|
7773
7958
|
this.suites = new SuitesApiService(this.config);
|
|
7774
7959
|
this.runPlans = new RunPlansApiService(this.config);
|
|
7960
|
+
this.instantEvals = new InstantEvalsApiService(this.config);
|
|
7775
7961
|
this.testSuites = new TestSuitesApiService(this.config);
|
|
7776
7962
|
this.workflows = new WorkflowsApiService(this.config);
|
|
7777
7963
|
this.agents = new AgentsApiService(this.config);
|
|
@@ -7986,5 +8172,5 @@ var logger = {
|
|
|
7986
8172
|
|
|
7987
8173
|
|
|
7988
8174
|
|
|
7989
|
-
exports.ComparisonError = ComparisonError; exports.DatasetApiError = DatasetApiError; exports.DatasetError = DatasetError; exports.DatasetNotFoundError = DatasetNotFoundError; exports.DatasetPlanLimitError = DatasetPlanLimitError; exports.DatasetValidationError = DatasetValidationError; exports.DatasetsFacade = DatasetsFacade; exports.EvaluationError = EvaluationError; exports.EvaluationsApiError = EvaluationsApiError; exports.EvaluationsFacade = EvaluationsFacade; exports.EvaluatorCallError = EvaluatorCallError; exports.EvaluatorError = EvaluatorError; exports.EvaluatorNotFoundError = EvaluatorNotFoundError; exports.EvaluatorsApiError = EvaluatorsApiError; exports.EvaluatorsApiService = EvaluatorsApiService; exports.Experiment = Experiment; exports.ExperimentApiError = ExperimentApiError; exports.ExperimentError = ExperimentError; exports.ExperimentInitError = ExperimentInitError; exports.ExperimentsFacade = ExperimentsFacade; exports.FetchPolicy = FetchPolicy; exports.FilterableBatchSpanProcessor = _chunk73QOHSHUjs.FilterableBatchSpanProcessor; exports.GatewayBudgetsApiError = GatewayBudgetsApiError; exports.GatewayBudgetsApiService = GatewayBudgetsApiService; exports.IDEMPOTENCY_KEY_HEADER = IDEMPOTENCY_KEY_HEADER; exports.IDEMPOTENT_REPLAY_HEADER = IDEMPOTENT_REPLAY_HEADER; exports.LangWatch = LangWatch; exports.LangWatchApiError = LangWatchApiError; exports.LangWatchExporter =
|
|
8175
|
+
exports.ComparisonError = ComparisonError; exports.DatasetApiError = DatasetApiError; exports.DatasetError = DatasetError; exports.DatasetNotFoundError = DatasetNotFoundError; exports.DatasetPlanLimitError = DatasetPlanLimitError; exports.DatasetValidationError = DatasetValidationError; exports.DatasetsFacade = DatasetsFacade; exports.EvaluationError = EvaluationError; exports.EvaluationsApiError = EvaluationsApiError; exports.EvaluationsFacade = EvaluationsFacade; exports.EvaluatorCallError = EvaluatorCallError; exports.EvaluatorError = EvaluatorError; exports.EvaluatorNotFoundError = EvaluatorNotFoundError; exports.EvaluatorsApiError = EvaluatorsApiError; exports.EvaluatorsApiService = EvaluatorsApiService; exports.Experiment = Experiment; exports.ExperimentApiError = ExperimentApiError; exports.ExperimentError = ExperimentError; exports.ExperimentInitError = ExperimentInitError; exports.ExperimentsFacade = ExperimentsFacade; exports.FetchPolicy = FetchPolicy; exports.FilterableBatchSpanProcessor = _chunk73QOHSHUjs.FilterableBatchSpanProcessor; exports.GatewayBudgetsApiError = GatewayBudgetsApiError; exports.GatewayBudgetsApiService = GatewayBudgetsApiService; exports.IDEMPOTENCY_KEY_HEADER = IDEMPOTENCY_KEY_HEADER; exports.IDEMPOTENT_REPLAY_HEADER = IDEMPOTENT_REPLAY_HEADER; exports.LangWatch = LangWatch; exports.LangWatchApiError = LangWatchApiError; exports.LangWatchExporter = _chunk6SSJPQAWjs.LangWatchTraceExporter; exports.LangWatchHandledError = LangWatchHandledError; exports.LangWatchRedirectError = LangWatchRedirectError; exports.ProjectsApiError = ProjectsApiError; exports.ProjectsApiService = ProjectsApiService; exports.SpendEventsApiError = SpendEventsApiError; exports.SpendEventsApiService = SpendEventsApiService; exports.TargetMetadataConflictError = TargetMetadataConflictError; exports.TeamsApiError = TeamsApiError; exports.TeamsApiService = TeamsApiService; exports.VirtualKeysApiError = VirtualKeysApiError; exports.VirtualKeysApiService = VirtualKeysApiService; exports.WEBHOOK_DELIVERY_ID_HEADER = WEBHOOK_DELIVERY_ID_HEADER; exports.WEBHOOK_EVENT_ID_HEADER = WEBHOOK_EVENT_ID_HEADER; exports.WEBHOOK_SIGNATURE_DEFAULT_TOLERANCE_SECONDS = WEBHOOK_SIGNATURE_DEFAULT_TOLERANCE_SECONDS; exports.WEBHOOK_SIGNATURE_HEADER = WEBHOOK_SIGNATURE_HEADER; exports.WebhookSignatureVerificationError = WebhookSignatureVerificationError; exports.WebhooksApiError = WebhooksApiError; exports.WebhooksApiService = WebhooksApiService; exports.attributes = _chunkLCG5Y2EGjs.attributes_exports; exports.createLangWatchFetch = createLangWatchFetch; exports.getLangWatchLogger = _chunk6SSJPQAWjs.getLangWatchLogger; exports.getLangWatchTracer = _chunkO4J3ZPZYjs.getLangWatchTracer; exports.isLangWatchHandledError = isLangWatchHandledError; exports.langwatchFetch = langwatchFetch; exports.logger = logger; exports.verifyWebhookSignature = verifyWebhookSignature;
|
|
7990
8176
|
//# sourceMappingURL=index.js.map
|