@langfuse/core 5.0.0-beta.1 → 5.0.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/index.cjs +782 -767
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1152 -1114
- package/dist/index.d.ts +1152 -1114
- package/dist/index.mjs +780 -763
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -82,14 +82,13 @@ __export(index_exports, {
|
|
|
82
82
|
getPropagatedAttributesFromContext: () => getPropagatedAttributesFromContext,
|
|
83
83
|
health: () => health_exports,
|
|
84
84
|
ingestion: () => ingestion_exports,
|
|
85
|
+
legacy: () => legacy_exports,
|
|
85
86
|
llmConnections: () => llmConnections_exports,
|
|
86
87
|
logger: () => LoggerSingleton,
|
|
87
88
|
media: () => media_exports,
|
|
88
89
|
metrics: () => metrics_exports,
|
|
89
|
-
metricsV2: () => metricsV2_exports,
|
|
90
90
|
models: () => models_exports,
|
|
91
91
|
observations: () => observations_exports,
|
|
92
|
-
observationsV2: () => observationsV2_exports,
|
|
93
92
|
opentelemetry: () => opentelemetry_exports,
|
|
94
93
|
organizations: () => organizations_exports,
|
|
95
94
|
projects: () => projects_exports,
|
|
@@ -99,9 +98,8 @@ __export(index_exports, {
|
|
|
99
98
|
resetGlobalLogger: () => resetGlobalLogger,
|
|
100
99
|
safeSetTimeout: () => safeSetTimeout,
|
|
101
100
|
scim: () => scim_exports,
|
|
102
|
-
score: () => score_exports,
|
|
103
101
|
scoreConfigs: () => scoreConfigs_exports,
|
|
104
|
-
|
|
102
|
+
scores: () => scores_exports,
|
|
105
103
|
serializeValue: () => serializeValue,
|
|
106
104
|
sessions: () => sessions_exports,
|
|
107
105
|
trace: () => trace_exports,
|
|
@@ -378,7 +376,7 @@ var resetGlobalLogger = () => {
|
|
|
378
376
|
// package.json
|
|
379
377
|
var package_default = {
|
|
380
378
|
name: "@langfuse/core",
|
|
381
|
-
version: "
|
|
379
|
+
version: "4.6.1",
|
|
382
380
|
description: "Core functions and utilities for Langfuse packages",
|
|
383
381
|
type: "module",
|
|
384
382
|
sideEffects: false,
|
|
@@ -766,6 +764,23 @@ var ObservationType = {
|
|
|
766
764
|
Guardrail: "GUARDRAIL"
|
|
767
765
|
};
|
|
768
766
|
|
|
767
|
+
// src/api/api/resources/legacy/index.ts
|
|
768
|
+
var legacy_exports = {};
|
|
769
|
+
__export(legacy_exports, {
|
|
770
|
+
metricsV1: () => metricsV1_exports,
|
|
771
|
+
observationsV1: () => observationsV1_exports,
|
|
772
|
+
scoreV1: () => scoreV1_exports
|
|
773
|
+
});
|
|
774
|
+
|
|
775
|
+
// src/api/api/resources/legacy/resources/metricsV1/index.ts
|
|
776
|
+
var metricsV1_exports = {};
|
|
777
|
+
|
|
778
|
+
// src/api/api/resources/legacy/resources/observationsV1/index.ts
|
|
779
|
+
var observationsV1_exports = {};
|
|
780
|
+
|
|
781
|
+
// src/api/api/resources/legacy/resources/scoreV1/index.ts
|
|
782
|
+
var scoreV1_exports = {};
|
|
783
|
+
|
|
769
784
|
// src/api/api/resources/llmConnections/index.ts
|
|
770
785
|
var llmConnections_exports = {};
|
|
771
786
|
__export(llmConnections_exports, {
|
|
@@ -844,18 +859,12 @@ var MediaContentType = {
|
|
|
844
859
|
ApplicationX7ZCompressed: "application/x-7z-compressed"
|
|
845
860
|
};
|
|
846
861
|
|
|
847
|
-
// src/api/api/resources/metricsV2/index.ts
|
|
848
|
-
var metricsV2_exports = {};
|
|
849
|
-
|
|
850
862
|
// src/api/api/resources/metrics/index.ts
|
|
851
863
|
var metrics_exports = {};
|
|
852
864
|
|
|
853
865
|
// src/api/api/resources/models/index.ts
|
|
854
866
|
var models_exports = {};
|
|
855
867
|
|
|
856
|
-
// src/api/api/resources/observationsV2/index.ts
|
|
857
|
-
var observationsV2_exports = {};
|
|
858
|
-
|
|
859
868
|
// src/api/api/resources/observations/index.ts
|
|
860
869
|
var observations_exports = {};
|
|
861
870
|
|
|
@@ -921,11 +930,8 @@ var scim_exports = {};
|
|
|
921
930
|
// src/api/api/resources/scoreConfigs/index.ts
|
|
922
931
|
var scoreConfigs_exports = {};
|
|
923
932
|
|
|
924
|
-
// src/api/api/resources/
|
|
925
|
-
var
|
|
926
|
-
|
|
927
|
-
// src/api/api/resources/score/index.ts
|
|
928
|
-
var score_exports = {};
|
|
933
|
+
// src/api/api/resources/scores/index.ts
|
|
934
|
+
var scores_exports = {};
|
|
929
935
|
|
|
930
936
|
// src/api/api/resources/sessions/index.ts
|
|
931
937
|
var sessions_exports = {};
|
|
@@ -5177,16 +5183,20 @@ var Ingestion = class {
|
|
|
5177
5183
|
}
|
|
5178
5184
|
};
|
|
5179
5185
|
|
|
5180
|
-
// src/api/api/resources/
|
|
5181
|
-
var
|
|
5186
|
+
// src/api/api/resources/legacy/resources/metricsV1/client/Client.ts
|
|
5187
|
+
var MetricsV1 = class {
|
|
5182
5188
|
constructor(_options) {
|
|
5183
5189
|
this._options = _options;
|
|
5184
5190
|
}
|
|
5185
5191
|
/**
|
|
5186
|
-
* Get
|
|
5192
|
+
* Get metrics from the Langfuse project using a query object.
|
|
5187
5193
|
*
|
|
5188
|
-
*
|
|
5189
|
-
*
|
|
5194
|
+
* Consider using the [v2 metrics endpoint](/api-reference#tag/metricsv2/GET/api/public/v2/metrics) for better performance.
|
|
5195
|
+
*
|
|
5196
|
+
* For more details, see the [Metrics API documentation](https://langfuse.com/docs/metrics/features/metrics-api).
|
|
5197
|
+
*
|
|
5198
|
+
* @param {LangfuseAPI.legacy.GetMetricsRequest} request
|
|
5199
|
+
* @param {MetricsV1.RequestOptions} requestOptions - Request-specific configuration.
|
|
5190
5200
|
*
|
|
5191
5201
|
* @throws {@link LangfuseAPI.Error}
|
|
5192
5202
|
* @throws {@link LangfuseAPI.UnauthorizedError}
|
|
@@ -5195,23 +5205,20 @@ var LlmConnections = class {
|
|
|
5195
5205
|
* @throws {@link LangfuseAPI.NotFoundError}
|
|
5196
5206
|
*
|
|
5197
5207
|
* @example
|
|
5198
|
-
* await client.
|
|
5208
|
+
* await client.legacy.metricsV1.metrics({
|
|
5209
|
+
* query: "query"
|
|
5210
|
+
* })
|
|
5199
5211
|
*/
|
|
5200
|
-
|
|
5212
|
+
metrics(request, requestOptions) {
|
|
5201
5213
|
return HttpResponsePromise.fromPromise(
|
|
5202
|
-
this.
|
|
5214
|
+
this.__metrics(request, requestOptions)
|
|
5203
5215
|
);
|
|
5204
5216
|
}
|
|
5205
|
-
async
|
|
5217
|
+
async __metrics(request, requestOptions) {
|
|
5206
5218
|
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
5207
|
-
const {
|
|
5219
|
+
const { query } = request;
|
|
5208
5220
|
const _queryParams = {};
|
|
5209
|
-
|
|
5210
|
-
_queryParams["page"] = page.toString();
|
|
5211
|
-
}
|
|
5212
|
-
if (limit != null) {
|
|
5213
|
-
_queryParams["limit"] = limit.toString();
|
|
5214
|
-
}
|
|
5221
|
+
_queryParams["query"] = query;
|
|
5215
5222
|
let _headers = mergeHeaders(
|
|
5216
5223
|
(_a2 = this._options) == null ? void 0 : _a2.headers,
|
|
5217
5224
|
mergeOnlyDefinedHeaders({
|
|
@@ -5225,7 +5232,7 @@ var LlmConnections = class {
|
|
|
5225
5232
|
const _response = await fetcher({
|
|
5226
5233
|
url: url_exports.join(
|
|
5227
5234
|
(_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
|
|
5228
|
-
"/api/public/
|
|
5235
|
+
"/api/public/metrics"
|
|
5229
5236
|
),
|
|
5230
5237
|
method: "GET",
|
|
5231
5238
|
headers: _headers,
|
|
@@ -5284,7 +5291,7 @@ var LlmConnections = class {
|
|
|
5284
5291
|
});
|
|
5285
5292
|
case "timeout":
|
|
5286
5293
|
throw new LangfuseAPITimeoutError(
|
|
5287
|
-
"Timeout exceeded when calling GET /api/public/
|
|
5294
|
+
"Timeout exceeded when calling GET /api/public/metrics."
|
|
5288
5295
|
);
|
|
5289
5296
|
case "unknown":
|
|
5290
5297
|
throw new LangfuseAPIError({
|
|
@@ -5293,11 +5300,29 @@ var LlmConnections = class {
|
|
|
5293
5300
|
});
|
|
5294
5301
|
}
|
|
5295
5302
|
}
|
|
5303
|
+
async _getAuthorizationHeader() {
|
|
5304
|
+
const username = await Supplier.get(this._options.username);
|
|
5305
|
+
const password = await Supplier.get(this._options.password);
|
|
5306
|
+
if (username != null && password != null) {
|
|
5307
|
+
return BasicAuth.toAuthorizationHeader({
|
|
5308
|
+
username,
|
|
5309
|
+
password
|
|
5310
|
+
});
|
|
5311
|
+
}
|
|
5312
|
+
return void 0;
|
|
5313
|
+
}
|
|
5314
|
+
};
|
|
5315
|
+
|
|
5316
|
+
// src/api/api/resources/legacy/resources/observationsV1/client/Client.ts
|
|
5317
|
+
var ObservationsV1 = class {
|
|
5318
|
+
constructor(_options) {
|
|
5319
|
+
this._options = _options;
|
|
5320
|
+
}
|
|
5296
5321
|
/**
|
|
5297
|
-
*
|
|
5322
|
+
* Get a observation
|
|
5298
5323
|
*
|
|
5299
|
-
* @param {
|
|
5300
|
-
* @param {
|
|
5324
|
+
* @param {string} observationId - The unique langfuse identifier of an observation, can be an event, span or generation
|
|
5325
|
+
* @param {ObservationsV1.RequestOptions} requestOptions - Request-specific configuration.
|
|
5301
5326
|
*
|
|
5302
5327
|
* @throws {@link LangfuseAPI.Error}
|
|
5303
5328
|
* @throws {@link LangfuseAPI.UnauthorizedError}
|
|
@@ -5306,23 +5331,14 @@ var LlmConnections = class {
|
|
|
5306
5331
|
* @throws {@link LangfuseAPI.NotFoundError}
|
|
5307
5332
|
*
|
|
5308
5333
|
* @example
|
|
5309
|
-
* await client.
|
|
5310
|
-
* provider: "provider",
|
|
5311
|
-
* adapter: "anthropic",
|
|
5312
|
-
* secretKey: "secretKey",
|
|
5313
|
-
* baseURL: undefined,
|
|
5314
|
-
* customModels: undefined,
|
|
5315
|
-
* withDefaultModels: undefined,
|
|
5316
|
-
* extraHeaders: undefined,
|
|
5317
|
-
* config: undefined
|
|
5318
|
-
* })
|
|
5334
|
+
* await client.legacy.observationsV1.get("observationId")
|
|
5319
5335
|
*/
|
|
5320
|
-
|
|
5336
|
+
get(observationId, requestOptions) {
|
|
5321
5337
|
return HttpResponsePromise.fromPromise(
|
|
5322
|
-
this.
|
|
5338
|
+
this.__get(observationId, requestOptions)
|
|
5323
5339
|
);
|
|
5324
5340
|
}
|
|
5325
|
-
async
|
|
5341
|
+
async __get(observationId, requestOptions) {
|
|
5326
5342
|
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
5327
5343
|
let _headers = mergeHeaders(
|
|
5328
5344
|
(_a2 = this._options) == null ? void 0 : _a2.headers,
|
|
@@ -5337,14 +5353,11 @@ var LlmConnections = class {
|
|
|
5337
5353
|
const _response = await fetcher({
|
|
5338
5354
|
url: url_exports.join(
|
|
5339
5355
|
(_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
|
|
5340
|
-
|
|
5356
|
+
`/api/public/observations/${encodeURIComponent(observationId)}`
|
|
5341
5357
|
),
|
|
5342
|
-
method: "
|
|
5358
|
+
method: "GET",
|
|
5343
5359
|
headers: _headers,
|
|
5344
|
-
contentType: "application/json",
|
|
5345
5360
|
queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
|
|
5346
|
-
requestType: "json",
|
|
5347
|
-
body: request,
|
|
5348
5361
|
timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
5349
5362
|
maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
|
|
5350
5363
|
abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
|
|
@@ -5399,7 +5412,7 @@ var LlmConnections = class {
|
|
|
5399
5412
|
});
|
|
5400
5413
|
case "timeout":
|
|
5401
5414
|
throw new LangfuseAPITimeoutError(
|
|
5402
|
-
"Timeout exceeded when calling
|
|
5415
|
+
"Timeout exceeded when calling GET /api/public/observations/{observationId}."
|
|
5403
5416
|
);
|
|
5404
5417
|
case "unknown":
|
|
5405
5418
|
throw new LangfuseAPIError({
|
|
@@ -5408,29 +5421,13 @@ var LlmConnections = class {
|
|
|
5408
5421
|
});
|
|
5409
5422
|
}
|
|
5410
5423
|
}
|
|
5411
|
-
async _getAuthorizationHeader() {
|
|
5412
|
-
const username = await Supplier.get(this._options.username);
|
|
5413
|
-
const password = await Supplier.get(this._options.password);
|
|
5414
|
-
if (username != null && password != null) {
|
|
5415
|
-
return BasicAuth.toAuthorizationHeader({
|
|
5416
|
-
username,
|
|
5417
|
-
password
|
|
5418
|
-
});
|
|
5419
|
-
}
|
|
5420
|
-
return void 0;
|
|
5421
|
-
}
|
|
5422
|
-
};
|
|
5423
|
-
|
|
5424
|
-
// src/api/api/resources/media/client/Client.ts
|
|
5425
|
-
var Media = class {
|
|
5426
|
-
constructor(_options) {
|
|
5427
|
-
this._options = _options;
|
|
5428
|
-
}
|
|
5429
5424
|
/**
|
|
5430
|
-
* Get a
|
|
5425
|
+
* Get a list of observations.
|
|
5431
5426
|
*
|
|
5432
|
-
*
|
|
5433
|
-
*
|
|
5427
|
+
* Consider using the [v2 observations endpoint](/api-reference#tag/observationsv2/GET/api/public/v2/observations) for cursor-based pagination and field selection.
|
|
5428
|
+
*
|
|
5429
|
+
* @param {LangfuseAPI.legacy.GetObservationsRequest} request
|
|
5430
|
+
* @param {ObservationsV1.RequestOptions} requestOptions - Request-specific configuration.
|
|
5434
5431
|
*
|
|
5435
5432
|
* @throws {@link LangfuseAPI.Error}
|
|
5436
5433
|
* @throws {@link LangfuseAPI.UnauthorizedError}
|
|
@@ -5439,15 +5436,74 @@ var Media = class {
|
|
|
5439
5436
|
* @throws {@link LangfuseAPI.NotFoundError}
|
|
5440
5437
|
*
|
|
5441
5438
|
* @example
|
|
5442
|
-
* await client.
|
|
5439
|
+
* await client.legacy.observationsV1.getMany()
|
|
5443
5440
|
*/
|
|
5444
|
-
|
|
5441
|
+
getMany(request = {}, requestOptions) {
|
|
5445
5442
|
return HttpResponsePromise.fromPromise(
|
|
5446
|
-
this.
|
|
5443
|
+
this.__getMany(request, requestOptions)
|
|
5447
5444
|
);
|
|
5448
5445
|
}
|
|
5449
|
-
async
|
|
5446
|
+
async __getMany(request = {}, requestOptions) {
|
|
5450
5447
|
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
5448
|
+
const {
|
|
5449
|
+
page,
|
|
5450
|
+
limit,
|
|
5451
|
+
name,
|
|
5452
|
+
userId,
|
|
5453
|
+
type: type_,
|
|
5454
|
+
traceId,
|
|
5455
|
+
level,
|
|
5456
|
+
parentObservationId,
|
|
5457
|
+
environment,
|
|
5458
|
+
fromStartTime,
|
|
5459
|
+
toStartTime,
|
|
5460
|
+
version,
|
|
5461
|
+
filter
|
|
5462
|
+
} = request;
|
|
5463
|
+
const _queryParams = {};
|
|
5464
|
+
if (page != null) {
|
|
5465
|
+
_queryParams["page"] = page.toString();
|
|
5466
|
+
}
|
|
5467
|
+
if (limit != null) {
|
|
5468
|
+
_queryParams["limit"] = limit.toString();
|
|
5469
|
+
}
|
|
5470
|
+
if (name != null) {
|
|
5471
|
+
_queryParams["name"] = name;
|
|
5472
|
+
}
|
|
5473
|
+
if (userId != null) {
|
|
5474
|
+
_queryParams["userId"] = userId;
|
|
5475
|
+
}
|
|
5476
|
+
if (type_ != null) {
|
|
5477
|
+
_queryParams["type"] = type_;
|
|
5478
|
+
}
|
|
5479
|
+
if (traceId != null) {
|
|
5480
|
+
_queryParams["traceId"] = traceId;
|
|
5481
|
+
}
|
|
5482
|
+
if (level != null) {
|
|
5483
|
+
_queryParams["level"] = level;
|
|
5484
|
+
}
|
|
5485
|
+
if (parentObservationId != null) {
|
|
5486
|
+
_queryParams["parentObservationId"] = parentObservationId;
|
|
5487
|
+
}
|
|
5488
|
+
if (environment != null) {
|
|
5489
|
+
if (Array.isArray(environment)) {
|
|
5490
|
+
_queryParams["environment"] = environment.map((item) => item);
|
|
5491
|
+
} else {
|
|
5492
|
+
_queryParams["environment"] = environment;
|
|
5493
|
+
}
|
|
5494
|
+
}
|
|
5495
|
+
if (fromStartTime != null) {
|
|
5496
|
+
_queryParams["fromStartTime"] = fromStartTime;
|
|
5497
|
+
}
|
|
5498
|
+
if (toStartTime != null) {
|
|
5499
|
+
_queryParams["toStartTime"] = toStartTime;
|
|
5500
|
+
}
|
|
5501
|
+
if (version != null) {
|
|
5502
|
+
_queryParams["version"] = version;
|
|
5503
|
+
}
|
|
5504
|
+
if (filter != null) {
|
|
5505
|
+
_queryParams["filter"] = filter;
|
|
5506
|
+
}
|
|
5451
5507
|
let _headers = mergeHeaders(
|
|
5452
5508
|
(_a2 = this._options) == null ? void 0 : _a2.headers,
|
|
5453
5509
|
mergeOnlyDefinedHeaders({
|
|
@@ -5461,11 +5517,11 @@ var Media = class {
|
|
|
5461
5517
|
const _response = await fetcher({
|
|
5462
5518
|
url: url_exports.join(
|
|
5463
5519
|
(_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
|
|
5464
|
-
|
|
5520
|
+
"/api/public/observations"
|
|
5465
5521
|
),
|
|
5466
5522
|
method: "GET",
|
|
5467
5523
|
headers: _headers,
|
|
5468
|
-
queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
|
|
5524
|
+
queryParameters: { ..._queryParams, ...requestOptions == null ? void 0 : requestOptions.queryParams },
|
|
5469
5525
|
timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
5470
5526
|
maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
|
|
5471
5527
|
abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
|
|
@@ -5520,7 +5576,7 @@ var Media = class {
|
|
|
5520
5576
|
});
|
|
5521
5577
|
case "timeout":
|
|
5522
5578
|
throw new LangfuseAPITimeoutError(
|
|
5523
|
-
"Timeout exceeded when calling GET /api/public/
|
|
5579
|
+
"Timeout exceeded when calling GET /api/public/observations."
|
|
5524
5580
|
);
|
|
5525
5581
|
case "unknown":
|
|
5526
5582
|
throw new LangfuseAPIError({
|
|
@@ -5529,12 +5585,29 @@ var Media = class {
|
|
|
5529
5585
|
});
|
|
5530
5586
|
}
|
|
5531
5587
|
}
|
|
5588
|
+
async _getAuthorizationHeader() {
|
|
5589
|
+
const username = await Supplier.get(this._options.username);
|
|
5590
|
+
const password = await Supplier.get(this._options.password);
|
|
5591
|
+
if (username != null && password != null) {
|
|
5592
|
+
return BasicAuth.toAuthorizationHeader({
|
|
5593
|
+
username,
|
|
5594
|
+
password
|
|
5595
|
+
});
|
|
5596
|
+
}
|
|
5597
|
+
return void 0;
|
|
5598
|
+
}
|
|
5599
|
+
};
|
|
5600
|
+
|
|
5601
|
+
// src/api/api/resources/legacy/resources/scoreV1/client/Client.ts
|
|
5602
|
+
var ScoreV1 = class {
|
|
5603
|
+
constructor(_options) {
|
|
5604
|
+
this._options = _options;
|
|
5605
|
+
}
|
|
5532
5606
|
/**
|
|
5533
|
-
*
|
|
5607
|
+
* Create a score (supports both trace and session scores)
|
|
5534
5608
|
*
|
|
5535
|
-
* @param {
|
|
5536
|
-
* @param {
|
|
5537
|
-
* @param {Media.RequestOptions} requestOptions - Request-specific configuration.
|
|
5609
|
+
* @param {LangfuseAPI.legacy.CreateScoreRequest} request
|
|
5610
|
+
* @param {ScoreV1.RequestOptions} requestOptions - Request-specific configuration.
|
|
5538
5611
|
*
|
|
5539
5612
|
* @throws {@link LangfuseAPI.Error}
|
|
5540
5613
|
* @throws {@link LangfuseAPI.UnauthorizedError}
|
|
@@ -5543,19 +5616,28 @@ var Media = class {
|
|
|
5543
5616
|
* @throws {@link LangfuseAPI.NotFoundError}
|
|
5544
5617
|
*
|
|
5545
5618
|
* @example
|
|
5546
|
-
* await client.
|
|
5547
|
-
*
|
|
5548
|
-
*
|
|
5549
|
-
*
|
|
5550
|
-
*
|
|
5619
|
+
* await client.legacy.scoreV1.create({
|
|
5620
|
+
* id: undefined,
|
|
5621
|
+
* traceId: undefined,
|
|
5622
|
+
* sessionId: undefined,
|
|
5623
|
+
* observationId: undefined,
|
|
5624
|
+
* datasetRunId: undefined,
|
|
5625
|
+
* name: "name",
|
|
5626
|
+
* value: 1.1,
|
|
5627
|
+
* comment: undefined,
|
|
5628
|
+
* metadata: undefined,
|
|
5629
|
+
* environment: undefined,
|
|
5630
|
+
* queueId: undefined,
|
|
5631
|
+
* dataType: undefined,
|
|
5632
|
+
* configId: undefined
|
|
5551
5633
|
* })
|
|
5552
5634
|
*/
|
|
5553
|
-
|
|
5635
|
+
create(request, requestOptions) {
|
|
5554
5636
|
return HttpResponsePromise.fromPromise(
|
|
5555
|
-
this.
|
|
5637
|
+
this.__create(request, requestOptions)
|
|
5556
5638
|
);
|
|
5557
5639
|
}
|
|
5558
|
-
async
|
|
5640
|
+
async __create(request, requestOptions) {
|
|
5559
5641
|
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
5560
5642
|
let _headers = mergeHeaders(
|
|
5561
5643
|
(_a2 = this._options) == null ? void 0 : _a2.headers,
|
|
@@ -5570,9 +5652,9 @@ var Media = class {
|
|
|
5570
5652
|
const _response = await fetcher({
|
|
5571
5653
|
url: url_exports.join(
|
|
5572
5654
|
(_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
|
|
5573
|
-
|
|
5655
|
+
"/api/public/scores"
|
|
5574
5656
|
),
|
|
5575
|
-
method: "
|
|
5657
|
+
method: "POST",
|
|
5576
5658
|
headers: _headers,
|
|
5577
5659
|
contentType: "application/json",
|
|
5578
5660
|
queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
|
|
@@ -5583,7 +5665,10 @@ var Media = class {
|
|
|
5583
5665
|
abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
|
|
5584
5666
|
});
|
|
5585
5667
|
if (_response.ok) {
|
|
5586
|
-
return {
|
|
5668
|
+
return {
|
|
5669
|
+
data: _response.body,
|
|
5670
|
+
rawResponse: _response.rawResponse
|
|
5671
|
+
};
|
|
5587
5672
|
}
|
|
5588
5673
|
if (_response.error.reason === "status-code") {
|
|
5589
5674
|
switch (_response.error.statusCode) {
|
|
@@ -5629,7 +5714,7 @@ var Media = class {
|
|
|
5629
5714
|
});
|
|
5630
5715
|
case "timeout":
|
|
5631
5716
|
throw new LangfuseAPITimeoutError(
|
|
5632
|
-
"Timeout exceeded when calling
|
|
5717
|
+
"Timeout exceeded when calling POST /api/public/scores."
|
|
5633
5718
|
);
|
|
5634
5719
|
case "unknown":
|
|
5635
5720
|
throw new LangfuseAPIError({
|
|
@@ -5639,10 +5724,10 @@ var Media = class {
|
|
|
5639
5724
|
}
|
|
5640
5725
|
}
|
|
5641
5726
|
/**
|
|
5642
|
-
*
|
|
5727
|
+
* Delete a score (supports both trace and session scores)
|
|
5643
5728
|
*
|
|
5644
|
-
* @param {
|
|
5645
|
-
* @param {
|
|
5729
|
+
* @param {string} scoreId - The unique langfuse identifier of a score
|
|
5730
|
+
* @param {ScoreV1.RequestOptions} requestOptions - Request-specific configuration.
|
|
5646
5731
|
*
|
|
5647
5732
|
* @throws {@link LangfuseAPI.Error}
|
|
5648
5733
|
* @throws {@link LangfuseAPI.UnauthorizedError}
|
|
@@ -5651,21 +5736,14 @@ var Media = class {
|
|
|
5651
5736
|
* @throws {@link LangfuseAPI.NotFoundError}
|
|
5652
5737
|
*
|
|
5653
5738
|
* @example
|
|
5654
|
-
* await client.
|
|
5655
|
-
* traceId: "traceId",
|
|
5656
|
-
* observationId: undefined,
|
|
5657
|
-
* contentType: "image/png",
|
|
5658
|
-
* contentLength: 1,
|
|
5659
|
-
* sha256Hash: "sha256Hash",
|
|
5660
|
-
* field: "field"
|
|
5661
|
-
* })
|
|
5739
|
+
* await client.legacy.scoreV1.delete("scoreId")
|
|
5662
5740
|
*/
|
|
5663
|
-
|
|
5741
|
+
delete(scoreId, requestOptions) {
|
|
5664
5742
|
return HttpResponsePromise.fromPromise(
|
|
5665
|
-
this.
|
|
5743
|
+
this.__delete(scoreId, requestOptions)
|
|
5666
5744
|
);
|
|
5667
5745
|
}
|
|
5668
|
-
async
|
|
5746
|
+
async __delete(scoreId, requestOptions) {
|
|
5669
5747
|
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
5670
5748
|
let _headers = mergeHeaders(
|
|
5671
5749
|
(_a2 = this._options) == null ? void 0 : _a2.headers,
|
|
@@ -5680,23 +5758,17 @@ var Media = class {
|
|
|
5680
5758
|
const _response = await fetcher({
|
|
5681
5759
|
url: url_exports.join(
|
|
5682
5760
|
(_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
|
|
5683
|
-
|
|
5761
|
+
`/api/public/scores/${encodeURIComponent(scoreId)}`
|
|
5684
5762
|
),
|
|
5685
|
-
method: "
|
|
5763
|
+
method: "DELETE",
|
|
5686
5764
|
headers: _headers,
|
|
5687
|
-
contentType: "application/json",
|
|
5688
5765
|
queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
|
|
5689
|
-
requestType: "json",
|
|
5690
|
-
body: request,
|
|
5691
5766
|
timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
5692
5767
|
maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
|
|
5693
5768
|
abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
|
|
5694
5769
|
});
|
|
5695
5770
|
if (_response.ok) {
|
|
5696
|
-
return {
|
|
5697
|
-
data: _response.body,
|
|
5698
|
-
rawResponse: _response.rawResponse
|
|
5699
|
-
};
|
|
5771
|
+
return { data: void 0, rawResponse: _response.rawResponse };
|
|
5700
5772
|
}
|
|
5701
5773
|
if (_response.error.reason === "status-code") {
|
|
5702
5774
|
switch (_response.error.statusCode) {
|
|
@@ -5742,7 +5814,7 @@ var Media = class {
|
|
|
5742
5814
|
});
|
|
5743
5815
|
case "timeout":
|
|
5744
5816
|
throw new LangfuseAPITimeoutError(
|
|
5745
|
-
"Timeout exceeded when calling
|
|
5817
|
+
"Timeout exceeded when calling DELETE /api/public/scores/{scoreId}."
|
|
5746
5818
|
);
|
|
5747
5819
|
case "unknown":
|
|
5748
5820
|
throw new LangfuseAPIError({
|
|
@@ -5764,116 +5836,35 @@ var Media = class {
|
|
|
5764
5836
|
}
|
|
5765
5837
|
};
|
|
5766
5838
|
|
|
5767
|
-
// src/api/api/resources/
|
|
5768
|
-
var
|
|
5839
|
+
// src/api/api/resources/legacy/client/Client.ts
|
|
5840
|
+
var Legacy = class {
|
|
5841
|
+
constructor(_options) {
|
|
5842
|
+
this._options = _options;
|
|
5843
|
+
}
|
|
5844
|
+
get metricsV1() {
|
|
5845
|
+
var _a2;
|
|
5846
|
+
return (_a2 = this._metricsV1) != null ? _a2 : this._metricsV1 = new MetricsV1(this._options);
|
|
5847
|
+
}
|
|
5848
|
+
get observationsV1() {
|
|
5849
|
+
var _a2;
|
|
5850
|
+
return (_a2 = this._observationsV1) != null ? _a2 : this._observationsV1 = new ObservationsV1(this._options);
|
|
5851
|
+
}
|
|
5852
|
+
get scoreV1() {
|
|
5853
|
+
var _a2;
|
|
5854
|
+
return (_a2 = this._scoreV1) != null ? _a2 : this._scoreV1 = new ScoreV1(this._options);
|
|
5855
|
+
}
|
|
5856
|
+
};
|
|
5857
|
+
|
|
5858
|
+
// src/api/api/resources/llmConnections/client/Client.ts
|
|
5859
|
+
var LlmConnections = class {
|
|
5769
5860
|
constructor(_options) {
|
|
5770
5861
|
this._options = _options;
|
|
5771
5862
|
}
|
|
5772
5863
|
/**
|
|
5773
|
-
* Get
|
|
5774
|
-
*
|
|
5775
|
-
* ## V2 Differences
|
|
5776
|
-
* - Supports `observations`, `scores-numeric`, and `scores-categorical` views only (traces view not supported)
|
|
5777
|
-
* - Direct access to tags and release fields on observations
|
|
5778
|
-
* - Backwards-compatible: traceName, traceRelease, traceVersion dimensions are still available on observations view
|
|
5779
|
-
* - High cardinality dimensions are not supported and will return a 400 error (see below)
|
|
5780
|
-
*
|
|
5781
|
-
* For more details, see the [Metrics API documentation](https://langfuse.com/docs/metrics/features/metrics-api).
|
|
5782
|
-
*
|
|
5783
|
-
* ## Available Views
|
|
5784
|
-
*
|
|
5785
|
-
* ### observations
|
|
5786
|
-
* Query observation-level data (spans, generations, events).
|
|
5787
|
-
*
|
|
5788
|
-
* **Dimensions:**
|
|
5789
|
-
* - `environment` - Deployment environment (e.g., production, staging)
|
|
5790
|
-
* - `type` - Type of observation (SPAN, GENERATION, EVENT)
|
|
5791
|
-
* - `name` - Name of the observation
|
|
5792
|
-
* - `level` - Logging level of the observation
|
|
5793
|
-
* - `version` - Version of the observation
|
|
5794
|
-
* - `tags` - User-defined tags
|
|
5795
|
-
* - `release` - Release version
|
|
5796
|
-
* - `traceName` - Name of the parent trace (backwards-compatible)
|
|
5797
|
-
* - `traceRelease` - Release version of the parent trace (backwards-compatible, maps to release)
|
|
5798
|
-
* - `traceVersion` - Version of the parent trace (backwards-compatible, maps to version)
|
|
5799
|
-
* - `providedModelName` - Name of the model used
|
|
5800
|
-
* - `promptName` - Name of the prompt used
|
|
5801
|
-
* - `promptVersion` - Version of the prompt used
|
|
5802
|
-
* - `startTimeMonth` - Month of start_time in YYYY-MM format
|
|
5803
|
-
*
|
|
5804
|
-
* **Measures:**
|
|
5805
|
-
* - `count` - Total number of observations
|
|
5806
|
-
* - `latency` - Observation latency (milliseconds)
|
|
5807
|
-
* - `streamingLatency` - Generation latency from completion start to end (milliseconds)
|
|
5808
|
-
* - `inputTokens` - Sum of input tokens consumed
|
|
5809
|
-
* - `outputTokens` - Sum of output tokens produced
|
|
5810
|
-
* - `totalTokens` - Sum of all tokens consumed
|
|
5811
|
-
* - `outputTokensPerSecond` - Output tokens per second
|
|
5812
|
-
* - `tokensPerSecond` - Total tokens per second
|
|
5813
|
-
* - `inputCost` - Input cost (USD)
|
|
5814
|
-
* - `outputCost` - Output cost (USD)
|
|
5815
|
-
* - `totalCost` - Total cost (USD)
|
|
5816
|
-
* - `timeToFirstToken` - Time to first token (milliseconds)
|
|
5817
|
-
* - `countScores` - Number of scores attached to the observation
|
|
5818
|
-
*
|
|
5819
|
-
* ### scores-numeric
|
|
5820
|
-
* Query numeric and boolean score data.
|
|
5821
|
-
*
|
|
5822
|
-
* **Dimensions:**
|
|
5823
|
-
* - `environment` - Deployment environment
|
|
5824
|
-
* - `name` - Name of the score (e.g., accuracy, toxicity)
|
|
5825
|
-
* - `source` - Origin of the score (API, ANNOTATION, EVAL)
|
|
5826
|
-
* - `dataType` - Data type (NUMERIC, BOOLEAN)
|
|
5827
|
-
* - `configId` - Identifier of the score config
|
|
5828
|
-
* - `timestampMonth` - Month in YYYY-MM format
|
|
5829
|
-
* - `timestampDay` - Day in YYYY-MM-DD format
|
|
5830
|
-
* - `value` - Numeric value of the score
|
|
5831
|
-
* - `traceName` - Name of the parent trace
|
|
5832
|
-
* - `tags` - Tags
|
|
5833
|
-
* - `traceRelease` - Release version
|
|
5834
|
-
* - `traceVersion` - Version
|
|
5835
|
-
* - `observationName` - Name of the associated observation
|
|
5836
|
-
* - `observationModelName` - Model name of the associated observation
|
|
5837
|
-
* - `observationPromptName` - Prompt name of the associated observation
|
|
5838
|
-
* - `observationPromptVersion` - Prompt version of the associated observation
|
|
5839
|
-
*
|
|
5840
|
-
* **Measures:**
|
|
5841
|
-
* - `count` - Total number of scores
|
|
5842
|
-
* - `value` - Score value (for aggregations)
|
|
5843
|
-
*
|
|
5844
|
-
* ### scores-categorical
|
|
5845
|
-
* Query categorical score data. Same dimensions as scores-numeric except uses `stringValue` instead of `value`.
|
|
5846
|
-
*
|
|
5847
|
-
* **Measures:**
|
|
5848
|
-
* - `count` - Total number of scores
|
|
5849
|
-
*
|
|
5850
|
-
* ## High Cardinality Dimensions
|
|
5851
|
-
* The following dimensions cannot be used as grouping dimensions in v2 metrics API as they can cause performance issues.
|
|
5852
|
-
* Use them in filters instead.
|
|
5853
|
-
*
|
|
5854
|
-
* **observations view:**
|
|
5855
|
-
* - `id` - Use traceId filter to narrow down results
|
|
5856
|
-
* - `traceId` - Use traceId filter instead
|
|
5857
|
-
* - `userId` - Use userId filter instead
|
|
5858
|
-
* - `sessionId` - Use sessionId filter instead
|
|
5859
|
-
* - `parentObservationId` - Use parentObservationId filter instead
|
|
5860
|
-
*
|
|
5861
|
-
* **scores-numeric / scores-categorical views:**
|
|
5862
|
-
* - `id` - Use specific filters to narrow down results
|
|
5863
|
-
* - `traceId` - Use traceId filter instead
|
|
5864
|
-
* - `userId` - Use userId filter instead
|
|
5865
|
-
* - `sessionId` - Use sessionId filter instead
|
|
5866
|
-
* - `observationId` - Use observationId filter instead
|
|
5867
|
-
*
|
|
5868
|
-
* ## Aggregations
|
|
5869
|
-
* Available aggregation functions: `sum`, `avg`, `count`, `max`, `min`, `p50`, `p75`, `p90`, `p95`, `p99`, `histogram`
|
|
5870
|
-
*
|
|
5871
|
-
* ## Time Granularities
|
|
5872
|
-
* Available granularities for timeDimension: `auto`, `minute`, `hour`, `day`, `week`, `month`
|
|
5873
|
-
* - `auto` bins the data into approximately 50 buckets based on the time range
|
|
5864
|
+
* Get all LLM connections in a project
|
|
5874
5865
|
*
|
|
5875
|
-
* @param {LangfuseAPI.
|
|
5876
|
-
* @param {
|
|
5866
|
+
* @param {LangfuseAPI.GetLlmConnectionsRequest} request
|
|
5867
|
+
* @param {LlmConnections.RequestOptions} requestOptions - Request-specific configuration.
|
|
5877
5868
|
*
|
|
5878
5869
|
* @throws {@link LangfuseAPI.Error}
|
|
5879
5870
|
* @throws {@link LangfuseAPI.UnauthorizedError}
|
|
@@ -5882,20 +5873,23 @@ var MetricsV2 = class {
|
|
|
5882
5873
|
* @throws {@link LangfuseAPI.NotFoundError}
|
|
5883
5874
|
*
|
|
5884
5875
|
* @example
|
|
5885
|
-
* await client.
|
|
5886
|
-
* query: "query"
|
|
5887
|
-
* })
|
|
5876
|
+
* await client.llmConnections.list()
|
|
5888
5877
|
*/
|
|
5889
|
-
|
|
5878
|
+
list(request = {}, requestOptions) {
|
|
5890
5879
|
return HttpResponsePromise.fromPromise(
|
|
5891
|
-
this.
|
|
5880
|
+
this.__list(request, requestOptions)
|
|
5892
5881
|
);
|
|
5893
5882
|
}
|
|
5894
|
-
async
|
|
5883
|
+
async __list(request = {}, requestOptions) {
|
|
5895
5884
|
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
5896
|
-
const {
|
|
5885
|
+
const { page, limit } = request;
|
|
5897
5886
|
const _queryParams = {};
|
|
5898
|
-
|
|
5887
|
+
if (page != null) {
|
|
5888
|
+
_queryParams["page"] = page.toString();
|
|
5889
|
+
}
|
|
5890
|
+
if (limit != null) {
|
|
5891
|
+
_queryParams["limit"] = limit.toString();
|
|
5892
|
+
}
|
|
5899
5893
|
let _headers = mergeHeaders(
|
|
5900
5894
|
(_a2 = this._options) == null ? void 0 : _a2.headers,
|
|
5901
5895
|
mergeOnlyDefinedHeaders({
|
|
@@ -5909,7 +5903,7 @@ var MetricsV2 = class {
|
|
|
5909
5903
|
const _response = await fetcher({
|
|
5910
5904
|
url: url_exports.join(
|
|
5911
5905
|
(_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
|
|
5912
|
-
"/api/public/
|
|
5906
|
+
"/api/public/llm-connections"
|
|
5913
5907
|
),
|
|
5914
5908
|
method: "GET",
|
|
5915
5909
|
headers: _headers,
|
|
@@ -5968,7 +5962,7 @@ var MetricsV2 = class {
|
|
|
5968
5962
|
});
|
|
5969
5963
|
case "timeout":
|
|
5970
5964
|
throw new LangfuseAPITimeoutError(
|
|
5971
|
-
"Timeout exceeded when calling GET /api/public/
|
|
5965
|
+
"Timeout exceeded when calling GET /api/public/llm-connections."
|
|
5972
5966
|
);
|
|
5973
5967
|
case "unknown":
|
|
5974
5968
|
throw new LangfuseAPIError({
|
|
@@ -5977,33 +5971,11 @@ var MetricsV2 = class {
|
|
|
5977
5971
|
});
|
|
5978
5972
|
}
|
|
5979
5973
|
}
|
|
5980
|
-
async _getAuthorizationHeader() {
|
|
5981
|
-
const username = await Supplier.get(this._options.username);
|
|
5982
|
-
const password = await Supplier.get(this._options.password);
|
|
5983
|
-
if (username != null && password != null) {
|
|
5984
|
-
return BasicAuth.toAuthorizationHeader({
|
|
5985
|
-
username,
|
|
5986
|
-
password
|
|
5987
|
-
});
|
|
5988
|
-
}
|
|
5989
|
-
return void 0;
|
|
5990
|
-
}
|
|
5991
|
-
};
|
|
5992
|
-
|
|
5993
|
-
// src/api/api/resources/metrics/client/Client.ts
|
|
5994
|
-
var Metrics = class {
|
|
5995
|
-
constructor(_options) {
|
|
5996
|
-
this._options = _options;
|
|
5997
|
-
}
|
|
5998
5974
|
/**
|
|
5999
|
-
*
|
|
6000
|
-
*
|
|
6001
|
-
* Consider using the [v2 metrics endpoint](/api-reference#tag/metricsv2/GET/api/public/v2/metrics) for better performance.
|
|
6002
|
-
*
|
|
6003
|
-
* For more details, see the [Metrics API documentation](https://langfuse.com/docs/metrics/features/metrics-api).
|
|
5975
|
+
* Create or update an LLM connection. The connection is upserted on provider.
|
|
6004
5976
|
*
|
|
6005
|
-
* @param {LangfuseAPI.
|
|
6006
|
-
* @param {
|
|
5977
|
+
* @param {LangfuseAPI.UpsertLlmConnectionRequest} request
|
|
5978
|
+
* @param {LlmConnections.RequestOptions} requestOptions - Request-specific configuration.
|
|
6007
5979
|
*
|
|
6008
5980
|
* @throws {@link LangfuseAPI.Error}
|
|
6009
5981
|
* @throws {@link LangfuseAPI.UnauthorizedError}
|
|
@@ -6012,20 +5984,24 @@ var Metrics = class {
|
|
|
6012
5984
|
* @throws {@link LangfuseAPI.NotFoundError}
|
|
6013
5985
|
*
|
|
6014
5986
|
* @example
|
|
6015
|
-
* await client.
|
|
6016
|
-
*
|
|
5987
|
+
* await client.llmConnections.upsert({
|
|
5988
|
+
* provider: "provider",
|
|
5989
|
+
* adapter: "anthropic",
|
|
5990
|
+
* secretKey: "secretKey",
|
|
5991
|
+
* baseURL: undefined,
|
|
5992
|
+
* customModels: undefined,
|
|
5993
|
+
* withDefaultModels: undefined,
|
|
5994
|
+
* extraHeaders: undefined,
|
|
5995
|
+
* config: undefined
|
|
6017
5996
|
* })
|
|
6018
5997
|
*/
|
|
6019
|
-
|
|
5998
|
+
upsert(request, requestOptions) {
|
|
6020
5999
|
return HttpResponsePromise.fromPromise(
|
|
6021
|
-
this.
|
|
6000
|
+
this.__upsert(request, requestOptions)
|
|
6022
6001
|
);
|
|
6023
6002
|
}
|
|
6024
|
-
async
|
|
6003
|
+
async __upsert(request, requestOptions) {
|
|
6025
6004
|
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
6026
|
-
const { query } = request;
|
|
6027
|
-
const _queryParams = {};
|
|
6028
|
-
_queryParams["query"] = query;
|
|
6029
6005
|
let _headers = mergeHeaders(
|
|
6030
6006
|
(_a2 = this._options) == null ? void 0 : _a2.headers,
|
|
6031
6007
|
mergeOnlyDefinedHeaders({
|
|
@@ -6039,11 +6015,14 @@ var Metrics = class {
|
|
|
6039
6015
|
const _response = await fetcher({
|
|
6040
6016
|
url: url_exports.join(
|
|
6041
6017
|
(_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
|
|
6042
|
-
"/api/public/
|
|
6018
|
+
"/api/public/llm-connections"
|
|
6043
6019
|
),
|
|
6044
|
-
method: "
|
|
6020
|
+
method: "PUT",
|
|
6045
6021
|
headers: _headers,
|
|
6046
|
-
|
|
6022
|
+
contentType: "application/json",
|
|
6023
|
+
queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
|
|
6024
|
+
requestType: "json",
|
|
6025
|
+
body: request,
|
|
6047
6026
|
timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
6048
6027
|
maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
|
|
6049
6028
|
abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
|
|
@@ -6098,7 +6077,7 @@ var Metrics = class {
|
|
|
6098
6077
|
});
|
|
6099
6078
|
case "timeout":
|
|
6100
6079
|
throw new LangfuseAPITimeoutError(
|
|
6101
|
-
"Timeout exceeded when calling
|
|
6080
|
+
"Timeout exceeded when calling PUT /api/public/llm-connections."
|
|
6102
6081
|
);
|
|
6103
6082
|
case "unknown":
|
|
6104
6083
|
throw new LangfuseAPIError({
|
|
@@ -6120,16 +6099,16 @@ var Metrics = class {
|
|
|
6120
6099
|
}
|
|
6121
6100
|
};
|
|
6122
6101
|
|
|
6123
|
-
// src/api/api/resources/
|
|
6124
|
-
var
|
|
6102
|
+
// src/api/api/resources/media/client/Client.ts
|
|
6103
|
+
var Media = class {
|
|
6125
6104
|
constructor(_options) {
|
|
6126
6105
|
this._options = _options;
|
|
6127
6106
|
}
|
|
6128
6107
|
/**
|
|
6129
|
-
*
|
|
6108
|
+
* Get a media record
|
|
6130
6109
|
*
|
|
6131
|
-
* @param {
|
|
6132
|
-
* @param {
|
|
6110
|
+
* @param {string} mediaId - The unique langfuse identifier of a media record
|
|
6111
|
+
* @param {Media.RequestOptions} requestOptions - Request-specific configuration.
|
|
6133
6112
|
*
|
|
6134
6113
|
* @throws {@link LangfuseAPI.Error}
|
|
6135
6114
|
* @throws {@link LangfuseAPI.UnauthorizedError}
|
|
@@ -6138,25 +6117,14 @@ var Models = class {
|
|
|
6138
6117
|
* @throws {@link LangfuseAPI.NotFoundError}
|
|
6139
6118
|
*
|
|
6140
6119
|
* @example
|
|
6141
|
-
* await client.
|
|
6142
|
-
* modelName: "modelName",
|
|
6143
|
-
* matchPattern: "matchPattern",
|
|
6144
|
-
* startDate: undefined,
|
|
6145
|
-
* unit: undefined,
|
|
6146
|
-
* inputPrice: undefined,
|
|
6147
|
-
* outputPrice: undefined,
|
|
6148
|
-
* totalPrice: undefined,
|
|
6149
|
-
* pricingTiers: undefined,
|
|
6150
|
-
* tokenizerId: undefined,
|
|
6151
|
-
* tokenizerConfig: undefined
|
|
6152
|
-
* })
|
|
6120
|
+
* await client.media.get("mediaId")
|
|
6153
6121
|
*/
|
|
6154
|
-
|
|
6122
|
+
get(mediaId, requestOptions) {
|
|
6155
6123
|
return HttpResponsePromise.fromPromise(
|
|
6156
|
-
this.
|
|
6124
|
+
this.__get(mediaId, requestOptions)
|
|
6157
6125
|
);
|
|
6158
6126
|
}
|
|
6159
|
-
async
|
|
6127
|
+
async __get(mediaId, requestOptions) {
|
|
6160
6128
|
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
6161
6129
|
let _headers = mergeHeaders(
|
|
6162
6130
|
(_a2 = this._options) == null ? void 0 : _a2.headers,
|
|
@@ -6171,14 +6139,11 @@ var Models = class {
|
|
|
6171
6139
|
const _response = await fetcher({
|
|
6172
6140
|
url: url_exports.join(
|
|
6173
6141
|
(_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
|
|
6174
|
-
|
|
6142
|
+
`/api/public/media/${encodeURIComponent(mediaId)}`
|
|
6175
6143
|
),
|
|
6176
|
-
method: "
|
|
6144
|
+
method: "GET",
|
|
6177
6145
|
headers: _headers,
|
|
6178
|
-
contentType: "application/json",
|
|
6179
6146
|
queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
|
|
6180
|
-
requestType: "json",
|
|
6181
|
-
body: request,
|
|
6182
6147
|
timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
6183
6148
|
maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
|
|
6184
6149
|
abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
|
|
@@ -6233,7 +6198,7 @@ var Models = class {
|
|
|
6233
6198
|
});
|
|
6234
6199
|
case "timeout":
|
|
6235
6200
|
throw new LangfuseAPITimeoutError(
|
|
6236
|
-
"Timeout exceeded when calling
|
|
6201
|
+
"Timeout exceeded when calling GET /api/public/media/{mediaId}."
|
|
6237
6202
|
);
|
|
6238
6203
|
case "unknown":
|
|
6239
6204
|
throw new LangfuseAPIError({
|
|
@@ -6243,10 +6208,11 @@ var Models = class {
|
|
|
6243
6208
|
}
|
|
6244
6209
|
}
|
|
6245
6210
|
/**
|
|
6246
|
-
*
|
|
6247
|
-
*
|
|
6248
|
-
* @param {
|
|
6249
|
-
* @param {
|
|
6211
|
+
* Patch a media record
|
|
6212
|
+
*
|
|
6213
|
+
* @param {string} mediaId - The unique langfuse identifier of a media record
|
|
6214
|
+
* @param {LangfuseAPI.PatchMediaBody} request
|
|
6215
|
+
* @param {Media.RequestOptions} requestOptions - Request-specific configuration.
|
|
6250
6216
|
*
|
|
6251
6217
|
* @throws {@link LangfuseAPI.Error}
|
|
6252
6218
|
* @throws {@link LangfuseAPI.UnauthorizedError}
|
|
@@ -6255,23 +6221,130 @@ var Models = class {
|
|
|
6255
6221
|
* @throws {@link LangfuseAPI.NotFoundError}
|
|
6256
6222
|
*
|
|
6257
6223
|
* @example
|
|
6258
|
-
* await client.
|
|
6224
|
+
* await client.media.patch("mediaId", {
|
|
6225
|
+
* uploadedAt: "2024-01-15T09:30:00Z",
|
|
6226
|
+
* uploadHttpStatus: 1,
|
|
6227
|
+
* uploadHttpError: undefined,
|
|
6228
|
+
* uploadTimeMs: undefined
|
|
6229
|
+
* })
|
|
6259
6230
|
*/
|
|
6260
|
-
|
|
6231
|
+
patch(mediaId, request, requestOptions) {
|
|
6261
6232
|
return HttpResponsePromise.fromPromise(
|
|
6262
|
-
this.
|
|
6233
|
+
this.__patch(mediaId, request, requestOptions)
|
|
6263
6234
|
);
|
|
6264
6235
|
}
|
|
6265
|
-
async
|
|
6236
|
+
async __patch(mediaId, request, requestOptions) {
|
|
6266
6237
|
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
|
|
6270
|
-
|
|
6238
|
+
let _headers = mergeHeaders(
|
|
6239
|
+
(_a2 = this._options) == null ? void 0 : _a2.headers,
|
|
6240
|
+
mergeOnlyDefinedHeaders({
|
|
6241
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
6242
|
+
"X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
|
|
6243
|
+
"X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
|
|
6244
|
+
"X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
|
|
6245
|
+
}),
|
|
6246
|
+
requestOptions == null ? void 0 : requestOptions.headers
|
|
6247
|
+
);
|
|
6248
|
+
const _response = await fetcher({
|
|
6249
|
+
url: url_exports.join(
|
|
6250
|
+
(_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
|
|
6251
|
+
`/api/public/media/${encodeURIComponent(mediaId)}`
|
|
6252
|
+
),
|
|
6253
|
+
method: "PATCH",
|
|
6254
|
+
headers: _headers,
|
|
6255
|
+
contentType: "application/json",
|
|
6256
|
+
queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
|
|
6257
|
+
requestType: "json",
|
|
6258
|
+
body: request,
|
|
6259
|
+
timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
6260
|
+
maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
|
|
6261
|
+
abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
|
|
6262
|
+
});
|
|
6263
|
+
if (_response.ok) {
|
|
6264
|
+
return { data: void 0, rawResponse: _response.rawResponse };
|
|
6271
6265
|
}
|
|
6272
|
-
if (
|
|
6273
|
-
|
|
6266
|
+
if (_response.error.reason === "status-code") {
|
|
6267
|
+
switch (_response.error.statusCode) {
|
|
6268
|
+
case 400:
|
|
6269
|
+
throw new Error2(
|
|
6270
|
+
_response.error.body,
|
|
6271
|
+
_response.rawResponse
|
|
6272
|
+
);
|
|
6273
|
+
case 401:
|
|
6274
|
+
throw new UnauthorizedError(
|
|
6275
|
+
_response.error.body,
|
|
6276
|
+
_response.rawResponse
|
|
6277
|
+
);
|
|
6278
|
+
case 403:
|
|
6279
|
+
throw new AccessDeniedError(
|
|
6280
|
+
_response.error.body,
|
|
6281
|
+
_response.rawResponse
|
|
6282
|
+
);
|
|
6283
|
+
case 405:
|
|
6284
|
+
throw new MethodNotAllowedError(
|
|
6285
|
+
_response.error.body,
|
|
6286
|
+
_response.rawResponse
|
|
6287
|
+
);
|
|
6288
|
+
case 404:
|
|
6289
|
+
throw new NotFoundError(
|
|
6290
|
+
_response.error.body,
|
|
6291
|
+
_response.rawResponse
|
|
6292
|
+
);
|
|
6293
|
+
default:
|
|
6294
|
+
throw new LangfuseAPIError({
|
|
6295
|
+
statusCode: _response.error.statusCode,
|
|
6296
|
+
body: _response.error.body,
|
|
6297
|
+
rawResponse: _response.rawResponse
|
|
6298
|
+
});
|
|
6299
|
+
}
|
|
6300
|
+
}
|
|
6301
|
+
switch (_response.error.reason) {
|
|
6302
|
+
case "non-json":
|
|
6303
|
+
throw new LangfuseAPIError({
|
|
6304
|
+
statusCode: _response.error.statusCode,
|
|
6305
|
+
body: _response.error.rawBody,
|
|
6306
|
+
rawResponse: _response.rawResponse
|
|
6307
|
+
});
|
|
6308
|
+
case "timeout":
|
|
6309
|
+
throw new LangfuseAPITimeoutError(
|
|
6310
|
+
"Timeout exceeded when calling PATCH /api/public/media/{mediaId}."
|
|
6311
|
+
);
|
|
6312
|
+
case "unknown":
|
|
6313
|
+
throw new LangfuseAPIError({
|
|
6314
|
+
message: _response.error.errorMessage,
|
|
6315
|
+
rawResponse: _response.rawResponse
|
|
6316
|
+
});
|
|
6274
6317
|
}
|
|
6318
|
+
}
|
|
6319
|
+
/**
|
|
6320
|
+
* Get a presigned upload URL for a media record
|
|
6321
|
+
*
|
|
6322
|
+
* @param {LangfuseAPI.GetMediaUploadUrlRequest} request
|
|
6323
|
+
* @param {Media.RequestOptions} requestOptions - Request-specific configuration.
|
|
6324
|
+
*
|
|
6325
|
+
* @throws {@link LangfuseAPI.Error}
|
|
6326
|
+
* @throws {@link LangfuseAPI.UnauthorizedError}
|
|
6327
|
+
* @throws {@link LangfuseAPI.AccessDeniedError}
|
|
6328
|
+
* @throws {@link LangfuseAPI.MethodNotAllowedError}
|
|
6329
|
+
* @throws {@link LangfuseAPI.NotFoundError}
|
|
6330
|
+
*
|
|
6331
|
+
* @example
|
|
6332
|
+
* await client.media.getUploadUrl({
|
|
6333
|
+
* traceId: "traceId",
|
|
6334
|
+
* observationId: undefined,
|
|
6335
|
+
* contentType: "image/png",
|
|
6336
|
+
* contentLength: 1,
|
|
6337
|
+
* sha256Hash: "sha256Hash",
|
|
6338
|
+
* field: "field"
|
|
6339
|
+
* })
|
|
6340
|
+
*/
|
|
6341
|
+
getUploadUrl(request, requestOptions) {
|
|
6342
|
+
return HttpResponsePromise.fromPromise(
|
|
6343
|
+
this.__getUploadUrl(request, requestOptions)
|
|
6344
|
+
);
|
|
6345
|
+
}
|
|
6346
|
+
async __getUploadUrl(request, requestOptions) {
|
|
6347
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
6275
6348
|
let _headers = mergeHeaders(
|
|
6276
6349
|
(_a2 = this._options) == null ? void 0 : _a2.headers,
|
|
6277
6350
|
mergeOnlyDefinedHeaders({
|
|
@@ -6285,7 +6358,236 @@ var Models = class {
|
|
|
6285
6358
|
const _response = await fetcher({
|
|
6286
6359
|
url: url_exports.join(
|
|
6287
6360
|
(_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
|
|
6288
|
-
"/api/public/
|
|
6361
|
+
"/api/public/media"
|
|
6362
|
+
),
|
|
6363
|
+
method: "POST",
|
|
6364
|
+
headers: _headers,
|
|
6365
|
+
contentType: "application/json",
|
|
6366
|
+
queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
|
|
6367
|
+
requestType: "json",
|
|
6368
|
+
body: request,
|
|
6369
|
+
timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
6370
|
+
maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
|
|
6371
|
+
abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
|
|
6372
|
+
});
|
|
6373
|
+
if (_response.ok) {
|
|
6374
|
+
return {
|
|
6375
|
+
data: _response.body,
|
|
6376
|
+
rawResponse: _response.rawResponse
|
|
6377
|
+
};
|
|
6378
|
+
}
|
|
6379
|
+
if (_response.error.reason === "status-code") {
|
|
6380
|
+
switch (_response.error.statusCode) {
|
|
6381
|
+
case 400:
|
|
6382
|
+
throw new Error2(
|
|
6383
|
+
_response.error.body,
|
|
6384
|
+
_response.rawResponse
|
|
6385
|
+
);
|
|
6386
|
+
case 401:
|
|
6387
|
+
throw new UnauthorizedError(
|
|
6388
|
+
_response.error.body,
|
|
6389
|
+
_response.rawResponse
|
|
6390
|
+
);
|
|
6391
|
+
case 403:
|
|
6392
|
+
throw new AccessDeniedError(
|
|
6393
|
+
_response.error.body,
|
|
6394
|
+
_response.rawResponse
|
|
6395
|
+
);
|
|
6396
|
+
case 405:
|
|
6397
|
+
throw new MethodNotAllowedError(
|
|
6398
|
+
_response.error.body,
|
|
6399
|
+
_response.rawResponse
|
|
6400
|
+
);
|
|
6401
|
+
case 404:
|
|
6402
|
+
throw new NotFoundError(
|
|
6403
|
+
_response.error.body,
|
|
6404
|
+
_response.rawResponse
|
|
6405
|
+
);
|
|
6406
|
+
default:
|
|
6407
|
+
throw new LangfuseAPIError({
|
|
6408
|
+
statusCode: _response.error.statusCode,
|
|
6409
|
+
body: _response.error.body,
|
|
6410
|
+
rawResponse: _response.rawResponse
|
|
6411
|
+
});
|
|
6412
|
+
}
|
|
6413
|
+
}
|
|
6414
|
+
switch (_response.error.reason) {
|
|
6415
|
+
case "non-json":
|
|
6416
|
+
throw new LangfuseAPIError({
|
|
6417
|
+
statusCode: _response.error.statusCode,
|
|
6418
|
+
body: _response.error.rawBody,
|
|
6419
|
+
rawResponse: _response.rawResponse
|
|
6420
|
+
});
|
|
6421
|
+
case "timeout":
|
|
6422
|
+
throw new LangfuseAPITimeoutError(
|
|
6423
|
+
"Timeout exceeded when calling POST /api/public/media."
|
|
6424
|
+
);
|
|
6425
|
+
case "unknown":
|
|
6426
|
+
throw new LangfuseAPIError({
|
|
6427
|
+
message: _response.error.errorMessage,
|
|
6428
|
+
rawResponse: _response.rawResponse
|
|
6429
|
+
});
|
|
6430
|
+
}
|
|
6431
|
+
}
|
|
6432
|
+
async _getAuthorizationHeader() {
|
|
6433
|
+
const username = await Supplier.get(this._options.username);
|
|
6434
|
+
const password = await Supplier.get(this._options.password);
|
|
6435
|
+
if (username != null && password != null) {
|
|
6436
|
+
return BasicAuth.toAuthorizationHeader({
|
|
6437
|
+
username,
|
|
6438
|
+
password
|
|
6439
|
+
});
|
|
6440
|
+
}
|
|
6441
|
+
return void 0;
|
|
6442
|
+
}
|
|
6443
|
+
};
|
|
6444
|
+
|
|
6445
|
+
// src/api/api/resources/metrics/client/Client.ts
|
|
6446
|
+
var Metrics = class {
|
|
6447
|
+
constructor(_options) {
|
|
6448
|
+
this._options = _options;
|
|
6449
|
+
}
|
|
6450
|
+
/**
|
|
6451
|
+
* Get metrics from the Langfuse project using a query object. V2 endpoint with optimized performance.
|
|
6452
|
+
*
|
|
6453
|
+
* ## V2 Differences
|
|
6454
|
+
* - Supports `observations`, `scores-numeric`, and `scores-categorical` views only (traces view not supported)
|
|
6455
|
+
* - Direct access to tags and release fields on observations
|
|
6456
|
+
* - Backwards-compatible: traceName, traceRelease, traceVersion dimensions are still available on observations view
|
|
6457
|
+
* - High cardinality dimensions are not supported and will return a 400 error (see below)
|
|
6458
|
+
*
|
|
6459
|
+
* For more details, see the [Metrics API documentation](https://langfuse.com/docs/metrics/features/metrics-api).
|
|
6460
|
+
*
|
|
6461
|
+
* ## Available Views
|
|
6462
|
+
*
|
|
6463
|
+
* ### observations
|
|
6464
|
+
* Query observation-level data (spans, generations, events).
|
|
6465
|
+
*
|
|
6466
|
+
* **Dimensions:**
|
|
6467
|
+
* - `environment` - Deployment environment (e.g., production, staging)
|
|
6468
|
+
* - `type` - Type of observation (SPAN, GENERATION, EVENT)
|
|
6469
|
+
* - `name` - Name of the observation
|
|
6470
|
+
* - `level` - Logging level of the observation
|
|
6471
|
+
* - `version` - Version of the observation
|
|
6472
|
+
* - `tags` - User-defined tags
|
|
6473
|
+
* - `release` - Release version
|
|
6474
|
+
* - `traceName` - Name of the parent trace (backwards-compatible)
|
|
6475
|
+
* - `traceRelease` - Release version of the parent trace (backwards-compatible, maps to release)
|
|
6476
|
+
* - `traceVersion` - Version of the parent trace (backwards-compatible, maps to version)
|
|
6477
|
+
* - `providedModelName` - Name of the model used
|
|
6478
|
+
* - `promptName` - Name of the prompt used
|
|
6479
|
+
* - `promptVersion` - Version of the prompt used
|
|
6480
|
+
* - `startTimeMonth` - Month of start_time in YYYY-MM format
|
|
6481
|
+
*
|
|
6482
|
+
* **Measures:**
|
|
6483
|
+
* - `count` - Total number of observations
|
|
6484
|
+
* - `latency` - Observation latency (milliseconds)
|
|
6485
|
+
* - `streamingLatency` - Generation latency from completion start to end (milliseconds)
|
|
6486
|
+
* - `inputTokens` - Sum of input tokens consumed
|
|
6487
|
+
* - `outputTokens` - Sum of output tokens produced
|
|
6488
|
+
* - `totalTokens` - Sum of all tokens consumed
|
|
6489
|
+
* - `outputTokensPerSecond` - Output tokens per second
|
|
6490
|
+
* - `tokensPerSecond` - Total tokens per second
|
|
6491
|
+
* - `inputCost` - Input cost (USD)
|
|
6492
|
+
* - `outputCost` - Output cost (USD)
|
|
6493
|
+
* - `totalCost` - Total cost (USD)
|
|
6494
|
+
* - `timeToFirstToken` - Time to first token (milliseconds)
|
|
6495
|
+
* - `countScores` - Number of scores attached to the observation
|
|
6496
|
+
*
|
|
6497
|
+
* ### scores-numeric
|
|
6498
|
+
* Query numeric and boolean score data.
|
|
6499
|
+
*
|
|
6500
|
+
* **Dimensions:**
|
|
6501
|
+
* - `environment` - Deployment environment
|
|
6502
|
+
* - `name` - Name of the score (e.g., accuracy, toxicity)
|
|
6503
|
+
* - `source` - Origin of the score (API, ANNOTATION, EVAL)
|
|
6504
|
+
* - `dataType` - Data type (NUMERIC, BOOLEAN)
|
|
6505
|
+
* - `configId` - Identifier of the score config
|
|
6506
|
+
* - `timestampMonth` - Month in YYYY-MM format
|
|
6507
|
+
* - `timestampDay` - Day in YYYY-MM-DD format
|
|
6508
|
+
* - `value` - Numeric value of the score
|
|
6509
|
+
* - `traceName` - Name of the parent trace
|
|
6510
|
+
* - `tags` - Tags
|
|
6511
|
+
* - `traceRelease` - Release version
|
|
6512
|
+
* - `traceVersion` - Version
|
|
6513
|
+
* - `observationName` - Name of the associated observation
|
|
6514
|
+
* - `observationModelName` - Model name of the associated observation
|
|
6515
|
+
* - `observationPromptName` - Prompt name of the associated observation
|
|
6516
|
+
* - `observationPromptVersion` - Prompt version of the associated observation
|
|
6517
|
+
*
|
|
6518
|
+
* **Measures:**
|
|
6519
|
+
* - `count` - Total number of scores
|
|
6520
|
+
* - `value` - Score value (for aggregations)
|
|
6521
|
+
*
|
|
6522
|
+
* ### scores-categorical
|
|
6523
|
+
* Query categorical score data. Same dimensions as scores-numeric except uses `stringValue` instead of `value`.
|
|
6524
|
+
*
|
|
6525
|
+
* **Measures:**
|
|
6526
|
+
* - `count` - Total number of scores
|
|
6527
|
+
*
|
|
6528
|
+
* ## High Cardinality Dimensions
|
|
6529
|
+
* The following dimensions cannot be used as grouping dimensions in v2 metrics API as they can cause performance issues.
|
|
6530
|
+
* Use them in filters instead.
|
|
6531
|
+
*
|
|
6532
|
+
* **observations view:**
|
|
6533
|
+
* - `id` - Use traceId filter to narrow down results
|
|
6534
|
+
* - `traceId` - Use traceId filter instead
|
|
6535
|
+
* - `userId` - Use userId filter instead
|
|
6536
|
+
* - `sessionId` - Use sessionId filter instead
|
|
6537
|
+
* - `parentObservationId` - Use parentObservationId filter instead
|
|
6538
|
+
*
|
|
6539
|
+
* **scores-numeric / scores-categorical views:**
|
|
6540
|
+
* - `id` - Use specific filters to narrow down results
|
|
6541
|
+
* - `traceId` - Use traceId filter instead
|
|
6542
|
+
* - `userId` - Use userId filter instead
|
|
6543
|
+
* - `sessionId` - Use sessionId filter instead
|
|
6544
|
+
* - `observationId` - Use observationId filter instead
|
|
6545
|
+
*
|
|
6546
|
+
* ## Aggregations
|
|
6547
|
+
* Available aggregation functions: `sum`, `avg`, `count`, `max`, `min`, `p50`, `p75`, `p90`, `p95`, `p99`, `histogram`
|
|
6548
|
+
*
|
|
6549
|
+
* ## Time Granularities
|
|
6550
|
+
* Available granularities for timeDimension: `auto`, `minute`, `hour`, `day`, `week`, `month`
|
|
6551
|
+
* - `auto` bins the data into approximately 50 buckets based on the time range
|
|
6552
|
+
*
|
|
6553
|
+
* @param {LangfuseAPI.GetMetricsV2Request} request
|
|
6554
|
+
* @param {Metrics.RequestOptions} requestOptions - Request-specific configuration.
|
|
6555
|
+
*
|
|
6556
|
+
* @throws {@link LangfuseAPI.Error}
|
|
6557
|
+
* @throws {@link LangfuseAPI.UnauthorizedError}
|
|
6558
|
+
* @throws {@link LangfuseAPI.AccessDeniedError}
|
|
6559
|
+
* @throws {@link LangfuseAPI.MethodNotAllowedError}
|
|
6560
|
+
* @throws {@link LangfuseAPI.NotFoundError}
|
|
6561
|
+
*
|
|
6562
|
+
* @example
|
|
6563
|
+
* await client.metrics.metrics({
|
|
6564
|
+
* query: "query"
|
|
6565
|
+
* })
|
|
6566
|
+
*/
|
|
6567
|
+
metrics(request, requestOptions) {
|
|
6568
|
+
return HttpResponsePromise.fromPromise(
|
|
6569
|
+
this.__metrics(request, requestOptions)
|
|
6570
|
+
);
|
|
6571
|
+
}
|
|
6572
|
+
async __metrics(request, requestOptions) {
|
|
6573
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
6574
|
+
const { query } = request;
|
|
6575
|
+
const _queryParams = {};
|
|
6576
|
+
_queryParams["query"] = query;
|
|
6577
|
+
let _headers = mergeHeaders(
|
|
6578
|
+
(_a2 = this._options) == null ? void 0 : _a2.headers,
|
|
6579
|
+
mergeOnlyDefinedHeaders({
|
|
6580
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
6581
|
+
"X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
|
|
6582
|
+
"X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
|
|
6583
|
+
"X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
|
|
6584
|
+
}),
|
|
6585
|
+
requestOptions == null ? void 0 : requestOptions.headers
|
|
6586
|
+
);
|
|
6587
|
+
const _response = await fetcher({
|
|
6588
|
+
url: url_exports.join(
|
|
6589
|
+
(_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
|
|
6590
|
+
"/api/public/v2/metrics"
|
|
6289
6591
|
),
|
|
6290
6592
|
method: "GET",
|
|
6291
6593
|
headers: _headers,
|
|
@@ -6344,7 +6646,7 @@ var Models = class {
|
|
|
6344
6646
|
});
|
|
6345
6647
|
case "timeout":
|
|
6346
6648
|
throw new LangfuseAPITimeoutError(
|
|
6347
|
-
"Timeout exceeded when calling GET /api/public/
|
|
6649
|
+
"Timeout exceeded when calling GET /api/public/v2/metrics."
|
|
6348
6650
|
);
|
|
6349
6651
|
case "unknown":
|
|
6350
6652
|
throw new LangfuseAPIError({
|
|
@@ -6353,10 +6655,28 @@ var Models = class {
|
|
|
6353
6655
|
});
|
|
6354
6656
|
}
|
|
6355
6657
|
}
|
|
6658
|
+
async _getAuthorizationHeader() {
|
|
6659
|
+
const username = await Supplier.get(this._options.username);
|
|
6660
|
+
const password = await Supplier.get(this._options.password);
|
|
6661
|
+
if (username != null && password != null) {
|
|
6662
|
+
return BasicAuth.toAuthorizationHeader({
|
|
6663
|
+
username,
|
|
6664
|
+
password
|
|
6665
|
+
});
|
|
6666
|
+
}
|
|
6667
|
+
return void 0;
|
|
6668
|
+
}
|
|
6669
|
+
};
|
|
6670
|
+
|
|
6671
|
+
// src/api/api/resources/models/client/Client.ts
|
|
6672
|
+
var Models = class {
|
|
6673
|
+
constructor(_options) {
|
|
6674
|
+
this._options = _options;
|
|
6675
|
+
}
|
|
6356
6676
|
/**
|
|
6357
|
-
*
|
|
6677
|
+
* Create a model
|
|
6358
6678
|
*
|
|
6359
|
-
* @param {
|
|
6679
|
+
* @param {LangfuseAPI.CreateModelRequest} request
|
|
6360
6680
|
* @param {Models.RequestOptions} requestOptions - Request-specific configuration.
|
|
6361
6681
|
*
|
|
6362
6682
|
* @throws {@link LangfuseAPI.Error}
|
|
@@ -6366,12 +6686,25 @@ var Models = class {
|
|
|
6366
6686
|
* @throws {@link LangfuseAPI.NotFoundError}
|
|
6367
6687
|
*
|
|
6368
6688
|
* @example
|
|
6369
|
-
* await client.models.
|
|
6689
|
+
* await client.models.create({
|
|
6690
|
+
* modelName: "modelName",
|
|
6691
|
+
* matchPattern: "matchPattern",
|
|
6692
|
+
* startDate: undefined,
|
|
6693
|
+
* unit: undefined,
|
|
6694
|
+
* inputPrice: undefined,
|
|
6695
|
+
* outputPrice: undefined,
|
|
6696
|
+
* totalPrice: undefined,
|
|
6697
|
+
* pricingTiers: undefined,
|
|
6698
|
+
* tokenizerId: undefined,
|
|
6699
|
+
* tokenizerConfig: undefined
|
|
6700
|
+
* })
|
|
6370
6701
|
*/
|
|
6371
|
-
|
|
6372
|
-
return HttpResponsePromise.fromPromise(
|
|
6702
|
+
create(request, requestOptions) {
|
|
6703
|
+
return HttpResponsePromise.fromPromise(
|
|
6704
|
+
this.__create(request, requestOptions)
|
|
6705
|
+
);
|
|
6373
6706
|
}
|
|
6374
|
-
async
|
|
6707
|
+
async __create(request, requestOptions) {
|
|
6375
6708
|
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
6376
6709
|
let _headers = mergeHeaders(
|
|
6377
6710
|
(_a2 = this._options) == null ? void 0 : _a2.headers,
|
|
@@ -6386,11 +6719,14 @@ var Models = class {
|
|
|
6386
6719
|
const _response = await fetcher({
|
|
6387
6720
|
url: url_exports.join(
|
|
6388
6721
|
(_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
|
|
6389
|
-
|
|
6722
|
+
"/api/public/models"
|
|
6390
6723
|
),
|
|
6391
|
-
method: "
|
|
6724
|
+
method: "POST",
|
|
6392
6725
|
headers: _headers,
|
|
6726
|
+
contentType: "application/json",
|
|
6393
6727
|
queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
|
|
6728
|
+
requestType: "json",
|
|
6729
|
+
body: request,
|
|
6394
6730
|
timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
6395
6731
|
maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
|
|
6396
6732
|
abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
|
|
@@ -6445,7 +6781,7 @@ var Models = class {
|
|
|
6445
6781
|
});
|
|
6446
6782
|
case "timeout":
|
|
6447
6783
|
throw new LangfuseAPITimeoutError(
|
|
6448
|
-
"Timeout exceeded when calling
|
|
6784
|
+
"Timeout exceeded when calling POST /api/public/models."
|
|
6449
6785
|
);
|
|
6450
6786
|
case "unknown":
|
|
6451
6787
|
throw new LangfuseAPIError({
|
|
@@ -6455,9 +6791,9 @@ var Models = class {
|
|
|
6455
6791
|
}
|
|
6456
6792
|
}
|
|
6457
6793
|
/**
|
|
6458
|
-
*
|
|
6794
|
+
* Get all models
|
|
6459
6795
|
*
|
|
6460
|
-
* @param {
|
|
6796
|
+
* @param {LangfuseAPI.GetModelsRequest} request
|
|
6461
6797
|
* @param {Models.RequestOptions} requestOptions - Request-specific configuration.
|
|
6462
6798
|
*
|
|
6463
6799
|
* @throws {@link LangfuseAPI.Error}
|
|
@@ -6467,15 +6803,23 @@ var Models = class {
|
|
|
6467
6803
|
* @throws {@link LangfuseAPI.NotFoundError}
|
|
6468
6804
|
*
|
|
6469
6805
|
* @example
|
|
6470
|
-
* await client.models.
|
|
6806
|
+
* await client.models.list()
|
|
6471
6807
|
*/
|
|
6472
|
-
|
|
6808
|
+
list(request = {}, requestOptions) {
|
|
6473
6809
|
return HttpResponsePromise.fromPromise(
|
|
6474
|
-
this.
|
|
6810
|
+
this.__list(request, requestOptions)
|
|
6475
6811
|
);
|
|
6476
6812
|
}
|
|
6477
|
-
async
|
|
6813
|
+
async __list(request = {}, requestOptions) {
|
|
6478
6814
|
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
6815
|
+
const { page, limit } = request;
|
|
6816
|
+
const _queryParams = {};
|
|
6817
|
+
if (page != null) {
|
|
6818
|
+
_queryParams["page"] = page.toString();
|
|
6819
|
+
}
|
|
6820
|
+
if (limit != null) {
|
|
6821
|
+
_queryParams["limit"] = limit.toString();
|
|
6822
|
+
}
|
|
6479
6823
|
let _headers = mergeHeaders(
|
|
6480
6824
|
(_a2 = this._options) == null ? void 0 : _a2.headers,
|
|
6481
6825
|
mergeOnlyDefinedHeaders({
|
|
@@ -6489,17 +6833,20 @@ var Models = class {
|
|
|
6489
6833
|
const _response = await fetcher({
|
|
6490
6834
|
url: url_exports.join(
|
|
6491
6835
|
(_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
|
|
6492
|
-
|
|
6836
|
+
"/api/public/models"
|
|
6493
6837
|
),
|
|
6494
|
-
method: "
|
|
6838
|
+
method: "GET",
|
|
6495
6839
|
headers: _headers,
|
|
6496
|
-
queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
|
|
6840
|
+
queryParameters: { ..._queryParams, ...requestOptions == null ? void 0 : requestOptions.queryParams },
|
|
6497
6841
|
timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
6498
6842
|
maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
|
|
6499
6843
|
abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
|
|
6500
6844
|
});
|
|
6501
6845
|
if (_response.ok) {
|
|
6502
|
-
return {
|
|
6846
|
+
return {
|
|
6847
|
+
data: _response.body,
|
|
6848
|
+
rawResponse: _response.rawResponse
|
|
6849
|
+
};
|
|
6503
6850
|
}
|
|
6504
6851
|
if (_response.error.reason === "status-code") {
|
|
6505
6852
|
switch (_response.error.statusCode) {
|
|
@@ -6545,7 +6892,7 @@ var Models = class {
|
|
|
6545
6892
|
});
|
|
6546
6893
|
case "timeout":
|
|
6547
6894
|
throw new LangfuseAPITimeoutError(
|
|
6548
|
-
"Timeout exceeded when calling
|
|
6895
|
+
"Timeout exceeded when calling GET /api/public/models."
|
|
6549
6896
|
);
|
|
6550
6897
|
case "unknown":
|
|
6551
6898
|
throw new LangfuseAPIError({
|
|
@@ -6554,52 +6901,11 @@ var Models = class {
|
|
|
6554
6901
|
});
|
|
6555
6902
|
}
|
|
6556
6903
|
}
|
|
6557
|
-
async _getAuthorizationHeader() {
|
|
6558
|
-
const username = await Supplier.get(this._options.username);
|
|
6559
|
-
const password = await Supplier.get(this._options.password);
|
|
6560
|
-
if (username != null && password != null) {
|
|
6561
|
-
return BasicAuth.toAuthorizationHeader({
|
|
6562
|
-
username,
|
|
6563
|
-
password
|
|
6564
|
-
});
|
|
6565
|
-
}
|
|
6566
|
-
return void 0;
|
|
6567
|
-
}
|
|
6568
|
-
};
|
|
6569
|
-
|
|
6570
|
-
// src/api/api/resources/observationsV2/client/Client.ts
|
|
6571
|
-
var ObservationsV2 = class {
|
|
6572
|
-
constructor(_options) {
|
|
6573
|
-
this._options = _options;
|
|
6574
|
-
}
|
|
6575
6904
|
/**
|
|
6576
|
-
* Get a
|
|
6577
|
-
*
|
|
6578
|
-
* ## Cursor-based Pagination
|
|
6579
|
-
* This endpoint uses cursor-based pagination for efficient traversal of large datasets.
|
|
6580
|
-
* The cursor is returned in the response metadata and should be passed in subsequent requests
|
|
6581
|
-
* to retrieve the next page of results.
|
|
6582
|
-
*
|
|
6583
|
-
* ## Field Selection
|
|
6584
|
-
* Use the `fields` parameter to control which observation fields are returned:
|
|
6585
|
-
* - `core` - Always included: id, traceId, startTime, endTime, projectId, parentObservationId, type
|
|
6586
|
-
* - `basic` - name, level, statusMessage, version, environment, bookmarked, public, userId, sessionId
|
|
6587
|
-
* - `time` - completionStartTime, createdAt, updatedAt
|
|
6588
|
-
* - `io` - input, output
|
|
6589
|
-
* - `metadata` - metadata (truncated to 200 chars by default, use `expandMetadata` to get full values)
|
|
6590
|
-
* - `model` - providedModelName, internalModelId, modelParameters
|
|
6591
|
-
* - `usage` - usageDetails, costDetails, totalCost
|
|
6592
|
-
* - `prompt` - promptId, promptName, promptVersion
|
|
6593
|
-
* - `metrics` - latency, timeToFirstToken
|
|
6594
|
-
*
|
|
6595
|
-
* If not specified, `core` and `basic` field groups are returned.
|
|
6596
|
-
*
|
|
6597
|
-
* ## Filters
|
|
6598
|
-
* Multiple filtering options are available via query parameters or the structured `filter` parameter.
|
|
6599
|
-
* When using the `filter` parameter, it takes precedence over individual query parameter filters.
|
|
6905
|
+
* Get a model
|
|
6600
6906
|
*
|
|
6601
|
-
* @param {
|
|
6602
|
-
* @param {
|
|
6907
|
+
* @param {string} id
|
|
6908
|
+
* @param {Models.RequestOptions} requestOptions - Request-specific configuration.
|
|
6603
6909
|
*
|
|
6604
6910
|
* @throws {@link LangfuseAPI.Error}
|
|
6605
6911
|
* @throws {@link LangfuseAPI.UnauthorizedError}
|
|
@@ -6608,86 +6914,13 @@ var ObservationsV2 = class {
|
|
|
6608
6914
|
* @throws {@link LangfuseAPI.NotFoundError}
|
|
6609
6915
|
*
|
|
6610
6916
|
* @example
|
|
6611
|
-
* await client.
|
|
6917
|
+
* await client.models.get("id")
|
|
6612
6918
|
*/
|
|
6613
|
-
|
|
6614
|
-
return HttpResponsePromise.fromPromise(
|
|
6615
|
-
this.__getMany(request, requestOptions)
|
|
6616
|
-
);
|
|
6919
|
+
get(id, requestOptions) {
|
|
6920
|
+
return HttpResponsePromise.fromPromise(this.__get(id, requestOptions));
|
|
6617
6921
|
}
|
|
6618
|
-
async
|
|
6922
|
+
async __get(id, requestOptions) {
|
|
6619
6923
|
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
6620
|
-
const {
|
|
6621
|
-
fields,
|
|
6622
|
-
expandMetadata,
|
|
6623
|
-
limit,
|
|
6624
|
-
cursor,
|
|
6625
|
-
parseIoAsJson,
|
|
6626
|
-
name,
|
|
6627
|
-
userId,
|
|
6628
|
-
type: type_,
|
|
6629
|
-
traceId,
|
|
6630
|
-
level,
|
|
6631
|
-
parentObservationId,
|
|
6632
|
-
environment,
|
|
6633
|
-
fromStartTime,
|
|
6634
|
-
toStartTime,
|
|
6635
|
-
version,
|
|
6636
|
-
filter
|
|
6637
|
-
} = request;
|
|
6638
|
-
const _queryParams = {};
|
|
6639
|
-
if (fields != null) {
|
|
6640
|
-
_queryParams["fields"] = fields;
|
|
6641
|
-
}
|
|
6642
|
-
if (expandMetadata != null) {
|
|
6643
|
-
_queryParams["expandMetadata"] = expandMetadata;
|
|
6644
|
-
}
|
|
6645
|
-
if (limit != null) {
|
|
6646
|
-
_queryParams["limit"] = limit.toString();
|
|
6647
|
-
}
|
|
6648
|
-
if (cursor != null) {
|
|
6649
|
-
_queryParams["cursor"] = cursor;
|
|
6650
|
-
}
|
|
6651
|
-
if (parseIoAsJson != null) {
|
|
6652
|
-
_queryParams["parseIoAsJson"] = parseIoAsJson.toString();
|
|
6653
|
-
}
|
|
6654
|
-
if (name != null) {
|
|
6655
|
-
_queryParams["name"] = name;
|
|
6656
|
-
}
|
|
6657
|
-
if (userId != null) {
|
|
6658
|
-
_queryParams["userId"] = userId;
|
|
6659
|
-
}
|
|
6660
|
-
if (type_ != null) {
|
|
6661
|
-
_queryParams["type"] = type_;
|
|
6662
|
-
}
|
|
6663
|
-
if (traceId != null) {
|
|
6664
|
-
_queryParams["traceId"] = traceId;
|
|
6665
|
-
}
|
|
6666
|
-
if (level != null) {
|
|
6667
|
-
_queryParams["level"] = level;
|
|
6668
|
-
}
|
|
6669
|
-
if (parentObservationId != null) {
|
|
6670
|
-
_queryParams["parentObservationId"] = parentObservationId;
|
|
6671
|
-
}
|
|
6672
|
-
if (environment != null) {
|
|
6673
|
-
if (Array.isArray(environment)) {
|
|
6674
|
-
_queryParams["environment"] = environment.map((item) => item);
|
|
6675
|
-
} else {
|
|
6676
|
-
_queryParams["environment"] = environment;
|
|
6677
|
-
}
|
|
6678
|
-
}
|
|
6679
|
-
if (fromStartTime != null) {
|
|
6680
|
-
_queryParams["fromStartTime"] = fromStartTime;
|
|
6681
|
-
}
|
|
6682
|
-
if (toStartTime != null) {
|
|
6683
|
-
_queryParams["toStartTime"] = toStartTime;
|
|
6684
|
-
}
|
|
6685
|
-
if (version != null) {
|
|
6686
|
-
_queryParams["version"] = version;
|
|
6687
|
-
}
|
|
6688
|
-
if (filter != null) {
|
|
6689
|
-
_queryParams["filter"] = filter;
|
|
6690
|
-
}
|
|
6691
6924
|
let _headers = mergeHeaders(
|
|
6692
6925
|
(_a2 = this._options) == null ? void 0 : _a2.headers,
|
|
6693
6926
|
mergeOnlyDefinedHeaders({
|
|
@@ -6701,11 +6934,11 @@ var ObservationsV2 = class {
|
|
|
6701
6934
|
const _response = await fetcher({
|
|
6702
6935
|
url: url_exports.join(
|
|
6703
6936
|
(_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
|
|
6704
|
-
|
|
6937
|
+
`/api/public/models/${encodeURIComponent(id)}`
|
|
6705
6938
|
),
|
|
6706
6939
|
method: "GET",
|
|
6707
6940
|
headers: _headers,
|
|
6708
|
-
queryParameters:
|
|
6941
|
+
queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
|
|
6709
6942
|
timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
6710
6943
|
maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
|
|
6711
6944
|
abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
|
|
@@ -6760,7 +6993,7 @@ var ObservationsV2 = class {
|
|
|
6760
6993
|
});
|
|
6761
6994
|
case "timeout":
|
|
6762
6995
|
throw new LangfuseAPITimeoutError(
|
|
6763
|
-
"Timeout exceeded when calling GET /api/public/
|
|
6996
|
+
"Timeout exceeded when calling GET /api/public/models/{id}."
|
|
6764
6997
|
);
|
|
6765
6998
|
case "unknown":
|
|
6766
6999
|
throw new LangfuseAPIError({
|
|
@@ -6769,29 +7002,11 @@ var ObservationsV2 = class {
|
|
|
6769
7002
|
});
|
|
6770
7003
|
}
|
|
6771
7004
|
}
|
|
6772
|
-
async _getAuthorizationHeader() {
|
|
6773
|
-
const username = await Supplier.get(this._options.username);
|
|
6774
|
-
const password = await Supplier.get(this._options.password);
|
|
6775
|
-
if (username != null && password != null) {
|
|
6776
|
-
return BasicAuth.toAuthorizationHeader({
|
|
6777
|
-
username,
|
|
6778
|
-
password
|
|
6779
|
-
});
|
|
6780
|
-
}
|
|
6781
|
-
return void 0;
|
|
6782
|
-
}
|
|
6783
|
-
};
|
|
6784
|
-
|
|
6785
|
-
// src/api/api/resources/observations/client/Client.ts
|
|
6786
|
-
var Observations = class {
|
|
6787
|
-
constructor(_options) {
|
|
6788
|
-
this._options = _options;
|
|
6789
|
-
}
|
|
6790
7005
|
/**
|
|
6791
|
-
*
|
|
7006
|
+
* Delete a model. Cannot delete models managed by Langfuse. You can create your own definition with the same modelName to override the definition though.
|
|
6792
7007
|
*
|
|
6793
|
-
* @param {string}
|
|
6794
|
-
* @param {
|
|
7008
|
+
* @param {string} id
|
|
7009
|
+
* @param {Models.RequestOptions} requestOptions - Request-specific configuration.
|
|
6795
7010
|
*
|
|
6796
7011
|
* @throws {@link LangfuseAPI.Error}
|
|
6797
7012
|
* @throws {@link LangfuseAPI.UnauthorizedError}
|
|
@@ -6800,14 +7015,14 @@ var Observations = class {
|
|
|
6800
7015
|
* @throws {@link LangfuseAPI.NotFoundError}
|
|
6801
7016
|
*
|
|
6802
7017
|
* @example
|
|
6803
|
-
* await client.
|
|
7018
|
+
* await client.models.delete("id")
|
|
6804
7019
|
*/
|
|
6805
|
-
|
|
7020
|
+
delete(id, requestOptions) {
|
|
6806
7021
|
return HttpResponsePromise.fromPromise(
|
|
6807
|
-
this.
|
|
7022
|
+
this.__delete(id, requestOptions)
|
|
6808
7023
|
);
|
|
6809
7024
|
}
|
|
6810
|
-
async
|
|
7025
|
+
async __delete(id, requestOptions) {
|
|
6811
7026
|
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
6812
7027
|
let _headers = mergeHeaders(
|
|
6813
7028
|
(_a2 = this._options) == null ? void 0 : _a2.headers,
|
|
@@ -6822,9 +7037,9 @@ var Observations = class {
|
|
|
6822
7037
|
const _response = await fetcher({
|
|
6823
7038
|
url: url_exports.join(
|
|
6824
7039
|
(_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
|
|
6825
|
-
`/api/public/
|
|
7040
|
+
`/api/public/models/${encodeURIComponent(id)}`
|
|
6826
7041
|
),
|
|
6827
|
-
method: "
|
|
7042
|
+
method: "DELETE",
|
|
6828
7043
|
headers: _headers,
|
|
6829
7044
|
queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
|
|
6830
7045
|
timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
@@ -6832,10 +7047,7 @@ var Observations = class {
|
|
|
6832
7047
|
abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
|
|
6833
7048
|
});
|
|
6834
7049
|
if (_response.ok) {
|
|
6835
|
-
return {
|
|
6836
|
-
data: _response.body,
|
|
6837
|
-
rawResponse: _response.rawResponse
|
|
6838
|
-
};
|
|
7050
|
+
return { data: void 0, rawResponse: _response.rawResponse };
|
|
6839
7051
|
}
|
|
6840
7052
|
if (_response.error.reason === "status-code") {
|
|
6841
7053
|
switch (_response.error.statusCode) {
|
|
@@ -6881,7 +7093,7 @@ var Observations = class {
|
|
|
6881
7093
|
});
|
|
6882
7094
|
case "timeout":
|
|
6883
7095
|
throw new LangfuseAPITimeoutError(
|
|
6884
|
-
"Timeout exceeded when calling
|
|
7096
|
+
"Timeout exceeded when calling DELETE /api/public/models/{id}."
|
|
6885
7097
|
);
|
|
6886
7098
|
case "unknown":
|
|
6887
7099
|
throw new LangfuseAPIError({
|
|
@@ -6890,12 +7102,51 @@ var Observations = class {
|
|
|
6890
7102
|
});
|
|
6891
7103
|
}
|
|
6892
7104
|
}
|
|
7105
|
+
async _getAuthorizationHeader() {
|
|
7106
|
+
const username = await Supplier.get(this._options.username);
|
|
7107
|
+
const password = await Supplier.get(this._options.password);
|
|
7108
|
+
if (username != null && password != null) {
|
|
7109
|
+
return BasicAuth.toAuthorizationHeader({
|
|
7110
|
+
username,
|
|
7111
|
+
password
|
|
7112
|
+
});
|
|
7113
|
+
}
|
|
7114
|
+
return void 0;
|
|
7115
|
+
}
|
|
7116
|
+
};
|
|
7117
|
+
|
|
7118
|
+
// src/api/api/resources/observations/client/Client.ts
|
|
7119
|
+
var Observations = class {
|
|
7120
|
+
constructor(_options) {
|
|
7121
|
+
this._options = _options;
|
|
7122
|
+
}
|
|
6893
7123
|
/**
|
|
6894
|
-
* Get a list of observations.
|
|
7124
|
+
* Get a list of observations with cursor-based pagination and flexible field selection.
|
|
6895
7125
|
*
|
|
6896
|
-
*
|
|
7126
|
+
* ## Cursor-based Pagination
|
|
7127
|
+
* This endpoint uses cursor-based pagination for efficient traversal of large datasets.
|
|
7128
|
+
* The cursor is returned in the response metadata and should be passed in subsequent requests
|
|
7129
|
+
* to retrieve the next page of results.
|
|
7130
|
+
*
|
|
7131
|
+
* ## Field Selection
|
|
7132
|
+
* Use the `fields` parameter to control which observation fields are returned:
|
|
7133
|
+
* - `core` - Always included: id, traceId, startTime, endTime, projectId, parentObservationId, type
|
|
7134
|
+
* - `basic` - name, level, statusMessage, version, environment, bookmarked, public, userId, sessionId
|
|
7135
|
+
* - `time` - completionStartTime, createdAt, updatedAt
|
|
7136
|
+
* - `io` - input, output
|
|
7137
|
+
* - `metadata` - metadata (truncated to 200 chars by default, use `expandMetadata` to get full values)
|
|
7138
|
+
* - `model` - providedModelName, internalModelId, modelParameters
|
|
7139
|
+
* - `usage` - usageDetails, costDetails, totalCost
|
|
7140
|
+
* - `prompt` - promptId, promptName, promptVersion
|
|
7141
|
+
* - `metrics` - latency, timeToFirstToken
|
|
7142
|
+
*
|
|
7143
|
+
* If not specified, `core` and `basic` field groups are returned.
|
|
6897
7144
|
*
|
|
6898
|
-
*
|
|
7145
|
+
* ## Filters
|
|
7146
|
+
* Multiple filtering options are available via query parameters or the structured `filter` parameter.
|
|
7147
|
+
* When using the `filter` parameter, it takes precedence over individual query parameter filters.
|
|
7148
|
+
*
|
|
7149
|
+
* @param {LangfuseAPI.GetObservationsV2Request} request
|
|
6899
7150
|
* @param {Observations.RequestOptions} requestOptions - Request-specific configuration.
|
|
6900
7151
|
*
|
|
6901
7152
|
* @throws {@link LangfuseAPI.Error}
|
|
@@ -6915,8 +7166,11 @@ var Observations = class {
|
|
|
6915
7166
|
async __getMany(request = {}, requestOptions) {
|
|
6916
7167
|
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
6917
7168
|
const {
|
|
6918
|
-
|
|
7169
|
+
fields,
|
|
7170
|
+
expandMetadata,
|
|
6919
7171
|
limit,
|
|
7172
|
+
cursor,
|
|
7173
|
+
parseIoAsJson,
|
|
6920
7174
|
name,
|
|
6921
7175
|
userId,
|
|
6922
7176
|
type: type_,
|
|
@@ -6930,12 +7184,21 @@ var Observations = class {
|
|
|
6930
7184
|
filter
|
|
6931
7185
|
} = request;
|
|
6932
7186
|
const _queryParams = {};
|
|
6933
|
-
if (
|
|
6934
|
-
_queryParams["
|
|
7187
|
+
if (fields != null) {
|
|
7188
|
+
_queryParams["fields"] = fields;
|
|
7189
|
+
}
|
|
7190
|
+
if (expandMetadata != null) {
|
|
7191
|
+
_queryParams["expandMetadata"] = expandMetadata;
|
|
6935
7192
|
}
|
|
6936
7193
|
if (limit != null) {
|
|
6937
7194
|
_queryParams["limit"] = limit.toString();
|
|
6938
7195
|
}
|
|
7196
|
+
if (cursor != null) {
|
|
7197
|
+
_queryParams["cursor"] = cursor;
|
|
7198
|
+
}
|
|
7199
|
+
if (parseIoAsJson != null) {
|
|
7200
|
+
_queryParams["parseIoAsJson"] = parseIoAsJson.toString();
|
|
7201
|
+
}
|
|
6939
7202
|
if (name != null) {
|
|
6940
7203
|
_queryParams["name"] = name;
|
|
6941
7204
|
}
|
|
@@ -6986,7 +7249,7 @@ var Observations = class {
|
|
|
6986
7249
|
const _response = await fetcher({
|
|
6987
7250
|
url: url_exports.join(
|
|
6988
7251
|
(_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
|
|
6989
|
-
"/api/public/observations"
|
|
7252
|
+
"/api/public/v2/observations"
|
|
6990
7253
|
),
|
|
6991
7254
|
method: "GET",
|
|
6992
7255
|
headers: _headers,
|
|
@@ -7045,7 +7308,7 @@ var Observations = class {
|
|
|
7045
7308
|
});
|
|
7046
7309
|
case "timeout":
|
|
7047
7310
|
throw new LangfuseAPITimeoutError(
|
|
7048
|
-
"Timeout exceeded when calling GET /api/public/observations."
|
|
7311
|
+
"Timeout exceeded when calling GET /api/public/v2/observations."
|
|
7049
7312
|
);
|
|
7050
7313
|
case "unknown":
|
|
7051
7314
|
throw new LangfuseAPIError({
|
|
@@ -10700,8 +10963,8 @@ var ScoreConfigs = class {
|
|
|
10700
10963
|
}
|
|
10701
10964
|
};
|
|
10702
10965
|
|
|
10703
|
-
// src/api/api/resources/
|
|
10704
|
-
var
|
|
10966
|
+
// src/api/api/resources/scores/client/Client.ts
|
|
10967
|
+
var Scores = class {
|
|
10705
10968
|
constructor(_options) {
|
|
10706
10969
|
this._options = _options;
|
|
10707
10970
|
}
|
|
@@ -10709,7 +10972,7 @@ var ScoreV2 = class {
|
|
|
10709
10972
|
* Get a list of scores (supports both trace and session scores)
|
|
10710
10973
|
*
|
|
10711
10974
|
* @param {LangfuseAPI.GetScoresRequest} request
|
|
10712
|
-
* @param {
|
|
10975
|
+
* @param {Scores.RequestOptions} requestOptions - Request-specific configuration.
|
|
10713
10976
|
*
|
|
10714
10977
|
* @throws {@link LangfuseAPI.Error}
|
|
10715
10978
|
* @throws {@link LangfuseAPI.UnauthorizedError}
|
|
@@ -10718,14 +10981,14 @@ var ScoreV2 = class {
|
|
|
10718
10981
|
* @throws {@link LangfuseAPI.NotFoundError}
|
|
10719
10982
|
*
|
|
10720
10983
|
* @example
|
|
10721
|
-
* await client.
|
|
10984
|
+
* await client.scores.getMany()
|
|
10722
10985
|
*/
|
|
10723
|
-
|
|
10986
|
+
getMany(request = {}, requestOptions) {
|
|
10724
10987
|
return HttpResponsePromise.fromPromise(
|
|
10725
|
-
this.
|
|
10988
|
+
this.__getMany(request, requestOptions)
|
|
10726
10989
|
);
|
|
10727
10990
|
}
|
|
10728
|
-
async
|
|
10991
|
+
async __getMany(request = {}, requestOptions) {
|
|
10729
10992
|
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
10730
10993
|
const {
|
|
10731
10994
|
page,
|
|
@@ -10907,7 +11170,7 @@ var ScoreV2 = class {
|
|
|
10907
11170
|
* Get a score (supports both trace and session scores)
|
|
10908
11171
|
*
|
|
10909
11172
|
* @param {string} scoreId - The unique langfuse identifier of a score
|
|
10910
|
-
* @param {
|
|
11173
|
+
* @param {Scores.RequestOptions} requestOptions - Request-specific configuration.
|
|
10911
11174
|
*
|
|
10912
11175
|
* @throws {@link LangfuseAPI.Error}
|
|
10913
11176
|
* @throws {@link LangfuseAPI.UnauthorizedError}
|
|
@@ -10916,7 +11179,7 @@ var ScoreV2 = class {
|
|
|
10916
11179
|
* @throws {@link LangfuseAPI.NotFoundError}
|
|
10917
11180
|
*
|
|
10918
11181
|
* @example
|
|
10919
|
-
* await client.
|
|
11182
|
+
* await client.scores.getById("scoreId")
|
|
10920
11183
|
*/
|
|
10921
11184
|
getById(scoreId, requestOptions) {
|
|
10922
11185
|
return HttpResponsePromise.fromPromise(
|
|
@@ -11019,244 +11282,6 @@ var ScoreV2 = class {
|
|
|
11019
11282
|
}
|
|
11020
11283
|
};
|
|
11021
11284
|
|
|
11022
|
-
// src/api/api/resources/score/client/Client.ts
|
|
11023
|
-
var Score = class {
|
|
11024
|
-
constructor(_options) {
|
|
11025
|
-
this._options = _options;
|
|
11026
|
-
}
|
|
11027
|
-
/**
|
|
11028
|
-
* Create a score (supports both trace and session scores)
|
|
11029
|
-
*
|
|
11030
|
-
* @param {LangfuseAPI.CreateScoreRequest} request
|
|
11031
|
-
* @param {Score.RequestOptions} requestOptions - Request-specific configuration.
|
|
11032
|
-
*
|
|
11033
|
-
* @throws {@link LangfuseAPI.Error}
|
|
11034
|
-
* @throws {@link LangfuseAPI.UnauthorizedError}
|
|
11035
|
-
* @throws {@link LangfuseAPI.AccessDeniedError}
|
|
11036
|
-
* @throws {@link LangfuseAPI.MethodNotAllowedError}
|
|
11037
|
-
* @throws {@link LangfuseAPI.NotFoundError}
|
|
11038
|
-
*
|
|
11039
|
-
* @example
|
|
11040
|
-
* await client.score.create({
|
|
11041
|
-
* id: undefined,
|
|
11042
|
-
* traceId: undefined,
|
|
11043
|
-
* sessionId: undefined,
|
|
11044
|
-
* observationId: undefined,
|
|
11045
|
-
* datasetRunId: undefined,
|
|
11046
|
-
* name: "name",
|
|
11047
|
-
* value: 1.1,
|
|
11048
|
-
* comment: undefined,
|
|
11049
|
-
* metadata: undefined,
|
|
11050
|
-
* environment: undefined,
|
|
11051
|
-
* queueId: undefined,
|
|
11052
|
-
* dataType: undefined,
|
|
11053
|
-
* configId: undefined
|
|
11054
|
-
* })
|
|
11055
|
-
*/
|
|
11056
|
-
create(request, requestOptions) {
|
|
11057
|
-
return HttpResponsePromise.fromPromise(
|
|
11058
|
-
this.__create(request, requestOptions)
|
|
11059
|
-
);
|
|
11060
|
-
}
|
|
11061
|
-
async __create(request, requestOptions) {
|
|
11062
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
11063
|
-
let _headers = mergeHeaders(
|
|
11064
|
-
(_a2 = this._options) == null ? void 0 : _a2.headers,
|
|
11065
|
-
mergeOnlyDefinedHeaders({
|
|
11066
|
-
Authorization: await this._getAuthorizationHeader(),
|
|
11067
|
-
"X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
|
|
11068
|
-
"X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
|
|
11069
|
-
"X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
|
|
11070
|
-
}),
|
|
11071
|
-
requestOptions == null ? void 0 : requestOptions.headers
|
|
11072
|
-
);
|
|
11073
|
-
const _response = await fetcher({
|
|
11074
|
-
url: url_exports.join(
|
|
11075
|
-
(_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
|
|
11076
|
-
"/api/public/scores"
|
|
11077
|
-
),
|
|
11078
|
-
method: "POST",
|
|
11079
|
-
headers: _headers,
|
|
11080
|
-
contentType: "application/json",
|
|
11081
|
-
queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
|
|
11082
|
-
requestType: "json",
|
|
11083
|
-
body: request,
|
|
11084
|
-
timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
11085
|
-
maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
|
|
11086
|
-
abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
|
|
11087
|
-
});
|
|
11088
|
-
if (_response.ok) {
|
|
11089
|
-
return {
|
|
11090
|
-
data: _response.body,
|
|
11091
|
-
rawResponse: _response.rawResponse
|
|
11092
|
-
};
|
|
11093
|
-
}
|
|
11094
|
-
if (_response.error.reason === "status-code") {
|
|
11095
|
-
switch (_response.error.statusCode) {
|
|
11096
|
-
case 400:
|
|
11097
|
-
throw new Error2(
|
|
11098
|
-
_response.error.body,
|
|
11099
|
-
_response.rawResponse
|
|
11100
|
-
);
|
|
11101
|
-
case 401:
|
|
11102
|
-
throw new UnauthorizedError(
|
|
11103
|
-
_response.error.body,
|
|
11104
|
-
_response.rawResponse
|
|
11105
|
-
);
|
|
11106
|
-
case 403:
|
|
11107
|
-
throw new AccessDeniedError(
|
|
11108
|
-
_response.error.body,
|
|
11109
|
-
_response.rawResponse
|
|
11110
|
-
);
|
|
11111
|
-
case 405:
|
|
11112
|
-
throw new MethodNotAllowedError(
|
|
11113
|
-
_response.error.body,
|
|
11114
|
-
_response.rawResponse
|
|
11115
|
-
);
|
|
11116
|
-
case 404:
|
|
11117
|
-
throw new NotFoundError(
|
|
11118
|
-
_response.error.body,
|
|
11119
|
-
_response.rawResponse
|
|
11120
|
-
);
|
|
11121
|
-
default:
|
|
11122
|
-
throw new LangfuseAPIError({
|
|
11123
|
-
statusCode: _response.error.statusCode,
|
|
11124
|
-
body: _response.error.body,
|
|
11125
|
-
rawResponse: _response.rawResponse
|
|
11126
|
-
});
|
|
11127
|
-
}
|
|
11128
|
-
}
|
|
11129
|
-
switch (_response.error.reason) {
|
|
11130
|
-
case "non-json":
|
|
11131
|
-
throw new LangfuseAPIError({
|
|
11132
|
-
statusCode: _response.error.statusCode,
|
|
11133
|
-
body: _response.error.rawBody,
|
|
11134
|
-
rawResponse: _response.rawResponse
|
|
11135
|
-
});
|
|
11136
|
-
case "timeout":
|
|
11137
|
-
throw new LangfuseAPITimeoutError(
|
|
11138
|
-
"Timeout exceeded when calling POST /api/public/scores."
|
|
11139
|
-
);
|
|
11140
|
-
case "unknown":
|
|
11141
|
-
throw new LangfuseAPIError({
|
|
11142
|
-
message: _response.error.errorMessage,
|
|
11143
|
-
rawResponse: _response.rawResponse
|
|
11144
|
-
});
|
|
11145
|
-
}
|
|
11146
|
-
}
|
|
11147
|
-
/**
|
|
11148
|
-
* Delete a score (supports both trace and session scores)
|
|
11149
|
-
*
|
|
11150
|
-
* @param {string} scoreId - The unique langfuse identifier of a score
|
|
11151
|
-
* @param {Score.RequestOptions} requestOptions - Request-specific configuration.
|
|
11152
|
-
*
|
|
11153
|
-
* @throws {@link LangfuseAPI.Error}
|
|
11154
|
-
* @throws {@link LangfuseAPI.UnauthorizedError}
|
|
11155
|
-
* @throws {@link LangfuseAPI.AccessDeniedError}
|
|
11156
|
-
* @throws {@link LangfuseAPI.MethodNotAllowedError}
|
|
11157
|
-
* @throws {@link LangfuseAPI.NotFoundError}
|
|
11158
|
-
*
|
|
11159
|
-
* @example
|
|
11160
|
-
* await client.score.delete("scoreId")
|
|
11161
|
-
*/
|
|
11162
|
-
delete(scoreId, requestOptions) {
|
|
11163
|
-
return HttpResponsePromise.fromPromise(
|
|
11164
|
-
this.__delete(scoreId, requestOptions)
|
|
11165
|
-
);
|
|
11166
|
-
}
|
|
11167
|
-
async __delete(scoreId, requestOptions) {
|
|
11168
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
11169
|
-
let _headers = mergeHeaders(
|
|
11170
|
-
(_a2 = this._options) == null ? void 0 : _a2.headers,
|
|
11171
|
-
mergeOnlyDefinedHeaders({
|
|
11172
|
-
Authorization: await this._getAuthorizationHeader(),
|
|
11173
|
-
"X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
|
|
11174
|
-
"X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
|
|
11175
|
-
"X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
|
|
11176
|
-
}),
|
|
11177
|
-
requestOptions == null ? void 0 : requestOptions.headers
|
|
11178
|
-
);
|
|
11179
|
-
const _response = await fetcher({
|
|
11180
|
-
url: url_exports.join(
|
|
11181
|
-
(_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
|
|
11182
|
-
`/api/public/scores/${encodeURIComponent(scoreId)}`
|
|
11183
|
-
),
|
|
11184
|
-
method: "DELETE",
|
|
11185
|
-
headers: _headers,
|
|
11186
|
-
queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
|
|
11187
|
-
timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
11188
|
-
maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
|
|
11189
|
-
abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
|
|
11190
|
-
});
|
|
11191
|
-
if (_response.ok) {
|
|
11192
|
-
return { data: void 0, rawResponse: _response.rawResponse };
|
|
11193
|
-
}
|
|
11194
|
-
if (_response.error.reason === "status-code") {
|
|
11195
|
-
switch (_response.error.statusCode) {
|
|
11196
|
-
case 400:
|
|
11197
|
-
throw new Error2(
|
|
11198
|
-
_response.error.body,
|
|
11199
|
-
_response.rawResponse
|
|
11200
|
-
);
|
|
11201
|
-
case 401:
|
|
11202
|
-
throw new UnauthorizedError(
|
|
11203
|
-
_response.error.body,
|
|
11204
|
-
_response.rawResponse
|
|
11205
|
-
);
|
|
11206
|
-
case 403:
|
|
11207
|
-
throw new AccessDeniedError(
|
|
11208
|
-
_response.error.body,
|
|
11209
|
-
_response.rawResponse
|
|
11210
|
-
);
|
|
11211
|
-
case 405:
|
|
11212
|
-
throw new MethodNotAllowedError(
|
|
11213
|
-
_response.error.body,
|
|
11214
|
-
_response.rawResponse
|
|
11215
|
-
);
|
|
11216
|
-
case 404:
|
|
11217
|
-
throw new NotFoundError(
|
|
11218
|
-
_response.error.body,
|
|
11219
|
-
_response.rawResponse
|
|
11220
|
-
);
|
|
11221
|
-
default:
|
|
11222
|
-
throw new LangfuseAPIError({
|
|
11223
|
-
statusCode: _response.error.statusCode,
|
|
11224
|
-
body: _response.error.body,
|
|
11225
|
-
rawResponse: _response.rawResponse
|
|
11226
|
-
});
|
|
11227
|
-
}
|
|
11228
|
-
}
|
|
11229
|
-
switch (_response.error.reason) {
|
|
11230
|
-
case "non-json":
|
|
11231
|
-
throw new LangfuseAPIError({
|
|
11232
|
-
statusCode: _response.error.statusCode,
|
|
11233
|
-
body: _response.error.rawBody,
|
|
11234
|
-
rawResponse: _response.rawResponse
|
|
11235
|
-
});
|
|
11236
|
-
case "timeout":
|
|
11237
|
-
throw new LangfuseAPITimeoutError(
|
|
11238
|
-
"Timeout exceeded when calling DELETE /api/public/scores/{scoreId}."
|
|
11239
|
-
);
|
|
11240
|
-
case "unknown":
|
|
11241
|
-
throw new LangfuseAPIError({
|
|
11242
|
-
message: _response.error.errorMessage,
|
|
11243
|
-
rawResponse: _response.rawResponse
|
|
11244
|
-
});
|
|
11245
|
-
}
|
|
11246
|
-
}
|
|
11247
|
-
async _getAuthorizationHeader() {
|
|
11248
|
-
const username = await Supplier.get(this._options.username);
|
|
11249
|
-
const password = await Supplier.get(this._options.password);
|
|
11250
|
-
if (username != null && password != null) {
|
|
11251
|
-
return BasicAuth.toAuthorizationHeader({
|
|
11252
|
-
username,
|
|
11253
|
-
password
|
|
11254
|
-
});
|
|
11255
|
-
}
|
|
11256
|
-
return void 0;
|
|
11257
|
-
}
|
|
11258
|
-
};
|
|
11259
|
-
|
|
11260
11285
|
// src/api/api/resources/sessions/client/Client.ts
|
|
11261
11286
|
var Sessions = class {
|
|
11262
11287
|
constructor(_options) {
|
|
@@ -12053,6 +12078,10 @@ var LangfuseAPIClient = class {
|
|
|
12053
12078
|
var _a2;
|
|
12054
12079
|
return (_a2 = this._ingestion) != null ? _a2 : this._ingestion = new Ingestion(this._options);
|
|
12055
12080
|
}
|
|
12081
|
+
get legacy() {
|
|
12082
|
+
var _a2;
|
|
12083
|
+
return (_a2 = this._legacy) != null ? _a2 : this._legacy = new Legacy(this._options);
|
|
12084
|
+
}
|
|
12056
12085
|
get llmConnections() {
|
|
12057
12086
|
var _a2;
|
|
12058
12087
|
return (_a2 = this._llmConnections) != null ? _a2 : this._llmConnections = new LlmConnections(this._options);
|
|
@@ -12061,10 +12090,6 @@ var LangfuseAPIClient = class {
|
|
|
12061
12090
|
var _a2;
|
|
12062
12091
|
return (_a2 = this._media) != null ? _a2 : this._media = new Media(this._options);
|
|
12063
12092
|
}
|
|
12064
|
-
get metricsV2() {
|
|
12065
|
-
var _a2;
|
|
12066
|
-
return (_a2 = this._metricsV2) != null ? _a2 : this._metricsV2 = new MetricsV2(this._options);
|
|
12067
|
-
}
|
|
12068
12093
|
get metrics() {
|
|
12069
12094
|
var _a2;
|
|
12070
12095
|
return (_a2 = this._metrics) != null ? _a2 : this._metrics = new Metrics(this._options);
|
|
@@ -12073,10 +12098,6 @@ var LangfuseAPIClient = class {
|
|
|
12073
12098
|
var _a2;
|
|
12074
12099
|
return (_a2 = this._models) != null ? _a2 : this._models = new Models(this._options);
|
|
12075
12100
|
}
|
|
12076
|
-
get observationsV2() {
|
|
12077
|
-
var _a2;
|
|
12078
|
-
return (_a2 = this._observationsV2) != null ? _a2 : this._observationsV2 = new ObservationsV2(this._options);
|
|
12079
|
-
}
|
|
12080
12101
|
get observations() {
|
|
12081
12102
|
var _a2;
|
|
12082
12103
|
return (_a2 = this._observations) != null ? _a2 : this._observations = new Observations(this._options);
|
|
@@ -12109,13 +12130,9 @@ var LangfuseAPIClient = class {
|
|
|
12109
12130
|
var _a2;
|
|
12110
12131
|
return (_a2 = this._scoreConfigs) != null ? _a2 : this._scoreConfigs = new ScoreConfigs(this._options);
|
|
12111
12132
|
}
|
|
12112
|
-
get
|
|
12113
|
-
var _a2;
|
|
12114
|
-
return (_a2 = this._scoreV2) != null ? _a2 : this._scoreV2 = new ScoreV2(this._options);
|
|
12115
|
-
}
|
|
12116
|
-
get score() {
|
|
12133
|
+
get scores() {
|
|
12117
12134
|
var _a2;
|
|
12118
|
-
return (_a2 = this.
|
|
12135
|
+
return (_a2 = this._scores) != null ? _a2 : this._scores = new Scores(this._options);
|
|
12119
12136
|
}
|
|
12120
12137
|
get sessions() {
|
|
12121
12138
|
var _a2;
|
|
@@ -12749,14 +12766,13 @@ function getSpanKeyFromBaggageKey(baggageKey) {
|
|
|
12749
12766
|
getPropagatedAttributesFromContext,
|
|
12750
12767
|
health,
|
|
12751
12768
|
ingestion,
|
|
12769
|
+
legacy,
|
|
12752
12770
|
llmConnections,
|
|
12753
12771
|
logger,
|
|
12754
12772
|
media,
|
|
12755
12773
|
metrics,
|
|
12756
|
-
metricsV2,
|
|
12757
12774
|
models,
|
|
12758
12775
|
observations,
|
|
12759
|
-
observationsV2,
|
|
12760
12776
|
opentelemetry,
|
|
12761
12777
|
organizations,
|
|
12762
12778
|
projects,
|
|
@@ -12766,9 +12782,8 @@ function getSpanKeyFromBaggageKey(baggageKey) {
|
|
|
12766
12782
|
resetGlobalLogger,
|
|
12767
12783
|
safeSetTimeout,
|
|
12768
12784
|
scim,
|
|
12769
|
-
score,
|
|
12770
12785
|
scoreConfigs,
|
|
12771
|
-
|
|
12786
|
+
scores,
|
|
12772
12787
|
serializeValue,
|
|
12773
12788
|
sessions,
|
|
12774
12789
|
trace,
|