@langfuse/core 5.0.0-beta.0 → 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.mjs CHANGED
@@ -661,6 +661,23 @@ var ObservationType = {
661
661
  Guardrail: "GUARDRAIL"
662
662
  };
663
663
 
664
+ // src/api/api/resources/legacy/index.ts
665
+ var legacy_exports = {};
666
+ __export(legacy_exports, {
667
+ metricsV1: () => metricsV1_exports,
668
+ observationsV1: () => observationsV1_exports,
669
+ scoreV1: () => scoreV1_exports
670
+ });
671
+
672
+ // src/api/api/resources/legacy/resources/metricsV1/index.ts
673
+ var metricsV1_exports = {};
674
+
675
+ // src/api/api/resources/legacy/resources/observationsV1/index.ts
676
+ var observationsV1_exports = {};
677
+
678
+ // src/api/api/resources/legacy/resources/scoreV1/index.ts
679
+ var scoreV1_exports = {};
680
+
664
681
  // src/api/api/resources/llmConnections/index.ts
665
682
  var llmConnections_exports = {};
666
683
  __export(llmConnections_exports, {
@@ -739,18 +756,12 @@ var MediaContentType = {
739
756
  ApplicationX7ZCompressed: "application/x-7z-compressed"
740
757
  };
741
758
 
742
- // src/api/api/resources/metricsV2/index.ts
743
- var metricsV2_exports = {};
744
-
745
759
  // src/api/api/resources/metrics/index.ts
746
760
  var metrics_exports = {};
747
761
 
748
762
  // src/api/api/resources/models/index.ts
749
763
  var models_exports = {};
750
764
 
751
- // src/api/api/resources/observationsV2/index.ts
752
- var observationsV2_exports = {};
753
-
754
765
  // src/api/api/resources/observations/index.ts
755
766
  var observations_exports = {};
756
767
 
@@ -816,11 +827,8 @@ var scim_exports = {};
816
827
  // src/api/api/resources/scoreConfigs/index.ts
817
828
  var scoreConfigs_exports = {};
818
829
 
819
- // src/api/api/resources/scoreV2/index.ts
820
- var scoreV2_exports = {};
821
-
822
- // src/api/api/resources/score/index.ts
823
- var score_exports = {};
830
+ // src/api/api/resources/scores/index.ts
831
+ var scores_exports = {};
824
832
 
825
833
  // src/api/api/resources/sessions/index.ts
826
834
  var sessions_exports = {};
@@ -5072,16 +5080,20 @@ var Ingestion = class {
5072
5080
  }
5073
5081
  };
5074
5082
 
5075
- // src/api/api/resources/llmConnections/client/Client.ts
5076
- var LlmConnections = class {
5083
+ // src/api/api/resources/legacy/resources/metricsV1/client/Client.ts
5084
+ var MetricsV1 = class {
5077
5085
  constructor(_options) {
5078
5086
  this._options = _options;
5079
5087
  }
5080
5088
  /**
5081
- * Get all LLM connections in a project
5089
+ * Get metrics from the Langfuse project using a query object.
5082
5090
  *
5083
- * @param {LangfuseAPI.GetLlmConnectionsRequest} request
5084
- * @param {LlmConnections.RequestOptions} requestOptions - Request-specific configuration.
5091
+ * Consider using the [v2 metrics endpoint](/api-reference#tag/metricsv2/GET/api/public/v2/metrics) for better performance.
5092
+ *
5093
+ * For more details, see the [Metrics API documentation](https://langfuse.com/docs/metrics/features/metrics-api).
5094
+ *
5095
+ * @param {LangfuseAPI.legacy.GetMetricsRequest} request
5096
+ * @param {MetricsV1.RequestOptions} requestOptions - Request-specific configuration.
5085
5097
  *
5086
5098
  * @throws {@link LangfuseAPI.Error}
5087
5099
  * @throws {@link LangfuseAPI.UnauthorizedError}
@@ -5090,23 +5102,20 @@ var LlmConnections = class {
5090
5102
  * @throws {@link LangfuseAPI.NotFoundError}
5091
5103
  *
5092
5104
  * @example
5093
- * await client.llmConnections.list()
5105
+ * await client.legacy.metricsV1.metrics({
5106
+ * query: "query"
5107
+ * })
5094
5108
  */
5095
- list(request = {}, requestOptions) {
5109
+ metrics(request, requestOptions) {
5096
5110
  return HttpResponsePromise.fromPromise(
5097
- this.__list(request, requestOptions)
5111
+ this.__metrics(request, requestOptions)
5098
5112
  );
5099
5113
  }
5100
- async __list(request = {}, requestOptions) {
5114
+ async __metrics(request, requestOptions) {
5101
5115
  var _a2, _b, _c, _d, _e, _f, _g, _h;
5102
- const { page, limit } = request;
5116
+ const { query } = request;
5103
5117
  const _queryParams = {};
5104
- if (page != null) {
5105
- _queryParams["page"] = page.toString();
5106
- }
5107
- if (limit != null) {
5108
- _queryParams["limit"] = limit.toString();
5109
- }
5118
+ _queryParams["query"] = query;
5110
5119
  let _headers = mergeHeaders(
5111
5120
  (_a2 = this._options) == null ? void 0 : _a2.headers,
5112
5121
  mergeOnlyDefinedHeaders({
@@ -5120,7 +5129,7 @@ var LlmConnections = class {
5120
5129
  const _response = await fetcher({
5121
5130
  url: url_exports.join(
5122
5131
  (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
5123
- "/api/public/llm-connections"
5132
+ "/api/public/metrics"
5124
5133
  ),
5125
5134
  method: "GET",
5126
5135
  headers: _headers,
@@ -5179,7 +5188,7 @@ var LlmConnections = class {
5179
5188
  });
5180
5189
  case "timeout":
5181
5190
  throw new LangfuseAPITimeoutError(
5182
- "Timeout exceeded when calling GET /api/public/llm-connections."
5191
+ "Timeout exceeded when calling GET /api/public/metrics."
5183
5192
  );
5184
5193
  case "unknown":
5185
5194
  throw new LangfuseAPIError({
@@ -5188,11 +5197,29 @@ var LlmConnections = class {
5188
5197
  });
5189
5198
  }
5190
5199
  }
5200
+ async _getAuthorizationHeader() {
5201
+ const username = await Supplier.get(this._options.username);
5202
+ const password = await Supplier.get(this._options.password);
5203
+ if (username != null && password != null) {
5204
+ return BasicAuth.toAuthorizationHeader({
5205
+ username,
5206
+ password
5207
+ });
5208
+ }
5209
+ return void 0;
5210
+ }
5211
+ };
5212
+
5213
+ // src/api/api/resources/legacy/resources/observationsV1/client/Client.ts
5214
+ var ObservationsV1 = class {
5215
+ constructor(_options) {
5216
+ this._options = _options;
5217
+ }
5191
5218
  /**
5192
- * Create or update an LLM connection. The connection is upserted on provider.
5219
+ * Get a observation
5193
5220
  *
5194
- * @param {LangfuseAPI.UpsertLlmConnectionRequest} request
5195
- * @param {LlmConnections.RequestOptions} requestOptions - Request-specific configuration.
5221
+ * @param {string} observationId - The unique langfuse identifier of an observation, can be an event, span or generation
5222
+ * @param {ObservationsV1.RequestOptions} requestOptions - Request-specific configuration.
5196
5223
  *
5197
5224
  * @throws {@link LangfuseAPI.Error}
5198
5225
  * @throws {@link LangfuseAPI.UnauthorizedError}
@@ -5201,23 +5228,14 @@ var LlmConnections = class {
5201
5228
  * @throws {@link LangfuseAPI.NotFoundError}
5202
5229
  *
5203
5230
  * @example
5204
- * await client.llmConnections.upsert({
5205
- * provider: "provider",
5206
- * adapter: "anthropic",
5207
- * secretKey: "secretKey",
5208
- * baseURL: undefined,
5209
- * customModels: undefined,
5210
- * withDefaultModels: undefined,
5211
- * extraHeaders: undefined,
5212
- * config: undefined
5213
- * })
5231
+ * await client.legacy.observationsV1.get("observationId")
5214
5232
  */
5215
- upsert(request, requestOptions) {
5233
+ get(observationId, requestOptions) {
5216
5234
  return HttpResponsePromise.fromPromise(
5217
- this.__upsert(request, requestOptions)
5235
+ this.__get(observationId, requestOptions)
5218
5236
  );
5219
5237
  }
5220
- async __upsert(request, requestOptions) {
5238
+ async __get(observationId, requestOptions) {
5221
5239
  var _a2, _b, _c, _d, _e, _f, _g, _h;
5222
5240
  let _headers = mergeHeaders(
5223
5241
  (_a2 = this._options) == null ? void 0 : _a2.headers,
@@ -5232,14 +5250,11 @@ var LlmConnections = class {
5232
5250
  const _response = await fetcher({
5233
5251
  url: url_exports.join(
5234
5252
  (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
5235
- "/api/public/llm-connections"
5253
+ `/api/public/observations/${encodeURIComponent(observationId)}`
5236
5254
  ),
5237
- method: "PUT",
5255
+ method: "GET",
5238
5256
  headers: _headers,
5239
- contentType: "application/json",
5240
5257
  queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
5241
- requestType: "json",
5242
- body: request,
5243
5258
  timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
5244
5259
  maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
5245
5260
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
@@ -5294,7 +5309,7 @@ var LlmConnections = class {
5294
5309
  });
5295
5310
  case "timeout":
5296
5311
  throw new LangfuseAPITimeoutError(
5297
- "Timeout exceeded when calling PUT /api/public/llm-connections."
5312
+ "Timeout exceeded when calling GET /api/public/observations/{observationId}."
5298
5313
  );
5299
5314
  case "unknown":
5300
5315
  throw new LangfuseAPIError({
@@ -5303,29 +5318,13 @@ var LlmConnections = class {
5303
5318
  });
5304
5319
  }
5305
5320
  }
5306
- async _getAuthorizationHeader() {
5307
- const username = await Supplier.get(this._options.username);
5308
- const password = await Supplier.get(this._options.password);
5309
- if (username != null && password != null) {
5310
- return BasicAuth.toAuthorizationHeader({
5311
- username,
5312
- password
5313
- });
5314
- }
5315
- return void 0;
5316
- }
5317
- };
5318
-
5319
- // src/api/api/resources/media/client/Client.ts
5320
- var Media = class {
5321
- constructor(_options) {
5322
- this._options = _options;
5323
- }
5324
5321
  /**
5325
- * Get a media record
5322
+ * Get a list of observations.
5326
5323
  *
5327
- * @param {string} mediaId - The unique langfuse identifier of a media record
5328
- * @param {Media.RequestOptions} requestOptions - Request-specific configuration.
5324
+ * Consider using the [v2 observations endpoint](/api-reference#tag/observationsv2/GET/api/public/v2/observations) for cursor-based pagination and field selection.
5325
+ *
5326
+ * @param {LangfuseAPI.legacy.GetObservationsRequest} request
5327
+ * @param {ObservationsV1.RequestOptions} requestOptions - Request-specific configuration.
5329
5328
  *
5330
5329
  * @throws {@link LangfuseAPI.Error}
5331
5330
  * @throws {@link LangfuseAPI.UnauthorizedError}
@@ -5334,15 +5333,74 @@ var Media = class {
5334
5333
  * @throws {@link LangfuseAPI.NotFoundError}
5335
5334
  *
5336
5335
  * @example
5337
- * await client.media.get("mediaId")
5336
+ * await client.legacy.observationsV1.getMany()
5338
5337
  */
5339
- get(mediaId, requestOptions) {
5338
+ getMany(request = {}, requestOptions) {
5340
5339
  return HttpResponsePromise.fromPromise(
5341
- this.__get(mediaId, requestOptions)
5340
+ this.__getMany(request, requestOptions)
5342
5341
  );
5343
5342
  }
5344
- async __get(mediaId, requestOptions) {
5343
+ async __getMany(request = {}, requestOptions) {
5345
5344
  var _a2, _b, _c, _d, _e, _f, _g, _h;
5345
+ const {
5346
+ page,
5347
+ limit,
5348
+ name,
5349
+ userId,
5350
+ type: type_,
5351
+ traceId,
5352
+ level,
5353
+ parentObservationId,
5354
+ environment,
5355
+ fromStartTime,
5356
+ toStartTime,
5357
+ version,
5358
+ filter
5359
+ } = request;
5360
+ const _queryParams = {};
5361
+ if (page != null) {
5362
+ _queryParams["page"] = page.toString();
5363
+ }
5364
+ if (limit != null) {
5365
+ _queryParams["limit"] = limit.toString();
5366
+ }
5367
+ if (name != null) {
5368
+ _queryParams["name"] = name;
5369
+ }
5370
+ if (userId != null) {
5371
+ _queryParams["userId"] = userId;
5372
+ }
5373
+ if (type_ != null) {
5374
+ _queryParams["type"] = type_;
5375
+ }
5376
+ if (traceId != null) {
5377
+ _queryParams["traceId"] = traceId;
5378
+ }
5379
+ if (level != null) {
5380
+ _queryParams["level"] = level;
5381
+ }
5382
+ if (parentObservationId != null) {
5383
+ _queryParams["parentObservationId"] = parentObservationId;
5384
+ }
5385
+ if (environment != null) {
5386
+ if (Array.isArray(environment)) {
5387
+ _queryParams["environment"] = environment.map((item) => item);
5388
+ } else {
5389
+ _queryParams["environment"] = environment;
5390
+ }
5391
+ }
5392
+ if (fromStartTime != null) {
5393
+ _queryParams["fromStartTime"] = fromStartTime;
5394
+ }
5395
+ if (toStartTime != null) {
5396
+ _queryParams["toStartTime"] = toStartTime;
5397
+ }
5398
+ if (version != null) {
5399
+ _queryParams["version"] = version;
5400
+ }
5401
+ if (filter != null) {
5402
+ _queryParams["filter"] = filter;
5403
+ }
5346
5404
  let _headers = mergeHeaders(
5347
5405
  (_a2 = this._options) == null ? void 0 : _a2.headers,
5348
5406
  mergeOnlyDefinedHeaders({
@@ -5356,11 +5414,11 @@ var Media = class {
5356
5414
  const _response = await fetcher({
5357
5415
  url: url_exports.join(
5358
5416
  (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
5359
- `/api/public/media/${encodeURIComponent(mediaId)}`
5417
+ "/api/public/observations"
5360
5418
  ),
5361
5419
  method: "GET",
5362
5420
  headers: _headers,
5363
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
5421
+ queryParameters: { ..._queryParams, ...requestOptions == null ? void 0 : requestOptions.queryParams },
5364
5422
  timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
5365
5423
  maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
5366
5424
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
@@ -5415,7 +5473,7 @@ var Media = class {
5415
5473
  });
5416
5474
  case "timeout":
5417
5475
  throw new LangfuseAPITimeoutError(
5418
- "Timeout exceeded when calling GET /api/public/media/{mediaId}."
5476
+ "Timeout exceeded when calling GET /api/public/observations."
5419
5477
  );
5420
5478
  case "unknown":
5421
5479
  throw new LangfuseAPIError({
@@ -5424,12 +5482,29 @@ var Media = class {
5424
5482
  });
5425
5483
  }
5426
5484
  }
5485
+ async _getAuthorizationHeader() {
5486
+ const username = await Supplier.get(this._options.username);
5487
+ const password = await Supplier.get(this._options.password);
5488
+ if (username != null && password != null) {
5489
+ return BasicAuth.toAuthorizationHeader({
5490
+ username,
5491
+ password
5492
+ });
5493
+ }
5494
+ return void 0;
5495
+ }
5496
+ };
5497
+
5498
+ // src/api/api/resources/legacy/resources/scoreV1/client/Client.ts
5499
+ var ScoreV1 = class {
5500
+ constructor(_options) {
5501
+ this._options = _options;
5502
+ }
5427
5503
  /**
5428
- * Patch a media record
5504
+ * Create a score (supports both trace and session scores)
5429
5505
  *
5430
- * @param {string} mediaId - The unique langfuse identifier of a media record
5431
- * @param {LangfuseAPI.PatchMediaBody} request
5432
- * @param {Media.RequestOptions} requestOptions - Request-specific configuration.
5506
+ * @param {LangfuseAPI.legacy.CreateScoreRequest} request
5507
+ * @param {ScoreV1.RequestOptions} requestOptions - Request-specific configuration.
5433
5508
  *
5434
5509
  * @throws {@link LangfuseAPI.Error}
5435
5510
  * @throws {@link LangfuseAPI.UnauthorizedError}
@@ -5438,19 +5513,28 @@ var Media = class {
5438
5513
  * @throws {@link LangfuseAPI.NotFoundError}
5439
5514
  *
5440
5515
  * @example
5441
- * await client.media.patch("mediaId", {
5442
- * uploadedAt: "2024-01-15T09:30:00Z",
5443
- * uploadHttpStatus: 1,
5444
- * uploadHttpError: undefined,
5445
- * uploadTimeMs: undefined
5516
+ * await client.legacy.scoreV1.create({
5517
+ * id: undefined,
5518
+ * traceId: undefined,
5519
+ * sessionId: undefined,
5520
+ * observationId: undefined,
5521
+ * datasetRunId: undefined,
5522
+ * name: "name",
5523
+ * value: 1.1,
5524
+ * comment: undefined,
5525
+ * metadata: undefined,
5526
+ * environment: undefined,
5527
+ * queueId: undefined,
5528
+ * dataType: undefined,
5529
+ * configId: undefined
5446
5530
  * })
5447
5531
  */
5448
- patch(mediaId, request, requestOptions) {
5532
+ create(request, requestOptions) {
5449
5533
  return HttpResponsePromise.fromPromise(
5450
- this.__patch(mediaId, request, requestOptions)
5534
+ this.__create(request, requestOptions)
5451
5535
  );
5452
5536
  }
5453
- async __patch(mediaId, request, requestOptions) {
5537
+ async __create(request, requestOptions) {
5454
5538
  var _a2, _b, _c, _d, _e, _f, _g, _h;
5455
5539
  let _headers = mergeHeaders(
5456
5540
  (_a2 = this._options) == null ? void 0 : _a2.headers,
@@ -5465,9 +5549,9 @@ var Media = class {
5465
5549
  const _response = await fetcher({
5466
5550
  url: url_exports.join(
5467
5551
  (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
5468
- `/api/public/media/${encodeURIComponent(mediaId)}`
5552
+ "/api/public/scores"
5469
5553
  ),
5470
- method: "PATCH",
5554
+ method: "POST",
5471
5555
  headers: _headers,
5472
5556
  contentType: "application/json",
5473
5557
  queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
@@ -5478,7 +5562,10 @@ var Media = class {
5478
5562
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
5479
5563
  });
5480
5564
  if (_response.ok) {
5481
- return { data: void 0, rawResponse: _response.rawResponse };
5565
+ return {
5566
+ data: _response.body,
5567
+ rawResponse: _response.rawResponse
5568
+ };
5482
5569
  }
5483
5570
  if (_response.error.reason === "status-code") {
5484
5571
  switch (_response.error.statusCode) {
@@ -5524,7 +5611,7 @@ var Media = class {
5524
5611
  });
5525
5612
  case "timeout":
5526
5613
  throw new LangfuseAPITimeoutError(
5527
- "Timeout exceeded when calling PATCH /api/public/media/{mediaId}."
5614
+ "Timeout exceeded when calling POST /api/public/scores."
5528
5615
  );
5529
5616
  case "unknown":
5530
5617
  throw new LangfuseAPIError({
@@ -5534,10 +5621,10 @@ var Media = class {
5534
5621
  }
5535
5622
  }
5536
5623
  /**
5537
- * Get a presigned upload URL for a media record
5624
+ * Delete a score (supports both trace and session scores)
5538
5625
  *
5539
- * @param {LangfuseAPI.GetMediaUploadUrlRequest} request
5540
- * @param {Media.RequestOptions} requestOptions - Request-specific configuration.
5626
+ * @param {string} scoreId - The unique langfuse identifier of a score
5627
+ * @param {ScoreV1.RequestOptions} requestOptions - Request-specific configuration.
5541
5628
  *
5542
5629
  * @throws {@link LangfuseAPI.Error}
5543
5630
  * @throws {@link LangfuseAPI.UnauthorizedError}
@@ -5546,21 +5633,14 @@ var Media = class {
5546
5633
  * @throws {@link LangfuseAPI.NotFoundError}
5547
5634
  *
5548
5635
  * @example
5549
- * await client.media.getUploadUrl({
5550
- * traceId: "traceId",
5551
- * observationId: undefined,
5552
- * contentType: "image/png",
5553
- * contentLength: 1,
5554
- * sha256Hash: "sha256Hash",
5555
- * field: "field"
5556
- * })
5636
+ * await client.legacy.scoreV1.delete("scoreId")
5557
5637
  */
5558
- getUploadUrl(request, requestOptions) {
5638
+ delete(scoreId, requestOptions) {
5559
5639
  return HttpResponsePromise.fromPromise(
5560
- this.__getUploadUrl(request, requestOptions)
5640
+ this.__delete(scoreId, requestOptions)
5561
5641
  );
5562
5642
  }
5563
- async __getUploadUrl(request, requestOptions) {
5643
+ async __delete(scoreId, requestOptions) {
5564
5644
  var _a2, _b, _c, _d, _e, _f, _g, _h;
5565
5645
  let _headers = mergeHeaders(
5566
5646
  (_a2 = this._options) == null ? void 0 : _a2.headers,
@@ -5575,23 +5655,17 @@ var Media = class {
5575
5655
  const _response = await fetcher({
5576
5656
  url: url_exports.join(
5577
5657
  (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
5578
- "/api/public/media"
5658
+ `/api/public/scores/${encodeURIComponent(scoreId)}`
5579
5659
  ),
5580
- method: "POST",
5660
+ method: "DELETE",
5581
5661
  headers: _headers,
5582
- contentType: "application/json",
5583
5662
  queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
5584
- requestType: "json",
5585
- body: request,
5586
5663
  timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
5587
5664
  maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
5588
5665
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
5589
5666
  });
5590
5667
  if (_response.ok) {
5591
- return {
5592
- data: _response.body,
5593
- rawResponse: _response.rawResponse
5594
- };
5668
+ return { data: void 0, rawResponse: _response.rawResponse };
5595
5669
  }
5596
5670
  if (_response.error.reason === "status-code") {
5597
5671
  switch (_response.error.statusCode) {
@@ -5637,7 +5711,7 @@ var Media = class {
5637
5711
  });
5638
5712
  case "timeout":
5639
5713
  throw new LangfuseAPITimeoutError(
5640
- "Timeout exceeded when calling POST /api/public/media."
5714
+ "Timeout exceeded when calling DELETE /api/public/scores/{scoreId}."
5641
5715
  );
5642
5716
  case "unknown":
5643
5717
  throw new LangfuseAPIError({
@@ -5659,116 +5733,35 @@ var Media = class {
5659
5733
  }
5660
5734
  };
5661
5735
 
5662
- // src/api/api/resources/metricsV2/client/Client.ts
5663
- var MetricsV2 = class {
5736
+ // src/api/api/resources/legacy/client/Client.ts
5737
+ var Legacy = class {
5738
+ constructor(_options) {
5739
+ this._options = _options;
5740
+ }
5741
+ get metricsV1() {
5742
+ var _a2;
5743
+ return (_a2 = this._metricsV1) != null ? _a2 : this._metricsV1 = new MetricsV1(this._options);
5744
+ }
5745
+ get observationsV1() {
5746
+ var _a2;
5747
+ return (_a2 = this._observationsV1) != null ? _a2 : this._observationsV1 = new ObservationsV1(this._options);
5748
+ }
5749
+ get scoreV1() {
5750
+ var _a2;
5751
+ return (_a2 = this._scoreV1) != null ? _a2 : this._scoreV1 = new ScoreV1(this._options);
5752
+ }
5753
+ };
5754
+
5755
+ // src/api/api/resources/llmConnections/client/Client.ts
5756
+ var LlmConnections = class {
5664
5757
  constructor(_options) {
5665
5758
  this._options = _options;
5666
5759
  }
5667
5760
  /**
5668
- * Get metrics from the Langfuse project using a query object. V2 endpoint with optimized performance.
5669
- *
5670
- * ## V2 Differences
5671
- * - Supports `observations`, `scores-numeric`, and `scores-categorical` views only (traces view not supported)
5672
- * - Direct access to tags and release fields on observations
5673
- * - Backwards-compatible: traceName, traceRelease, traceVersion dimensions are still available on observations view
5674
- * - High cardinality dimensions are not supported and will return a 400 error (see below)
5675
- *
5676
- * For more details, see the [Metrics API documentation](https://langfuse.com/docs/metrics/features/metrics-api).
5677
- *
5678
- * ## Available Views
5679
- *
5680
- * ### observations
5681
- * Query observation-level data (spans, generations, events).
5682
- *
5683
- * **Dimensions:**
5684
- * - `environment` - Deployment environment (e.g., production, staging)
5685
- * - `type` - Type of observation (SPAN, GENERATION, EVENT)
5686
- * - `name` - Name of the observation
5687
- * - `level` - Logging level of the observation
5688
- * - `version` - Version of the observation
5689
- * - `tags` - User-defined tags
5690
- * - `release` - Release version
5691
- * - `traceName` - Name of the parent trace (backwards-compatible)
5692
- * - `traceRelease` - Release version of the parent trace (backwards-compatible, maps to release)
5693
- * - `traceVersion` - Version of the parent trace (backwards-compatible, maps to version)
5694
- * - `providedModelName` - Name of the model used
5695
- * - `promptName` - Name of the prompt used
5696
- * - `promptVersion` - Version of the prompt used
5697
- * - `startTimeMonth` - Month of start_time in YYYY-MM format
5698
- *
5699
- * **Measures:**
5700
- * - `count` - Total number of observations
5701
- * - `latency` - Observation latency (milliseconds)
5702
- * - `streamingLatency` - Generation latency from completion start to end (milliseconds)
5703
- * - `inputTokens` - Sum of input tokens consumed
5704
- * - `outputTokens` - Sum of output tokens produced
5705
- * - `totalTokens` - Sum of all tokens consumed
5706
- * - `outputTokensPerSecond` - Output tokens per second
5707
- * - `tokensPerSecond` - Total tokens per second
5708
- * - `inputCost` - Input cost (USD)
5709
- * - `outputCost` - Output cost (USD)
5710
- * - `totalCost` - Total cost (USD)
5711
- * - `timeToFirstToken` - Time to first token (milliseconds)
5712
- * - `countScores` - Number of scores attached to the observation
5713
- *
5714
- * ### scores-numeric
5715
- * Query numeric and boolean score data.
5716
- *
5717
- * **Dimensions:**
5718
- * - `environment` - Deployment environment
5719
- * - `name` - Name of the score (e.g., accuracy, toxicity)
5720
- * - `source` - Origin of the score (API, ANNOTATION, EVAL)
5721
- * - `dataType` - Data type (NUMERIC, BOOLEAN)
5722
- * - `configId` - Identifier of the score config
5723
- * - `timestampMonth` - Month in YYYY-MM format
5724
- * - `timestampDay` - Day in YYYY-MM-DD format
5725
- * - `value` - Numeric value of the score
5726
- * - `traceName` - Name of the parent trace
5727
- * - `tags` - Tags
5728
- * - `traceRelease` - Release version
5729
- * - `traceVersion` - Version
5730
- * - `observationName` - Name of the associated observation
5731
- * - `observationModelName` - Model name of the associated observation
5732
- * - `observationPromptName` - Prompt name of the associated observation
5733
- * - `observationPromptVersion` - Prompt version of the associated observation
5734
- *
5735
- * **Measures:**
5736
- * - `count` - Total number of scores
5737
- * - `value` - Score value (for aggregations)
5738
- *
5739
- * ### scores-categorical
5740
- * Query categorical score data. Same dimensions as scores-numeric except uses `stringValue` instead of `value`.
5741
- *
5742
- * **Measures:**
5743
- * - `count` - Total number of scores
5744
- *
5745
- * ## High Cardinality Dimensions
5746
- * The following dimensions cannot be used as grouping dimensions in v2 metrics API as they can cause performance issues.
5747
- * Use them in filters instead.
5748
- *
5749
- * **observations view:**
5750
- * - `id` - Use traceId filter to narrow down results
5751
- * - `traceId` - Use traceId filter instead
5752
- * - `userId` - Use userId filter instead
5753
- * - `sessionId` - Use sessionId filter instead
5754
- * - `parentObservationId` - Use parentObservationId filter instead
5755
- *
5756
- * **scores-numeric / scores-categorical views:**
5757
- * - `id` - Use specific filters to narrow down results
5758
- * - `traceId` - Use traceId filter instead
5759
- * - `userId` - Use userId filter instead
5760
- * - `sessionId` - Use sessionId filter instead
5761
- * - `observationId` - Use observationId filter instead
5762
- *
5763
- * ## Aggregations
5764
- * Available aggregation functions: `sum`, `avg`, `count`, `max`, `min`, `p50`, `p75`, `p90`, `p95`, `p99`, `histogram`
5765
- *
5766
- * ## Time Granularities
5767
- * Available granularities for timeDimension: `auto`, `minute`, `hour`, `day`, `week`, `month`
5768
- * - `auto` bins the data into approximately 50 buckets based on the time range
5761
+ * Get all LLM connections in a project
5769
5762
  *
5770
- * @param {LangfuseAPI.GetMetricsV2Request} request
5771
- * @param {MetricsV2.RequestOptions} requestOptions - Request-specific configuration.
5763
+ * @param {LangfuseAPI.GetLlmConnectionsRequest} request
5764
+ * @param {LlmConnections.RequestOptions} requestOptions - Request-specific configuration.
5772
5765
  *
5773
5766
  * @throws {@link LangfuseAPI.Error}
5774
5767
  * @throws {@link LangfuseAPI.UnauthorizedError}
@@ -5777,20 +5770,23 @@ var MetricsV2 = class {
5777
5770
  * @throws {@link LangfuseAPI.NotFoundError}
5778
5771
  *
5779
5772
  * @example
5780
- * await client.metricsV2.metrics({
5781
- * query: "query"
5782
- * })
5773
+ * await client.llmConnections.list()
5783
5774
  */
5784
- metrics(request, requestOptions) {
5775
+ list(request = {}, requestOptions) {
5785
5776
  return HttpResponsePromise.fromPromise(
5786
- this.__metrics(request, requestOptions)
5777
+ this.__list(request, requestOptions)
5787
5778
  );
5788
5779
  }
5789
- async __metrics(request, requestOptions) {
5780
+ async __list(request = {}, requestOptions) {
5790
5781
  var _a2, _b, _c, _d, _e, _f, _g, _h;
5791
- const { query } = request;
5782
+ const { page, limit } = request;
5792
5783
  const _queryParams = {};
5793
- _queryParams["query"] = query;
5784
+ if (page != null) {
5785
+ _queryParams["page"] = page.toString();
5786
+ }
5787
+ if (limit != null) {
5788
+ _queryParams["limit"] = limit.toString();
5789
+ }
5794
5790
  let _headers = mergeHeaders(
5795
5791
  (_a2 = this._options) == null ? void 0 : _a2.headers,
5796
5792
  mergeOnlyDefinedHeaders({
@@ -5804,7 +5800,7 @@ var MetricsV2 = class {
5804
5800
  const _response = await fetcher({
5805
5801
  url: url_exports.join(
5806
5802
  (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
5807
- "/api/public/v2/metrics"
5803
+ "/api/public/llm-connections"
5808
5804
  ),
5809
5805
  method: "GET",
5810
5806
  headers: _headers,
@@ -5863,7 +5859,7 @@ var MetricsV2 = class {
5863
5859
  });
5864
5860
  case "timeout":
5865
5861
  throw new LangfuseAPITimeoutError(
5866
- "Timeout exceeded when calling GET /api/public/v2/metrics."
5862
+ "Timeout exceeded when calling GET /api/public/llm-connections."
5867
5863
  );
5868
5864
  case "unknown":
5869
5865
  throw new LangfuseAPIError({
@@ -5872,33 +5868,11 @@ var MetricsV2 = class {
5872
5868
  });
5873
5869
  }
5874
5870
  }
5875
- async _getAuthorizationHeader() {
5876
- const username = await Supplier.get(this._options.username);
5877
- const password = await Supplier.get(this._options.password);
5878
- if (username != null && password != null) {
5879
- return BasicAuth.toAuthorizationHeader({
5880
- username,
5881
- password
5882
- });
5883
- }
5884
- return void 0;
5885
- }
5886
- };
5887
-
5888
- // src/api/api/resources/metrics/client/Client.ts
5889
- var Metrics = class {
5890
- constructor(_options) {
5891
- this._options = _options;
5892
- }
5893
5871
  /**
5894
- * Get metrics from the Langfuse project using a query object.
5895
- *
5896
- * Consider using the [v2 metrics endpoint](/api-reference#tag/metricsv2/GET/api/public/v2/metrics) for better performance.
5897
- *
5898
- * For more details, see the [Metrics API documentation](https://langfuse.com/docs/metrics/features/metrics-api).
5872
+ * Create or update an LLM connection. The connection is upserted on provider.
5899
5873
  *
5900
- * @param {LangfuseAPI.GetMetricsRequest} request
5901
- * @param {Metrics.RequestOptions} requestOptions - Request-specific configuration.
5874
+ * @param {LangfuseAPI.UpsertLlmConnectionRequest} request
5875
+ * @param {LlmConnections.RequestOptions} requestOptions - Request-specific configuration.
5902
5876
  *
5903
5877
  * @throws {@link LangfuseAPI.Error}
5904
5878
  * @throws {@link LangfuseAPI.UnauthorizedError}
@@ -5907,20 +5881,24 @@ var Metrics = class {
5907
5881
  * @throws {@link LangfuseAPI.NotFoundError}
5908
5882
  *
5909
5883
  * @example
5910
- * await client.metrics.metrics({
5911
- * query: "query"
5884
+ * await client.llmConnections.upsert({
5885
+ * provider: "provider",
5886
+ * adapter: "anthropic",
5887
+ * secretKey: "secretKey",
5888
+ * baseURL: undefined,
5889
+ * customModels: undefined,
5890
+ * withDefaultModels: undefined,
5891
+ * extraHeaders: undefined,
5892
+ * config: undefined
5912
5893
  * })
5913
5894
  */
5914
- metrics(request, requestOptions) {
5895
+ upsert(request, requestOptions) {
5915
5896
  return HttpResponsePromise.fromPromise(
5916
- this.__metrics(request, requestOptions)
5897
+ this.__upsert(request, requestOptions)
5917
5898
  );
5918
5899
  }
5919
- async __metrics(request, requestOptions) {
5900
+ async __upsert(request, requestOptions) {
5920
5901
  var _a2, _b, _c, _d, _e, _f, _g, _h;
5921
- const { query } = request;
5922
- const _queryParams = {};
5923
- _queryParams["query"] = query;
5924
5902
  let _headers = mergeHeaders(
5925
5903
  (_a2 = this._options) == null ? void 0 : _a2.headers,
5926
5904
  mergeOnlyDefinedHeaders({
@@ -5934,11 +5912,14 @@ var Metrics = class {
5934
5912
  const _response = await fetcher({
5935
5913
  url: url_exports.join(
5936
5914
  (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
5937
- "/api/public/metrics"
5915
+ "/api/public/llm-connections"
5938
5916
  ),
5939
- method: "GET",
5917
+ method: "PUT",
5940
5918
  headers: _headers,
5941
- queryParameters: { ..._queryParams, ...requestOptions == null ? void 0 : requestOptions.queryParams },
5919
+ contentType: "application/json",
5920
+ queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
5921
+ requestType: "json",
5922
+ body: request,
5942
5923
  timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
5943
5924
  maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
5944
5925
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
@@ -5993,7 +5974,7 @@ var Metrics = class {
5993
5974
  });
5994
5975
  case "timeout":
5995
5976
  throw new LangfuseAPITimeoutError(
5996
- "Timeout exceeded when calling GET /api/public/metrics."
5977
+ "Timeout exceeded when calling PUT /api/public/llm-connections."
5997
5978
  );
5998
5979
  case "unknown":
5999
5980
  throw new LangfuseAPIError({
@@ -6015,16 +5996,16 @@ var Metrics = class {
6015
5996
  }
6016
5997
  };
6017
5998
 
6018
- // src/api/api/resources/models/client/Client.ts
6019
- var Models = class {
5999
+ // src/api/api/resources/media/client/Client.ts
6000
+ var Media = class {
6020
6001
  constructor(_options) {
6021
6002
  this._options = _options;
6022
6003
  }
6023
6004
  /**
6024
- * Create a model
6005
+ * Get a media record
6025
6006
  *
6026
- * @param {LangfuseAPI.CreateModelRequest} request
6027
- * @param {Models.RequestOptions} requestOptions - Request-specific configuration.
6007
+ * @param {string} mediaId - The unique langfuse identifier of a media record
6008
+ * @param {Media.RequestOptions} requestOptions - Request-specific configuration.
6028
6009
  *
6029
6010
  * @throws {@link LangfuseAPI.Error}
6030
6011
  * @throws {@link LangfuseAPI.UnauthorizedError}
@@ -6033,25 +6014,14 @@ var Models = class {
6033
6014
  * @throws {@link LangfuseAPI.NotFoundError}
6034
6015
  *
6035
6016
  * @example
6036
- * await client.models.create({
6037
- * modelName: "modelName",
6038
- * matchPattern: "matchPattern",
6039
- * startDate: undefined,
6040
- * unit: undefined,
6041
- * inputPrice: undefined,
6042
- * outputPrice: undefined,
6043
- * totalPrice: undefined,
6044
- * pricingTiers: undefined,
6045
- * tokenizerId: undefined,
6046
- * tokenizerConfig: undefined
6047
- * })
6017
+ * await client.media.get("mediaId")
6048
6018
  */
6049
- create(request, requestOptions) {
6019
+ get(mediaId, requestOptions) {
6050
6020
  return HttpResponsePromise.fromPromise(
6051
- this.__create(request, requestOptions)
6021
+ this.__get(mediaId, requestOptions)
6052
6022
  );
6053
6023
  }
6054
- async __create(request, requestOptions) {
6024
+ async __get(mediaId, requestOptions) {
6055
6025
  var _a2, _b, _c, _d, _e, _f, _g, _h;
6056
6026
  let _headers = mergeHeaders(
6057
6027
  (_a2 = this._options) == null ? void 0 : _a2.headers,
@@ -6066,14 +6036,11 @@ var Models = class {
6066
6036
  const _response = await fetcher({
6067
6037
  url: url_exports.join(
6068
6038
  (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
6069
- "/api/public/models"
6039
+ `/api/public/media/${encodeURIComponent(mediaId)}`
6070
6040
  ),
6071
- method: "POST",
6041
+ method: "GET",
6072
6042
  headers: _headers,
6073
- contentType: "application/json",
6074
6043
  queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
6075
- requestType: "json",
6076
- body: request,
6077
6044
  timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
6078
6045
  maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
6079
6046
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
@@ -6128,7 +6095,7 @@ var Models = class {
6128
6095
  });
6129
6096
  case "timeout":
6130
6097
  throw new LangfuseAPITimeoutError(
6131
- "Timeout exceeded when calling POST /api/public/models."
6098
+ "Timeout exceeded when calling GET /api/public/media/{mediaId}."
6132
6099
  );
6133
6100
  case "unknown":
6134
6101
  throw new LangfuseAPIError({
@@ -6138,10 +6105,11 @@ var Models = class {
6138
6105
  }
6139
6106
  }
6140
6107
  /**
6141
- * Get all models
6142
- *
6143
- * @param {LangfuseAPI.GetModelsRequest} request
6144
- * @param {Models.RequestOptions} requestOptions - Request-specific configuration.
6108
+ * Patch a media record
6109
+ *
6110
+ * @param {string} mediaId - The unique langfuse identifier of a media record
6111
+ * @param {LangfuseAPI.PatchMediaBody} request
6112
+ * @param {Media.RequestOptions} requestOptions - Request-specific configuration.
6145
6113
  *
6146
6114
  * @throws {@link LangfuseAPI.Error}
6147
6115
  * @throws {@link LangfuseAPI.UnauthorizedError}
@@ -6150,23 +6118,130 @@ var Models = class {
6150
6118
  * @throws {@link LangfuseAPI.NotFoundError}
6151
6119
  *
6152
6120
  * @example
6153
- * await client.models.list()
6121
+ * await client.media.patch("mediaId", {
6122
+ * uploadedAt: "2024-01-15T09:30:00Z",
6123
+ * uploadHttpStatus: 1,
6124
+ * uploadHttpError: undefined,
6125
+ * uploadTimeMs: undefined
6126
+ * })
6154
6127
  */
6155
- list(request = {}, requestOptions) {
6128
+ patch(mediaId, request, requestOptions) {
6156
6129
  return HttpResponsePromise.fromPromise(
6157
- this.__list(request, requestOptions)
6130
+ this.__patch(mediaId, request, requestOptions)
6158
6131
  );
6159
6132
  }
6160
- async __list(request = {}, requestOptions) {
6133
+ async __patch(mediaId, request, requestOptions) {
6161
6134
  var _a2, _b, _c, _d, _e, _f, _g, _h;
6162
- const { page, limit } = request;
6163
- const _queryParams = {};
6164
- if (page != null) {
6165
- _queryParams["page"] = page.toString();
6135
+ let _headers = mergeHeaders(
6136
+ (_a2 = this._options) == null ? void 0 : _a2.headers,
6137
+ mergeOnlyDefinedHeaders({
6138
+ Authorization: await this._getAuthorizationHeader(),
6139
+ "X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
6140
+ "X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
6141
+ "X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
6142
+ }),
6143
+ requestOptions == null ? void 0 : requestOptions.headers
6144
+ );
6145
+ const _response = await fetcher({
6146
+ url: url_exports.join(
6147
+ (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
6148
+ `/api/public/media/${encodeURIComponent(mediaId)}`
6149
+ ),
6150
+ method: "PATCH",
6151
+ headers: _headers,
6152
+ contentType: "application/json",
6153
+ queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
6154
+ requestType: "json",
6155
+ body: request,
6156
+ timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
6157
+ maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
6158
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
6159
+ });
6160
+ if (_response.ok) {
6161
+ return { data: void 0, rawResponse: _response.rawResponse };
6166
6162
  }
6167
- if (limit != null) {
6168
- _queryParams["limit"] = limit.toString();
6163
+ if (_response.error.reason === "status-code") {
6164
+ switch (_response.error.statusCode) {
6165
+ case 400:
6166
+ throw new Error2(
6167
+ _response.error.body,
6168
+ _response.rawResponse
6169
+ );
6170
+ case 401:
6171
+ throw new UnauthorizedError(
6172
+ _response.error.body,
6173
+ _response.rawResponse
6174
+ );
6175
+ case 403:
6176
+ throw new AccessDeniedError(
6177
+ _response.error.body,
6178
+ _response.rawResponse
6179
+ );
6180
+ case 405:
6181
+ throw new MethodNotAllowedError(
6182
+ _response.error.body,
6183
+ _response.rawResponse
6184
+ );
6185
+ case 404:
6186
+ throw new NotFoundError(
6187
+ _response.error.body,
6188
+ _response.rawResponse
6189
+ );
6190
+ default:
6191
+ throw new LangfuseAPIError({
6192
+ statusCode: _response.error.statusCode,
6193
+ body: _response.error.body,
6194
+ rawResponse: _response.rawResponse
6195
+ });
6196
+ }
6197
+ }
6198
+ switch (_response.error.reason) {
6199
+ case "non-json":
6200
+ throw new LangfuseAPIError({
6201
+ statusCode: _response.error.statusCode,
6202
+ body: _response.error.rawBody,
6203
+ rawResponse: _response.rawResponse
6204
+ });
6205
+ case "timeout":
6206
+ throw new LangfuseAPITimeoutError(
6207
+ "Timeout exceeded when calling PATCH /api/public/media/{mediaId}."
6208
+ );
6209
+ case "unknown":
6210
+ throw new LangfuseAPIError({
6211
+ message: _response.error.errorMessage,
6212
+ rawResponse: _response.rawResponse
6213
+ });
6169
6214
  }
6215
+ }
6216
+ /**
6217
+ * Get a presigned upload URL for a media record
6218
+ *
6219
+ * @param {LangfuseAPI.GetMediaUploadUrlRequest} request
6220
+ * @param {Media.RequestOptions} requestOptions - Request-specific configuration.
6221
+ *
6222
+ * @throws {@link LangfuseAPI.Error}
6223
+ * @throws {@link LangfuseAPI.UnauthorizedError}
6224
+ * @throws {@link LangfuseAPI.AccessDeniedError}
6225
+ * @throws {@link LangfuseAPI.MethodNotAllowedError}
6226
+ * @throws {@link LangfuseAPI.NotFoundError}
6227
+ *
6228
+ * @example
6229
+ * await client.media.getUploadUrl({
6230
+ * traceId: "traceId",
6231
+ * observationId: undefined,
6232
+ * contentType: "image/png",
6233
+ * contentLength: 1,
6234
+ * sha256Hash: "sha256Hash",
6235
+ * field: "field"
6236
+ * })
6237
+ */
6238
+ getUploadUrl(request, requestOptions) {
6239
+ return HttpResponsePromise.fromPromise(
6240
+ this.__getUploadUrl(request, requestOptions)
6241
+ );
6242
+ }
6243
+ async __getUploadUrl(request, requestOptions) {
6244
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
6170
6245
  let _headers = mergeHeaders(
6171
6246
  (_a2 = this._options) == null ? void 0 : _a2.headers,
6172
6247
  mergeOnlyDefinedHeaders({
@@ -6180,7 +6255,236 @@ var Models = class {
6180
6255
  const _response = await fetcher({
6181
6256
  url: url_exports.join(
6182
6257
  (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
6183
- "/api/public/models"
6258
+ "/api/public/media"
6259
+ ),
6260
+ method: "POST",
6261
+ headers: _headers,
6262
+ contentType: "application/json",
6263
+ queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
6264
+ requestType: "json",
6265
+ body: request,
6266
+ timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
6267
+ maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
6268
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
6269
+ });
6270
+ if (_response.ok) {
6271
+ return {
6272
+ data: _response.body,
6273
+ rawResponse: _response.rawResponse
6274
+ };
6275
+ }
6276
+ if (_response.error.reason === "status-code") {
6277
+ switch (_response.error.statusCode) {
6278
+ case 400:
6279
+ throw new Error2(
6280
+ _response.error.body,
6281
+ _response.rawResponse
6282
+ );
6283
+ case 401:
6284
+ throw new UnauthorizedError(
6285
+ _response.error.body,
6286
+ _response.rawResponse
6287
+ );
6288
+ case 403:
6289
+ throw new AccessDeniedError(
6290
+ _response.error.body,
6291
+ _response.rawResponse
6292
+ );
6293
+ case 405:
6294
+ throw new MethodNotAllowedError(
6295
+ _response.error.body,
6296
+ _response.rawResponse
6297
+ );
6298
+ case 404:
6299
+ throw new NotFoundError(
6300
+ _response.error.body,
6301
+ _response.rawResponse
6302
+ );
6303
+ default:
6304
+ throw new LangfuseAPIError({
6305
+ statusCode: _response.error.statusCode,
6306
+ body: _response.error.body,
6307
+ rawResponse: _response.rawResponse
6308
+ });
6309
+ }
6310
+ }
6311
+ switch (_response.error.reason) {
6312
+ case "non-json":
6313
+ throw new LangfuseAPIError({
6314
+ statusCode: _response.error.statusCode,
6315
+ body: _response.error.rawBody,
6316
+ rawResponse: _response.rawResponse
6317
+ });
6318
+ case "timeout":
6319
+ throw new LangfuseAPITimeoutError(
6320
+ "Timeout exceeded when calling POST /api/public/media."
6321
+ );
6322
+ case "unknown":
6323
+ throw new LangfuseAPIError({
6324
+ message: _response.error.errorMessage,
6325
+ rawResponse: _response.rawResponse
6326
+ });
6327
+ }
6328
+ }
6329
+ async _getAuthorizationHeader() {
6330
+ const username = await Supplier.get(this._options.username);
6331
+ const password = await Supplier.get(this._options.password);
6332
+ if (username != null && password != null) {
6333
+ return BasicAuth.toAuthorizationHeader({
6334
+ username,
6335
+ password
6336
+ });
6337
+ }
6338
+ return void 0;
6339
+ }
6340
+ };
6341
+
6342
+ // src/api/api/resources/metrics/client/Client.ts
6343
+ var Metrics = class {
6344
+ constructor(_options) {
6345
+ this._options = _options;
6346
+ }
6347
+ /**
6348
+ * Get metrics from the Langfuse project using a query object. V2 endpoint with optimized performance.
6349
+ *
6350
+ * ## V2 Differences
6351
+ * - Supports `observations`, `scores-numeric`, and `scores-categorical` views only (traces view not supported)
6352
+ * - Direct access to tags and release fields on observations
6353
+ * - Backwards-compatible: traceName, traceRelease, traceVersion dimensions are still available on observations view
6354
+ * - High cardinality dimensions are not supported and will return a 400 error (see below)
6355
+ *
6356
+ * For more details, see the [Metrics API documentation](https://langfuse.com/docs/metrics/features/metrics-api).
6357
+ *
6358
+ * ## Available Views
6359
+ *
6360
+ * ### observations
6361
+ * Query observation-level data (spans, generations, events).
6362
+ *
6363
+ * **Dimensions:**
6364
+ * - `environment` - Deployment environment (e.g., production, staging)
6365
+ * - `type` - Type of observation (SPAN, GENERATION, EVENT)
6366
+ * - `name` - Name of the observation
6367
+ * - `level` - Logging level of the observation
6368
+ * - `version` - Version of the observation
6369
+ * - `tags` - User-defined tags
6370
+ * - `release` - Release version
6371
+ * - `traceName` - Name of the parent trace (backwards-compatible)
6372
+ * - `traceRelease` - Release version of the parent trace (backwards-compatible, maps to release)
6373
+ * - `traceVersion` - Version of the parent trace (backwards-compatible, maps to version)
6374
+ * - `providedModelName` - Name of the model used
6375
+ * - `promptName` - Name of the prompt used
6376
+ * - `promptVersion` - Version of the prompt used
6377
+ * - `startTimeMonth` - Month of start_time in YYYY-MM format
6378
+ *
6379
+ * **Measures:**
6380
+ * - `count` - Total number of observations
6381
+ * - `latency` - Observation latency (milliseconds)
6382
+ * - `streamingLatency` - Generation latency from completion start to end (milliseconds)
6383
+ * - `inputTokens` - Sum of input tokens consumed
6384
+ * - `outputTokens` - Sum of output tokens produced
6385
+ * - `totalTokens` - Sum of all tokens consumed
6386
+ * - `outputTokensPerSecond` - Output tokens per second
6387
+ * - `tokensPerSecond` - Total tokens per second
6388
+ * - `inputCost` - Input cost (USD)
6389
+ * - `outputCost` - Output cost (USD)
6390
+ * - `totalCost` - Total cost (USD)
6391
+ * - `timeToFirstToken` - Time to first token (milliseconds)
6392
+ * - `countScores` - Number of scores attached to the observation
6393
+ *
6394
+ * ### scores-numeric
6395
+ * Query numeric and boolean score data.
6396
+ *
6397
+ * **Dimensions:**
6398
+ * - `environment` - Deployment environment
6399
+ * - `name` - Name of the score (e.g., accuracy, toxicity)
6400
+ * - `source` - Origin of the score (API, ANNOTATION, EVAL)
6401
+ * - `dataType` - Data type (NUMERIC, BOOLEAN)
6402
+ * - `configId` - Identifier of the score config
6403
+ * - `timestampMonth` - Month in YYYY-MM format
6404
+ * - `timestampDay` - Day in YYYY-MM-DD format
6405
+ * - `value` - Numeric value of the score
6406
+ * - `traceName` - Name of the parent trace
6407
+ * - `tags` - Tags
6408
+ * - `traceRelease` - Release version
6409
+ * - `traceVersion` - Version
6410
+ * - `observationName` - Name of the associated observation
6411
+ * - `observationModelName` - Model name of the associated observation
6412
+ * - `observationPromptName` - Prompt name of the associated observation
6413
+ * - `observationPromptVersion` - Prompt version of the associated observation
6414
+ *
6415
+ * **Measures:**
6416
+ * - `count` - Total number of scores
6417
+ * - `value` - Score value (for aggregations)
6418
+ *
6419
+ * ### scores-categorical
6420
+ * Query categorical score data. Same dimensions as scores-numeric except uses `stringValue` instead of `value`.
6421
+ *
6422
+ * **Measures:**
6423
+ * - `count` - Total number of scores
6424
+ *
6425
+ * ## High Cardinality Dimensions
6426
+ * The following dimensions cannot be used as grouping dimensions in v2 metrics API as they can cause performance issues.
6427
+ * Use them in filters instead.
6428
+ *
6429
+ * **observations view:**
6430
+ * - `id` - Use traceId filter to narrow down results
6431
+ * - `traceId` - Use traceId filter instead
6432
+ * - `userId` - Use userId filter instead
6433
+ * - `sessionId` - Use sessionId filter instead
6434
+ * - `parentObservationId` - Use parentObservationId filter instead
6435
+ *
6436
+ * **scores-numeric / scores-categorical views:**
6437
+ * - `id` - Use specific filters to narrow down results
6438
+ * - `traceId` - Use traceId filter instead
6439
+ * - `userId` - Use userId filter instead
6440
+ * - `sessionId` - Use sessionId filter instead
6441
+ * - `observationId` - Use observationId filter instead
6442
+ *
6443
+ * ## Aggregations
6444
+ * Available aggregation functions: `sum`, `avg`, `count`, `max`, `min`, `p50`, `p75`, `p90`, `p95`, `p99`, `histogram`
6445
+ *
6446
+ * ## Time Granularities
6447
+ * Available granularities for timeDimension: `auto`, `minute`, `hour`, `day`, `week`, `month`
6448
+ * - `auto` bins the data into approximately 50 buckets based on the time range
6449
+ *
6450
+ * @param {LangfuseAPI.GetMetricsV2Request} request
6451
+ * @param {Metrics.RequestOptions} requestOptions - Request-specific configuration.
6452
+ *
6453
+ * @throws {@link LangfuseAPI.Error}
6454
+ * @throws {@link LangfuseAPI.UnauthorizedError}
6455
+ * @throws {@link LangfuseAPI.AccessDeniedError}
6456
+ * @throws {@link LangfuseAPI.MethodNotAllowedError}
6457
+ * @throws {@link LangfuseAPI.NotFoundError}
6458
+ *
6459
+ * @example
6460
+ * await client.metrics.metrics({
6461
+ * query: "query"
6462
+ * })
6463
+ */
6464
+ metrics(request, requestOptions) {
6465
+ return HttpResponsePromise.fromPromise(
6466
+ this.__metrics(request, requestOptions)
6467
+ );
6468
+ }
6469
+ async __metrics(request, requestOptions) {
6470
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
6471
+ const { query } = request;
6472
+ const _queryParams = {};
6473
+ _queryParams["query"] = query;
6474
+ let _headers = mergeHeaders(
6475
+ (_a2 = this._options) == null ? void 0 : _a2.headers,
6476
+ mergeOnlyDefinedHeaders({
6477
+ Authorization: await this._getAuthorizationHeader(),
6478
+ "X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
6479
+ "X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
6480
+ "X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
6481
+ }),
6482
+ requestOptions == null ? void 0 : requestOptions.headers
6483
+ );
6484
+ const _response = await fetcher({
6485
+ url: url_exports.join(
6486
+ (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
6487
+ "/api/public/v2/metrics"
6184
6488
  ),
6185
6489
  method: "GET",
6186
6490
  headers: _headers,
@@ -6239,7 +6543,7 @@ var Models = class {
6239
6543
  });
6240
6544
  case "timeout":
6241
6545
  throw new LangfuseAPITimeoutError(
6242
- "Timeout exceeded when calling GET /api/public/models."
6546
+ "Timeout exceeded when calling GET /api/public/v2/metrics."
6243
6547
  );
6244
6548
  case "unknown":
6245
6549
  throw new LangfuseAPIError({
@@ -6248,10 +6552,28 @@ var Models = class {
6248
6552
  });
6249
6553
  }
6250
6554
  }
6555
+ async _getAuthorizationHeader() {
6556
+ const username = await Supplier.get(this._options.username);
6557
+ const password = await Supplier.get(this._options.password);
6558
+ if (username != null && password != null) {
6559
+ return BasicAuth.toAuthorizationHeader({
6560
+ username,
6561
+ password
6562
+ });
6563
+ }
6564
+ return void 0;
6565
+ }
6566
+ };
6567
+
6568
+ // src/api/api/resources/models/client/Client.ts
6569
+ var Models = class {
6570
+ constructor(_options) {
6571
+ this._options = _options;
6572
+ }
6251
6573
  /**
6252
- * Get a model
6574
+ * Create a model
6253
6575
  *
6254
- * @param {string} id
6576
+ * @param {LangfuseAPI.CreateModelRequest} request
6255
6577
  * @param {Models.RequestOptions} requestOptions - Request-specific configuration.
6256
6578
  *
6257
6579
  * @throws {@link LangfuseAPI.Error}
@@ -6261,12 +6583,25 @@ var Models = class {
6261
6583
  * @throws {@link LangfuseAPI.NotFoundError}
6262
6584
  *
6263
6585
  * @example
6264
- * await client.models.get("id")
6586
+ * await client.models.create({
6587
+ * modelName: "modelName",
6588
+ * matchPattern: "matchPattern",
6589
+ * startDate: undefined,
6590
+ * unit: undefined,
6591
+ * inputPrice: undefined,
6592
+ * outputPrice: undefined,
6593
+ * totalPrice: undefined,
6594
+ * pricingTiers: undefined,
6595
+ * tokenizerId: undefined,
6596
+ * tokenizerConfig: undefined
6597
+ * })
6265
6598
  */
6266
- get(id, requestOptions) {
6267
- return HttpResponsePromise.fromPromise(this.__get(id, requestOptions));
6599
+ create(request, requestOptions) {
6600
+ return HttpResponsePromise.fromPromise(
6601
+ this.__create(request, requestOptions)
6602
+ );
6268
6603
  }
6269
- async __get(id, requestOptions) {
6604
+ async __create(request, requestOptions) {
6270
6605
  var _a2, _b, _c, _d, _e, _f, _g, _h;
6271
6606
  let _headers = mergeHeaders(
6272
6607
  (_a2 = this._options) == null ? void 0 : _a2.headers,
@@ -6281,11 +6616,14 @@ var Models = class {
6281
6616
  const _response = await fetcher({
6282
6617
  url: url_exports.join(
6283
6618
  (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
6284
- `/api/public/models/${encodeURIComponent(id)}`
6619
+ "/api/public/models"
6285
6620
  ),
6286
- method: "GET",
6621
+ method: "POST",
6287
6622
  headers: _headers,
6623
+ contentType: "application/json",
6288
6624
  queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
6625
+ requestType: "json",
6626
+ body: request,
6289
6627
  timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
6290
6628
  maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
6291
6629
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
@@ -6340,7 +6678,7 @@ var Models = class {
6340
6678
  });
6341
6679
  case "timeout":
6342
6680
  throw new LangfuseAPITimeoutError(
6343
- "Timeout exceeded when calling GET /api/public/models/{id}."
6681
+ "Timeout exceeded when calling POST /api/public/models."
6344
6682
  );
6345
6683
  case "unknown":
6346
6684
  throw new LangfuseAPIError({
@@ -6350,9 +6688,9 @@ var Models = class {
6350
6688
  }
6351
6689
  }
6352
6690
  /**
6353
- * Delete a model. Cannot delete models managed by Langfuse. You can create your own definition with the same modelName to override the definition though.
6691
+ * Get all models
6354
6692
  *
6355
- * @param {string} id
6693
+ * @param {LangfuseAPI.GetModelsRequest} request
6356
6694
  * @param {Models.RequestOptions} requestOptions - Request-specific configuration.
6357
6695
  *
6358
6696
  * @throws {@link LangfuseAPI.Error}
@@ -6362,15 +6700,23 @@ var Models = class {
6362
6700
  * @throws {@link LangfuseAPI.NotFoundError}
6363
6701
  *
6364
6702
  * @example
6365
- * await client.models.delete("id")
6703
+ * await client.models.list()
6366
6704
  */
6367
- delete(id, requestOptions) {
6705
+ list(request = {}, requestOptions) {
6368
6706
  return HttpResponsePromise.fromPromise(
6369
- this.__delete(id, requestOptions)
6707
+ this.__list(request, requestOptions)
6370
6708
  );
6371
6709
  }
6372
- async __delete(id, requestOptions) {
6710
+ async __list(request = {}, requestOptions) {
6373
6711
  var _a2, _b, _c, _d, _e, _f, _g, _h;
6712
+ const { page, limit } = request;
6713
+ const _queryParams = {};
6714
+ if (page != null) {
6715
+ _queryParams["page"] = page.toString();
6716
+ }
6717
+ if (limit != null) {
6718
+ _queryParams["limit"] = limit.toString();
6719
+ }
6374
6720
  let _headers = mergeHeaders(
6375
6721
  (_a2 = this._options) == null ? void 0 : _a2.headers,
6376
6722
  mergeOnlyDefinedHeaders({
@@ -6384,17 +6730,20 @@ var Models = class {
6384
6730
  const _response = await fetcher({
6385
6731
  url: url_exports.join(
6386
6732
  (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
6387
- `/api/public/models/${encodeURIComponent(id)}`
6733
+ "/api/public/models"
6388
6734
  ),
6389
- method: "DELETE",
6735
+ method: "GET",
6390
6736
  headers: _headers,
6391
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
6737
+ queryParameters: { ..._queryParams, ...requestOptions == null ? void 0 : requestOptions.queryParams },
6392
6738
  timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
6393
6739
  maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
6394
6740
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
6395
6741
  });
6396
6742
  if (_response.ok) {
6397
- return { data: void 0, rawResponse: _response.rawResponse };
6743
+ return {
6744
+ data: _response.body,
6745
+ rawResponse: _response.rawResponse
6746
+ };
6398
6747
  }
6399
6748
  if (_response.error.reason === "status-code") {
6400
6749
  switch (_response.error.statusCode) {
@@ -6440,7 +6789,7 @@ var Models = class {
6440
6789
  });
6441
6790
  case "timeout":
6442
6791
  throw new LangfuseAPITimeoutError(
6443
- "Timeout exceeded when calling DELETE /api/public/models/{id}."
6792
+ "Timeout exceeded when calling GET /api/public/models."
6444
6793
  );
6445
6794
  case "unknown":
6446
6795
  throw new LangfuseAPIError({
@@ -6449,52 +6798,11 @@ var Models = class {
6449
6798
  });
6450
6799
  }
6451
6800
  }
6452
- async _getAuthorizationHeader() {
6453
- const username = await Supplier.get(this._options.username);
6454
- const password = await Supplier.get(this._options.password);
6455
- if (username != null && password != null) {
6456
- return BasicAuth.toAuthorizationHeader({
6457
- username,
6458
- password
6459
- });
6460
- }
6461
- return void 0;
6462
- }
6463
- };
6464
-
6465
- // src/api/api/resources/observationsV2/client/Client.ts
6466
- var ObservationsV2 = class {
6467
- constructor(_options) {
6468
- this._options = _options;
6469
- }
6470
6801
  /**
6471
- * Get a list of observations with cursor-based pagination and flexible field selection.
6472
- *
6473
- * ## Cursor-based Pagination
6474
- * This endpoint uses cursor-based pagination for efficient traversal of large datasets.
6475
- * The cursor is returned in the response metadata and should be passed in subsequent requests
6476
- * to retrieve the next page of results.
6477
- *
6478
- * ## Field Selection
6479
- * Use the `fields` parameter to control which observation fields are returned:
6480
- * - `core` - Always included: id, traceId, startTime, endTime, projectId, parentObservationId, type
6481
- * - `basic` - name, level, statusMessage, version, environment, bookmarked, public, userId, sessionId
6482
- * - `time` - completionStartTime, createdAt, updatedAt
6483
- * - `io` - input, output
6484
- * - `metadata` - metadata (truncated to 200 chars by default, use `expandMetadata` to get full values)
6485
- * - `model` - providedModelName, internalModelId, modelParameters
6486
- * - `usage` - usageDetails, costDetails, totalCost
6487
- * - `prompt` - promptId, promptName, promptVersion
6488
- * - `metrics` - latency, timeToFirstToken
6489
- *
6490
- * If not specified, `core` and `basic` field groups are returned.
6491
- *
6492
- * ## Filters
6493
- * Multiple filtering options are available via query parameters or the structured `filter` parameter.
6494
- * When using the `filter` parameter, it takes precedence over individual query parameter filters.
6802
+ * Get a model
6495
6803
  *
6496
- * @param {LangfuseAPI.GetObservationsV2Request} request
6497
- * @param {ObservationsV2.RequestOptions} requestOptions - Request-specific configuration.
6804
+ * @param {string} id
6805
+ * @param {Models.RequestOptions} requestOptions - Request-specific configuration.
6498
6806
  *
6499
6807
  * @throws {@link LangfuseAPI.Error}
6500
6808
  * @throws {@link LangfuseAPI.UnauthorizedError}
@@ -6503,86 +6811,13 @@ var ObservationsV2 = class {
6503
6811
  * @throws {@link LangfuseAPI.NotFoundError}
6504
6812
  *
6505
6813
  * @example
6506
- * await client.observationsV2.getMany()
6814
+ * await client.models.get("id")
6507
6815
  */
6508
- getMany(request = {}, requestOptions) {
6509
- return HttpResponsePromise.fromPromise(
6510
- this.__getMany(request, requestOptions)
6511
- );
6816
+ get(id, requestOptions) {
6817
+ return HttpResponsePromise.fromPromise(this.__get(id, requestOptions));
6512
6818
  }
6513
- async __getMany(request = {}, requestOptions) {
6819
+ async __get(id, requestOptions) {
6514
6820
  var _a2, _b, _c, _d, _e, _f, _g, _h;
6515
- const {
6516
- fields,
6517
- expandMetadata,
6518
- limit,
6519
- cursor,
6520
- parseIoAsJson,
6521
- name,
6522
- userId,
6523
- type: type_,
6524
- traceId,
6525
- level,
6526
- parentObservationId,
6527
- environment,
6528
- fromStartTime,
6529
- toStartTime,
6530
- version,
6531
- filter
6532
- } = request;
6533
- const _queryParams = {};
6534
- if (fields != null) {
6535
- _queryParams["fields"] = fields;
6536
- }
6537
- if (expandMetadata != null) {
6538
- _queryParams["expandMetadata"] = expandMetadata;
6539
- }
6540
- if (limit != null) {
6541
- _queryParams["limit"] = limit.toString();
6542
- }
6543
- if (cursor != null) {
6544
- _queryParams["cursor"] = cursor;
6545
- }
6546
- if (parseIoAsJson != null) {
6547
- _queryParams["parseIoAsJson"] = parseIoAsJson.toString();
6548
- }
6549
- if (name != null) {
6550
- _queryParams["name"] = name;
6551
- }
6552
- if (userId != null) {
6553
- _queryParams["userId"] = userId;
6554
- }
6555
- if (type_ != null) {
6556
- _queryParams["type"] = type_;
6557
- }
6558
- if (traceId != null) {
6559
- _queryParams["traceId"] = traceId;
6560
- }
6561
- if (level != null) {
6562
- _queryParams["level"] = level;
6563
- }
6564
- if (parentObservationId != null) {
6565
- _queryParams["parentObservationId"] = parentObservationId;
6566
- }
6567
- if (environment != null) {
6568
- if (Array.isArray(environment)) {
6569
- _queryParams["environment"] = environment.map((item) => item);
6570
- } else {
6571
- _queryParams["environment"] = environment;
6572
- }
6573
- }
6574
- if (fromStartTime != null) {
6575
- _queryParams["fromStartTime"] = fromStartTime;
6576
- }
6577
- if (toStartTime != null) {
6578
- _queryParams["toStartTime"] = toStartTime;
6579
- }
6580
- if (version != null) {
6581
- _queryParams["version"] = version;
6582
- }
6583
- if (filter != null) {
6584
- _queryParams["filter"] = filter;
6585
- }
6586
6821
  let _headers = mergeHeaders(
6587
6822
  (_a2 = this._options) == null ? void 0 : _a2.headers,
6588
6823
  mergeOnlyDefinedHeaders({
@@ -6596,11 +6831,11 @@ var ObservationsV2 = class {
6596
6831
  const _response = await fetcher({
6597
6832
  url: url_exports.join(
6598
6833
  (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
6599
- "/api/public/v2/observations"
6834
+ `/api/public/models/${encodeURIComponent(id)}`
6600
6835
  ),
6601
6836
  method: "GET",
6602
6837
  headers: _headers,
6603
- queryParameters: { ..._queryParams, ...requestOptions == null ? void 0 : requestOptions.queryParams },
6838
+ queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
6604
6839
  timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
6605
6840
  maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
6606
6841
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
@@ -6655,7 +6890,7 @@ var ObservationsV2 = class {
6655
6890
  });
6656
6891
  case "timeout":
6657
6892
  throw new LangfuseAPITimeoutError(
6658
- "Timeout exceeded when calling GET /api/public/v2/observations."
6893
+ "Timeout exceeded when calling GET /api/public/models/{id}."
6659
6894
  );
6660
6895
  case "unknown":
6661
6896
  throw new LangfuseAPIError({
@@ -6664,29 +6899,11 @@ var ObservationsV2 = class {
6664
6899
  });
6665
6900
  }
6666
6901
  }
6667
- async _getAuthorizationHeader() {
6668
- const username = await Supplier.get(this._options.username);
6669
- const password = await Supplier.get(this._options.password);
6670
- if (username != null && password != null) {
6671
- return BasicAuth.toAuthorizationHeader({
6672
- username,
6673
- password
6674
- });
6675
- }
6676
- return void 0;
6677
- }
6678
- };
6679
-
6680
- // src/api/api/resources/observations/client/Client.ts
6681
- var Observations = class {
6682
- constructor(_options) {
6683
- this._options = _options;
6684
- }
6685
6902
  /**
6686
- * Get a observation
6903
+ * Delete a model. Cannot delete models managed by Langfuse. You can create your own definition with the same modelName to override the definition though.
6687
6904
  *
6688
- * @param {string} observationId - The unique langfuse identifier of an observation, can be an event, span or generation
6689
- * @param {Observations.RequestOptions} requestOptions - Request-specific configuration.
6905
+ * @param {string} id
6906
+ * @param {Models.RequestOptions} requestOptions - Request-specific configuration.
6690
6907
  *
6691
6908
  * @throws {@link LangfuseAPI.Error}
6692
6909
  * @throws {@link LangfuseAPI.UnauthorizedError}
@@ -6695,14 +6912,14 @@ var Observations = class {
6695
6912
  * @throws {@link LangfuseAPI.NotFoundError}
6696
6913
  *
6697
6914
  * @example
6698
- * await client.observations.get("observationId")
6915
+ * await client.models.delete("id")
6699
6916
  */
6700
- get(observationId, requestOptions) {
6917
+ delete(id, requestOptions) {
6701
6918
  return HttpResponsePromise.fromPromise(
6702
- this.__get(observationId, requestOptions)
6919
+ this.__delete(id, requestOptions)
6703
6920
  );
6704
6921
  }
6705
- async __get(observationId, requestOptions) {
6922
+ async __delete(id, requestOptions) {
6706
6923
  var _a2, _b, _c, _d, _e, _f, _g, _h;
6707
6924
  let _headers = mergeHeaders(
6708
6925
  (_a2 = this._options) == null ? void 0 : _a2.headers,
@@ -6717,9 +6934,9 @@ var Observations = class {
6717
6934
  const _response = await fetcher({
6718
6935
  url: url_exports.join(
6719
6936
  (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
6720
- `/api/public/observations/${encodeURIComponent(observationId)}`
6937
+ `/api/public/models/${encodeURIComponent(id)}`
6721
6938
  ),
6722
- method: "GET",
6939
+ method: "DELETE",
6723
6940
  headers: _headers,
6724
6941
  queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
6725
6942
  timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
@@ -6727,10 +6944,7 @@ var Observations = class {
6727
6944
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
6728
6945
  });
6729
6946
  if (_response.ok) {
6730
- return {
6731
- data: _response.body,
6732
- rawResponse: _response.rawResponse
6733
- };
6947
+ return { data: void 0, rawResponse: _response.rawResponse };
6734
6948
  }
6735
6949
  if (_response.error.reason === "status-code") {
6736
6950
  switch (_response.error.statusCode) {
@@ -6776,7 +6990,7 @@ var Observations = class {
6776
6990
  });
6777
6991
  case "timeout":
6778
6992
  throw new LangfuseAPITimeoutError(
6779
- "Timeout exceeded when calling GET /api/public/observations/{observationId}."
6993
+ "Timeout exceeded when calling DELETE /api/public/models/{id}."
6780
6994
  );
6781
6995
  case "unknown":
6782
6996
  throw new LangfuseAPIError({
@@ -6785,12 +6999,51 @@ var Observations = class {
6785
6999
  });
6786
7000
  }
6787
7001
  }
7002
+ async _getAuthorizationHeader() {
7003
+ const username = await Supplier.get(this._options.username);
7004
+ const password = await Supplier.get(this._options.password);
7005
+ if (username != null && password != null) {
7006
+ return BasicAuth.toAuthorizationHeader({
7007
+ username,
7008
+ password
7009
+ });
7010
+ }
7011
+ return void 0;
7012
+ }
7013
+ };
7014
+
7015
+ // src/api/api/resources/observations/client/Client.ts
7016
+ var Observations = class {
7017
+ constructor(_options) {
7018
+ this._options = _options;
7019
+ }
6788
7020
  /**
6789
- * Get a list of observations.
7021
+ * Get a list of observations with cursor-based pagination and flexible field selection.
6790
7022
  *
6791
- * Consider using the [v2 observations endpoint](/api-reference#tag/observationsv2/GET/api/public/v2/observations) for cursor-based pagination and field selection.
7023
+ * ## Cursor-based Pagination
7024
+ * This endpoint uses cursor-based pagination for efficient traversal of large datasets.
7025
+ * The cursor is returned in the response metadata and should be passed in subsequent requests
7026
+ * to retrieve the next page of results.
7027
+ *
7028
+ * ## Field Selection
7029
+ * Use the `fields` parameter to control which observation fields are returned:
7030
+ * - `core` - Always included: id, traceId, startTime, endTime, projectId, parentObservationId, type
7031
+ * - `basic` - name, level, statusMessage, version, environment, bookmarked, public, userId, sessionId
7032
+ * - `time` - completionStartTime, createdAt, updatedAt
7033
+ * - `io` - input, output
7034
+ * - `metadata` - metadata (truncated to 200 chars by default, use `expandMetadata` to get full values)
7035
+ * - `model` - providedModelName, internalModelId, modelParameters
7036
+ * - `usage` - usageDetails, costDetails, totalCost
7037
+ * - `prompt` - promptId, promptName, promptVersion
7038
+ * - `metrics` - latency, timeToFirstToken
7039
+ *
7040
+ * If not specified, `core` and `basic` field groups are returned.
7041
+ *
7042
+ * ## Filters
7043
+ * Multiple filtering options are available via query parameters or the structured `filter` parameter.
7044
+ * When using the `filter` parameter, it takes precedence over individual query parameter filters.
6792
7045
  *
6793
- * @param {LangfuseAPI.GetObservationsRequest} request
7046
+ * @param {LangfuseAPI.GetObservationsV2Request} request
6794
7047
  * @param {Observations.RequestOptions} requestOptions - Request-specific configuration.
6795
7048
  *
6796
7049
  * @throws {@link LangfuseAPI.Error}
@@ -6810,8 +7063,11 @@ var Observations = class {
6810
7063
  async __getMany(request = {}, requestOptions) {
6811
7064
  var _a2, _b, _c, _d, _e, _f, _g, _h;
6812
7065
  const {
6813
- page,
7066
+ fields,
7067
+ expandMetadata,
6814
7068
  limit,
7069
+ cursor,
7070
+ parseIoAsJson,
6815
7071
  name,
6816
7072
  userId,
6817
7073
  type: type_,
@@ -6825,12 +7081,21 @@ var Observations = class {
6825
7081
  filter
6826
7082
  } = request;
6827
7083
  const _queryParams = {};
6828
- if (page != null) {
6829
- _queryParams["page"] = page.toString();
7084
+ if (fields != null) {
7085
+ _queryParams["fields"] = fields;
7086
+ }
7087
+ if (expandMetadata != null) {
7088
+ _queryParams["expandMetadata"] = expandMetadata;
6830
7089
  }
6831
7090
  if (limit != null) {
6832
7091
  _queryParams["limit"] = limit.toString();
6833
7092
  }
7093
+ if (cursor != null) {
7094
+ _queryParams["cursor"] = cursor;
7095
+ }
7096
+ if (parseIoAsJson != null) {
7097
+ _queryParams["parseIoAsJson"] = parseIoAsJson.toString();
7098
+ }
6834
7099
  if (name != null) {
6835
7100
  _queryParams["name"] = name;
6836
7101
  }
@@ -6881,7 +7146,7 @@ var Observations = class {
6881
7146
  const _response = await fetcher({
6882
7147
  url: url_exports.join(
6883
7148
  (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
6884
- "/api/public/observations"
7149
+ "/api/public/v2/observations"
6885
7150
  ),
6886
7151
  method: "GET",
6887
7152
  headers: _headers,
@@ -6940,7 +7205,7 @@ var Observations = class {
6940
7205
  });
6941
7206
  case "timeout":
6942
7207
  throw new LangfuseAPITimeoutError(
6943
- "Timeout exceeded when calling GET /api/public/observations."
7208
+ "Timeout exceeded when calling GET /api/public/v2/observations."
6944
7209
  );
6945
7210
  case "unknown":
6946
7211
  throw new LangfuseAPIError({
@@ -10595,8 +10860,8 @@ var ScoreConfigs = class {
10595
10860
  }
10596
10861
  };
10597
10862
 
10598
- // src/api/api/resources/scoreV2/client/Client.ts
10599
- var ScoreV2 = class {
10863
+ // src/api/api/resources/scores/client/Client.ts
10864
+ var Scores = class {
10600
10865
  constructor(_options) {
10601
10866
  this._options = _options;
10602
10867
  }
@@ -10604,7 +10869,7 @@ var ScoreV2 = class {
10604
10869
  * Get a list of scores (supports both trace and session scores)
10605
10870
  *
10606
10871
  * @param {LangfuseAPI.GetScoresRequest} request
10607
- * @param {ScoreV2.RequestOptions} requestOptions - Request-specific configuration.
10872
+ * @param {Scores.RequestOptions} requestOptions - Request-specific configuration.
10608
10873
  *
10609
10874
  * @throws {@link LangfuseAPI.Error}
10610
10875
  * @throws {@link LangfuseAPI.UnauthorizedError}
@@ -10613,14 +10878,14 @@ var ScoreV2 = class {
10613
10878
  * @throws {@link LangfuseAPI.NotFoundError}
10614
10879
  *
10615
10880
  * @example
10616
- * await client.scoreV2.get()
10881
+ * await client.scores.getMany()
10617
10882
  */
10618
- get(request = {}, requestOptions) {
10883
+ getMany(request = {}, requestOptions) {
10619
10884
  return HttpResponsePromise.fromPromise(
10620
- this.__get(request, requestOptions)
10885
+ this.__getMany(request, requestOptions)
10621
10886
  );
10622
10887
  }
10623
- async __get(request = {}, requestOptions) {
10888
+ async __getMany(request = {}, requestOptions) {
10624
10889
  var _a2, _b, _c, _d, _e, _f, _g, _h;
10625
10890
  const {
10626
10891
  page,
@@ -10642,7 +10907,8 @@ var ScoreV2 = class {
10642
10907
  queueId,
10643
10908
  dataType,
10644
10909
  traceTags,
10645
- fields
10910
+ fields,
10911
+ filter
10646
10912
  } = request;
10647
10913
  const _queryParams = {};
10648
10914
  if (page != null) {
@@ -10713,6 +10979,9 @@ var ScoreV2 = class {
10713
10979
  if (fields != null) {
10714
10980
  _queryParams["fields"] = fields;
10715
10981
  }
10982
+ if (filter != null) {
10983
+ _queryParams["filter"] = filter;
10984
+ }
10716
10985
  let _headers = mergeHeaders(
10717
10986
  (_a2 = this._options) == null ? void 0 : _a2.headers,
10718
10987
  mergeOnlyDefinedHeaders({
@@ -10798,7 +11067,7 @@ var ScoreV2 = class {
10798
11067
  * Get a score (supports both trace and session scores)
10799
11068
  *
10800
11069
  * @param {string} scoreId - The unique langfuse identifier of a score
10801
- * @param {ScoreV2.RequestOptions} requestOptions - Request-specific configuration.
11070
+ * @param {Scores.RequestOptions} requestOptions - Request-specific configuration.
10802
11071
  *
10803
11072
  * @throws {@link LangfuseAPI.Error}
10804
11073
  * @throws {@link LangfuseAPI.UnauthorizedError}
@@ -10807,7 +11076,7 @@ var ScoreV2 = class {
10807
11076
  * @throws {@link LangfuseAPI.NotFoundError}
10808
11077
  *
10809
11078
  * @example
10810
- * await client.scoreV2.getById("scoreId")
11079
+ * await client.scores.getById("scoreId")
10811
11080
  */
10812
11081
  getById(scoreId, requestOptions) {
10813
11082
  return HttpResponsePromise.fromPromise(
@@ -10910,244 +11179,6 @@ var ScoreV2 = class {
10910
11179
  }
10911
11180
  };
10912
11181
 
10913
- // src/api/api/resources/score/client/Client.ts
10914
- var Score = class {
10915
- constructor(_options) {
10916
- this._options = _options;
10917
- }
10918
- /**
10919
- * Create a score (supports both trace and session scores)
10920
- *
10921
- * @param {LangfuseAPI.CreateScoreRequest} request
10922
- * @param {Score.RequestOptions} requestOptions - Request-specific configuration.
10923
- *
10924
- * @throws {@link LangfuseAPI.Error}
10925
- * @throws {@link LangfuseAPI.UnauthorizedError}
10926
- * @throws {@link LangfuseAPI.AccessDeniedError}
10927
- * @throws {@link LangfuseAPI.MethodNotAllowedError}
10928
- * @throws {@link LangfuseAPI.NotFoundError}
10929
- *
10930
- * @example
10931
- * await client.score.create({
10932
- * id: undefined,
10933
- * traceId: undefined,
10934
- * sessionId: undefined,
10935
- * observationId: undefined,
10936
- * datasetRunId: undefined,
10937
- * name: "name",
10938
- * value: 1.1,
10939
- * comment: undefined,
10940
- * metadata: undefined,
10941
- * environment: undefined,
10942
- * queueId: undefined,
10943
- * dataType: undefined,
10944
- * configId: undefined
10945
- * })
10946
- */
10947
- create(request, requestOptions) {
10948
- return HttpResponsePromise.fromPromise(
10949
- this.__create(request, requestOptions)
10950
- );
10951
- }
10952
- async __create(request, requestOptions) {
10953
- var _a2, _b, _c, _d, _e, _f, _g, _h;
10954
- let _headers = mergeHeaders(
10955
- (_a2 = this._options) == null ? void 0 : _a2.headers,
10956
- mergeOnlyDefinedHeaders({
10957
- Authorization: await this._getAuthorizationHeader(),
10958
- "X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
10959
- "X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
10960
- "X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
10961
- }),
10962
- requestOptions == null ? void 0 : requestOptions.headers
10963
- );
10964
- const _response = await fetcher({
10965
- url: url_exports.join(
10966
- (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
10967
- "/api/public/scores"
10968
- ),
10969
- method: "POST",
10970
- headers: _headers,
10971
- contentType: "application/json",
10972
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
10973
- requestType: "json",
10974
- body: request,
10975
- timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
10976
- maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
10977
- abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
10978
- });
10979
- if (_response.ok) {
10980
- return {
10981
- data: _response.body,
10982
- rawResponse: _response.rawResponse
10983
- };
10984
- }
10985
- if (_response.error.reason === "status-code") {
10986
- switch (_response.error.statusCode) {
10987
- case 400:
10988
- throw new Error2(
10989
- _response.error.body,
10990
- _response.rawResponse
10991
- );
10992
- case 401:
10993
- throw new UnauthorizedError(
10994
- _response.error.body,
10995
- _response.rawResponse
10996
- );
10997
- case 403:
10998
- throw new AccessDeniedError(
10999
- _response.error.body,
11000
- _response.rawResponse
11001
- );
11002
- case 405:
11003
- throw new MethodNotAllowedError(
11004
- _response.error.body,
11005
- _response.rawResponse
11006
- );
11007
- case 404:
11008
- throw new NotFoundError(
11009
- _response.error.body,
11010
- _response.rawResponse
11011
- );
11012
- default:
11013
- throw new LangfuseAPIError({
11014
- statusCode: _response.error.statusCode,
11015
- body: _response.error.body,
11016
- rawResponse: _response.rawResponse
11017
- });
11018
- }
11019
- }
11020
- switch (_response.error.reason) {
11021
- case "non-json":
11022
- throw new LangfuseAPIError({
11023
- statusCode: _response.error.statusCode,
11024
- body: _response.error.rawBody,
11025
- rawResponse: _response.rawResponse
11026
- });
11027
- case "timeout":
11028
- throw new LangfuseAPITimeoutError(
11029
- "Timeout exceeded when calling POST /api/public/scores."
11030
- );
11031
- case "unknown":
11032
- throw new LangfuseAPIError({
11033
- message: _response.error.errorMessage,
11034
- rawResponse: _response.rawResponse
11035
- });
11036
- }
11037
- }
11038
- /**
11039
- * Delete a score (supports both trace and session scores)
11040
- *
11041
- * @param {string} scoreId - The unique langfuse identifier of a score
11042
- * @param {Score.RequestOptions} requestOptions - Request-specific configuration.
11043
- *
11044
- * @throws {@link LangfuseAPI.Error}
11045
- * @throws {@link LangfuseAPI.UnauthorizedError}
11046
- * @throws {@link LangfuseAPI.AccessDeniedError}
11047
- * @throws {@link LangfuseAPI.MethodNotAllowedError}
11048
- * @throws {@link LangfuseAPI.NotFoundError}
11049
- *
11050
- * @example
11051
- * await client.score.delete("scoreId")
11052
- */
11053
- delete(scoreId, requestOptions) {
11054
- return HttpResponsePromise.fromPromise(
11055
- this.__delete(scoreId, requestOptions)
11056
- );
11057
- }
11058
- async __delete(scoreId, requestOptions) {
11059
- var _a2, _b, _c, _d, _e, _f, _g, _h;
11060
- let _headers = mergeHeaders(
11061
- (_a2 = this._options) == null ? void 0 : _a2.headers,
11062
- mergeOnlyDefinedHeaders({
11063
- Authorization: await this._getAuthorizationHeader(),
11064
- "X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
11065
- "X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
11066
- "X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
11067
- }),
11068
- requestOptions == null ? void 0 : requestOptions.headers
11069
- );
11070
- const _response = await fetcher({
11071
- url: url_exports.join(
11072
- (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
11073
- `/api/public/scores/${encodeURIComponent(scoreId)}`
11074
- ),
11075
- method: "DELETE",
11076
- headers: _headers,
11077
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
11078
- timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
11079
- maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
11080
- abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
11081
- });
11082
- if (_response.ok) {
11083
- return { data: void 0, rawResponse: _response.rawResponse };
11084
- }
11085
- if (_response.error.reason === "status-code") {
11086
- switch (_response.error.statusCode) {
11087
- case 400:
11088
- throw new Error2(
11089
- _response.error.body,
11090
- _response.rawResponse
11091
- );
11092
- case 401:
11093
- throw new UnauthorizedError(
11094
- _response.error.body,
11095
- _response.rawResponse
11096
- );
11097
- case 403:
11098
- throw new AccessDeniedError(
11099
- _response.error.body,
11100
- _response.rawResponse
11101
- );
11102
- case 405:
11103
- throw new MethodNotAllowedError(
11104
- _response.error.body,
11105
- _response.rawResponse
11106
- );
11107
- case 404:
11108
- throw new NotFoundError(
11109
- _response.error.body,
11110
- _response.rawResponse
11111
- );
11112
- default:
11113
- throw new LangfuseAPIError({
11114
- statusCode: _response.error.statusCode,
11115
- body: _response.error.body,
11116
- rawResponse: _response.rawResponse
11117
- });
11118
- }
11119
- }
11120
- switch (_response.error.reason) {
11121
- case "non-json":
11122
- throw new LangfuseAPIError({
11123
- statusCode: _response.error.statusCode,
11124
- body: _response.error.rawBody,
11125
- rawResponse: _response.rawResponse
11126
- });
11127
- case "timeout":
11128
- throw new LangfuseAPITimeoutError(
11129
- "Timeout exceeded when calling DELETE /api/public/scores/{scoreId}."
11130
- );
11131
- case "unknown":
11132
- throw new LangfuseAPIError({
11133
- message: _response.error.errorMessage,
11134
- rawResponse: _response.rawResponse
11135
- });
11136
- }
11137
- }
11138
- async _getAuthorizationHeader() {
11139
- const username = await Supplier.get(this._options.username);
11140
- const password = await Supplier.get(this._options.password);
11141
- if (username != null && password != null) {
11142
- return BasicAuth.toAuthorizationHeader({
11143
- username,
11144
- password
11145
- });
11146
- }
11147
- return void 0;
11148
- }
11149
- };
11150
-
11151
11182
  // src/api/api/resources/sessions/client/Client.ts
11152
11183
  var Sessions = class {
11153
11184
  constructor(_options) {
@@ -11944,6 +11975,10 @@ var LangfuseAPIClient = class {
11944
11975
  var _a2;
11945
11976
  return (_a2 = this._ingestion) != null ? _a2 : this._ingestion = new Ingestion(this._options);
11946
11977
  }
11978
+ get legacy() {
11979
+ var _a2;
11980
+ return (_a2 = this._legacy) != null ? _a2 : this._legacy = new Legacy(this._options);
11981
+ }
11947
11982
  get llmConnections() {
11948
11983
  var _a2;
11949
11984
  return (_a2 = this._llmConnections) != null ? _a2 : this._llmConnections = new LlmConnections(this._options);
@@ -11952,10 +11987,6 @@ var LangfuseAPIClient = class {
11952
11987
  var _a2;
11953
11988
  return (_a2 = this._media) != null ? _a2 : this._media = new Media(this._options);
11954
11989
  }
11955
- get metricsV2() {
11956
- var _a2;
11957
- return (_a2 = this._metricsV2) != null ? _a2 : this._metricsV2 = new MetricsV2(this._options);
11958
- }
11959
11990
  get metrics() {
11960
11991
  var _a2;
11961
11992
  return (_a2 = this._metrics) != null ? _a2 : this._metrics = new Metrics(this._options);
@@ -11964,10 +11995,6 @@ var LangfuseAPIClient = class {
11964
11995
  var _a2;
11965
11996
  return (_a2 = this._models) != null ? _a2 : this._models = new Models(this._options);
11966
11997
  }
11967
- get observationsV2() {
11968
- var _a2;
11969
- return (_a2 = this._observationsV2) != null ? _a2 : this._observationsV2 = new ObservationsV2(this._options);
11970
- }
11971
11998
  get observations() {
11972
11999
  var _a2;
11973
12000
  return (_a2 = this._observations) != null ? _a2 : this._observations = new Observations(this._options);
@@ -12000,13 +12027,9 @@ var LangfuseAPIClient = class {
12000
12027
  var _a2;
12001
12028
  return (_a2 = this._scoreConfigs) != null ? _a2 : this._scoreConfigs = new ScoreConfigs(this._options);
12002
12029
  }
12003
- get scoreV2() {
12004
- var _a2;
12005
- return (_a2 = this._scoreV2) != null ? _a2 : this._scoreV2 = new ScoreV2(this._options);
12006
- }
12007
- get score() {
12030
+ get scores() {
12008
12031
  var _a2;
12009
- return (_a2 = this._score) != null ? _a2 : this._score = new Score(this._options);
12032
+ return (_a2 = this._scores) != null ? _a2 : this._scores = new Scores(this._options);
12010
12033
  }
12011
12034
  get sessions() {
12012
12035
  var _a2;
@@ -12644,14 +12667,13 @@ export {
12644
12667
  getPropagatedAttributesFromContext,
12645
12668
  health_exports as health,
12646
12669
  ingestion_exports as ingestion,
12670
+ legacy_exports as legacy,
12647
12671
  llmConnections_exports as llmConnections,
12648
12672
  LoggerSingleton as logger,
12649
12673
  media_exports as media,
12650
12674
  metrics_exports as metrics,
12651
- metricsV2_exports as metricsV2,
12652
12675
  models_exports as models,
12653
12676
  observations_exports as observations,
12654
- observationsV2_exports as observationsV2,
12655
12677
  opentelemetry_exports as opentelemetry,
12656
12678
  organizations_exports as organizations,
12657
12679
  projects_exports as projects,
@@ -12661,9 +12683,8 @@ export {
12661
12683
  resetGlobalLogger,
12662
12684
  safeSetTimeout,
12663
12685
  scim_exports as scim,
12664
- score_exports as score,
12665
12686
  scoreConfigs_exports as scoreConfigs,
12666
- scoreV2_exports as scoreV2,
12687
+ scores_exports as scores,
12667
12688
  serializeValue,
12668
12689
  sessions_exports as sessions,
12669
12690
  trace_exports as trace,