@langfuse/core 5.0.0-beta.1 → 5.0.1

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 CHANGED
@@ -27,6 +27,7 @@ __export(index_exports, {
27
27
  BlobStorageExportMode: () => BlobStorageExportMode,
28
28
  BlobStorageIntegrationFileType: () => BlobStorageIntegrationFileType,
29
29
  BlobStorageIntegrationType: () => BlobStorageIntegrationType,
30
+ BlobStorageSyncStatus: () => BlobStorageSyncStatus,
30
31
  ChatMessageType: () => ChatMessageType,
31
32
  CommentObjectType: () => CommentObjectType,
32
33
  CreateChatPromptType: () => CreateChatPromptType,
@@ -82,14 +83,13 @@ __export(index_exports, {
82
83
  getPropagatedAttributesFromContext: () => getPropagatedAttributesFromContext,
83
84
  health: () => health_exports,
84
85
  ingestion: () => ingestion_exports,
86
+ legacy: () => legacy_exports,
85
87
  llmConnections: () => llmConnections_exports,
86
88
  logger: () => LoggerSingleton,
87
89
  media: () => media_exports,
88
90
  metrics: () => metrics_exports,
89
- metricsV2: () => metricsV2_exports,
90
91
  models: () => models_exports,
91
92
  observations: () => observations_exports,
92
- observationsV2: () => observationsV2_exports,
93
93
  opentelemetry: () => opentelemetry_exports,
94
94
  organizations: () => organizations_exports,
95
95
  projects: () => projects_exports,
@@ -99,9 +99,8 @@ __export(index_exports, {
99
99
  resetGlobalLogger: () => resetGlobalLogger,
100
100
  safeSetTimeout: () => safeSetTimeout,
101
101
  scim: () => scim_exports,
102
- score: () => score_exports,
103
102
  scoreConfigs: () => scoreConfigs_exports,
104
- scoreV2: () => scoreV2_exports,
103
+ scores: () => scores_exports,
105
104
  serializeValue: () => serializeValue,
106
105
  sessions: () => sessions_exports,
107
106
  trace: () => trace_exports,
@@ -378,7 +377,7 @@ var resetGlobalLogger = () => {
378
377
  // package.json
379
378
  var package_default = {
380
379
  name: "@langfuse/core",
381
- version: "5.0.0-beta.0",
380
+ version: "5.0.1",
382
381
  description: "Core functions and utilities for Langfuse packages",
383
382
  type: "module",
384
383
  sideEffects: false,
@@ -489,7 +488,8 @@ __export(blobStorageIntegrations_exports, {
489
488
  BlobStorageExportFrequency: () => BlobStorageExportFrequency,
490
489
  BlobStorageExportMode: () => BlobStorageExportMode,
491
490
  BlobStorageIntegrationFileType: () => BlobStorageIntegrationFileType,
492
- BlobStorageIntegrationType: () => BlobStorageIntegrationType
491
+ BlobStorageIntegrationType: () => BlobStorageIntegrationType,
492
+ BlobStorageSyncStatus: () => BlobStorageSyncStatus
493
493
  });
494
494
 
495
495
  // src/api/api/resources/blobStorageIntegrations/types/BlobStorageIntegrationType.ts
@@ -520,6 +520,15 @@ var BlobStorageExportFrequency = {
520
520
  Weekly: "weekly"
521
521
  };
522
522
 
523
+ // src/api/api/resources/blobStorageIntegrations/types/BlobStorageSyncStatus.ts
524
+ var BlobStorageSyncStatus = {
525
+ Idle: "idle",
526
+ Queued: "queued",
527
+ UpToDate: "up_to_date",
528
+ Disabled: "disabled",
529
+ Error: "error"
530
+ };
531
+
523
532
  // src/api/api/resources/comments/index.ts
524
533
  var comments_exports = {};
525
534
 
@@ -766,6 +775,23 @@ var ObservationType = {
766
775
  Guardrail: "GUARDRAIL"
767
776
  };
768
777
 
778
+ // src/api/api/resources/legacy/index.ts
779
+ var legacy_exports = {};
780
+ __export(legacy_exports, {
781
+ metricsV1: () => metricsV1_exports,
782
+ observationsV1: () => observationsV1_exports,
783
+ scoreV1: () => scoreV1_exports
784
+ });
785
+
786
+ // src/api/api/resources/legacy/resources/metricsV1/index.ts
787
+ var metricsV1_exports = {};
788
+
789
+ // src/api/api/resources/legacy/resources/observationsV1/index.ts
790
+ var observationsV1_exports = {};
791
+
792
+ // src/api/api/resources/legacy/resources/scoreV1/index.ts
793
+ var scoreV1_exports = {};
794
+
769
795
  // src/api/api/resources/llmConnections/index.ts
770
796
  var llmConnections_exports = {};
771
797
  __export(llmConnections_exports, {
@@ -844,18 +870,12 @@ var MediaContentType = {
844
870
  ApplicationX7ZCompressed: "application/x-7z-compressed"
845
871
  };
846
872
 
847
- // src/api/api/resources/metricsV2/index.ts
848
- var metricsV2_exports = {};
849
-
850
873
  // src/api/api/resources/metrics/index.ts
851
874
  var metrics_exports = {};
852
875
 
853
876
  // src/api/api/resources/models/index.ts
854
877
  var models_exports = {};
855
878
 
856
- // src/api/api/resources/observationsV2/index.ts
857
- var observationsV2_exports = {};
858
-
859
879
  // src/api/api/resources/observations/index.ts
860
880
  var observations_exports = {};
861
881
 
@@ -921,11 +941,8 @@ var scim_exports = {};
921
941
  // src/api/api/resources/scoreConfigs/index.ts
922
942
  var scoreConfigs_exports = {};
923
943
 
924
- // src/api/api/resources/scoreV2/index.ts
925
- var scoreV2_exports = {};
926
-
927
- // src/api/api/resources/score/index.ts
928
- var score_exports = {};
944
+ // src/api/api/resources/scores/index.ts
945
+ var scores_exports = {};
929
946
 
930
947
  // src/api/api/resources/sessions/index.ts
931
948
  var sessions_exports = {};
@@ -3017,6 +3034,109 @@ var BlobStorageIntegrations = class {
3017
3034
  });
3018
3035
  }
3019
3036
  }
3037
+ /**
3038
+ * Get the sync status of a blob storage integration by integration ID (requires organization-scoped API key)
3039
+ *
3040
+ * @param {string} id
3041
+ * @param {BlobStorageIntegrations.RequestOptions} requestOptions - Request-specific configuration.
3042
+ *
3043
+ * @throws {@link LangfuseAPI.Error}
3044
+ * @throws {@link LangfuseAPI.UnauthorizedError}
3045
+ * @throws {@link LangfuseAPI.AccessDeniedError}
3046
+ * @throws {@link LangfuseAPI.MethodNotAllowedError}
3047
+ * @throws {@link LangfuseAPI.NotFoundError}
3048
+ *
3049
+ * @example
3050
+ * await client.blobStorageIntegrations.getBlobStorageIntegrationStatus("id")
3051
+ */
3052
+ getBlobStorageIntegrationStatus(id, requestOptions) {
3053
+ return HttpResponsePromise.fromPromise(
3054
+ this.__getBlobStorageIntegrationStatus(id, requestOptions)
3055
+ );
3056
+ }
3057
+ async __getBlobStorageIntegrationStatus(id, requestOptions) {
3058
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
3059
+ let _headers = mergeHeaders(
3060
+ (_a2 = this._options) == null ? void 0 : _a2.headers,
3061
+ mergeOnlyDefinedHeaders({
3062
+ Authorization: await this._getAuthorizationHeader(),
3063
+ "X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
3064
+ "X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
3065
+ "X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
3066
+ }),
3067
+ requestOptions == null ? void 0 : requestOptions.headers
3068
+ );
3069
+ const _response = await fetcher({
3070
+ url: url_exports.join(
3071
+ (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
3072
+ `/api/public/integrations/blob-storage/${encodeURIComponent(id)}`
3073
+ ),
3074
+ method: "GET",
3075
+ headers: _headers,
3076
+ queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
3077
+ timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
3078
+ maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
3079
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
3080
+ });
3081
+ if (_response.ok) {
3082
+ return {
3083
+ data: _response.body,
3084
+ rawResponse: _response.rawResponse
3085
+ };
3086
+ }
3087
+ if (_response.error.reason === "status-code") {
3088
+ switch (_response.error.statusCode) {
3089
+ case 400:
3090
+ throw new Error2(
3091
+ _response.error.body,
3092
+ _response.rawResponse
3093
+ );
3094
+ case 401:
3095
+ throw new UnauthorizedError(
3096
+ _response.error.body,
3097
+ _response.rawResponse
3098
+ );
3099
+ case 403:
3100
+ throw new AccessDeniedError(
3101
+ _response.error.body,
3102
+ _response.rawResponse
3103
+ );
3104
+ case 405:
3105
+ throw new MethodNotAllowedError(
3106
+ _response.error.body,
3107
+ _response.rawResponse
3108
+ );
3109
+ case 404:
3110
+ throw new NotFoundError(
3111
+ _response.error.body,
3112
+ _response.rawResponse
3113
+ );
3114
+ default:
3115
+ throw new LangfuseAPIError({
3116
+ statusCode: _response.error.statusCode,
3117
+ body: _response.error.body,
3118
+ rawResponse: _response.rawResponse
3119
+ });
3120
+ }
3121
+ }
3122
+ switch (_response.error.reason) {
3123
+ case "non-json":
3124
+ throw new LangfuseAPIError({
3125
+ statusCode: _response.error.statusCode,
3126
+ body: _response.error.rawBody,
3127
+ rawResponse: _response.rawResponse
3128
+ });
3129
+ case "timeout":
3130
+ throw new LangfuseAPITimeoutError(
3131
+ "Timeout exceeded when calling GET /api/public/integrations/blob-storage/{id}."
3132
+ );
3133
+ case "unknown":
3134
+ throw new LangfuseAPIError({
3135
+ message: _response.error.errorMessage,
3136
+ rawResponse: _response.rawResponse
3137
+ });
3138
+ }
3139
+ }
3020
3140
  /**
3021
3141
  * Delete a blob storage integration by ID (requires organization-scoped API key)
3022
3142
  *
@@ -5177,16 +5297,20 @@ var Ingestion = class {
5177
5297
  }
5178
5298
  };
5179
5299
 
5180
- // src/api/api/resources/llmConnections/client/Client.ts
5181
- var LlmConnections = class {
5300
+ // src/api/api/resources/legacy/resources/metricsV1/client/Client.ts
5301
+ var MetricsV1 = class {
5182
5302
  constructor(_options) {
5183
5303
  this._options = _options;
5184
5304
  }
5185
5305
  /**
5186
- * Get all LLM connections in a project
5306
+ * Get metrics from the Langfuse project using a query object.
5187
5307
  *
5188
- * @param {LangfuseAPI.GetLlmConnectionsRequest} request
5189
- * @param {LlmConnections.RequestOptions} requestOptions - Request-specific configuration.
5308
+ * Consider using the [v2 metrics endpoint](/api-reference#tag/metricsv2/GET/api/public/v2/metrics) for better performance.
5309
+ *
5310
+ * For more details, see the [Metrics API documentation](https://langfuse.com/docs/metrics/features/metrics-api).
5311
+ *
5312
+ * @param {LangfuseAPI.legacy.GetMetricsRequest} request
5313
+ * @param {MetricsV1.RequestOptions} requestOptions - Request-specific configuration.
5190
5314
  *
5191
5315
  * @throws {@link LangfuseAPI.Error}
5192
5316
  * @throws {@link LangfuseAPI.UnauthorizedError}
@@ -5195,23 +5319,20 @@ var LlmConnections = class {
5195
5319
  * @throws {@link LangfuseAPI.NotFoundError}
5196
5320
  *
5197
5321
  * @example
5198
- * await client.llmConnections.list()
5322
+ * await client.legacy.metricsV1.metrics({
5323
+ * query: "query"
5324
+ * })
5199
5325
  */
5200
- list(request = {}, requestOptions) {
5326
+ metrics(request, requestOptions) {
5201
5327
  return HttpResponsePromise.fromPromise(
5202
- this.__list(request, requestOptions)
5328
+ this.__metrics(request, requestOptions)
5203
5329
  );
5204
5330
  }
5205
- async __list(request = {}, requestOptions) {
5331
+ async __metrics(request, requestOptions) {
5206
5332
  var _a2, _b, _c, _d, _e, _f, _g, _h;
5207
- const { page, limit } = request;
5333
+ const { query } = request;
5208
5334
  const _queryParams = {};
5209
- if (page != null) {
5210
- _queryParams["page"] = page.toString();
5211
- }
5212
- if (limit != null) {
5213
- _queryParams["limit"] = limit.toString();
5214
- }
5335
+ _queryParams["query"] = query;
5215
5336
  let _headers = mergeHeaders(
5216
5337
  (_a2 = this._options) == null ? void 0 : _a2.headers,
5217
5338
  mergeOnlyDefinedHeaders({
@@ -5225,7 +5346,7 @@ var LlmConnections = class {
5225
5346
  const _response = await fetcher({
5226
5347
  url: url_exports.join(
5227
5348
  (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
5228
- "/api/public/llm-connections"
5349
+ "/api/public/metrics"
5229
5350
  ),
5230
5351
  method: "GET",
5231
5352
  headers: _headers,
@@ -5284,7 +5405,7 @@ var LlmConnections = class {
5284
5405
  });
5285
5406
  case "timeout":
5286
5407
  throw new LangfuseAPITimeoutError(
5287
- "Timeout exceeded when calling GET /api/public/llm-connections."
5408
+ "Timeout exceeded when calling GET /api/public/metrics."
5288
5409
  );
5289
5410
  case "unknown":
5290
5411
  throw new LangfuseAPIError({
@@ -5293,11 +5414,29 @@ var LlmConnections = class {
5293
5414
  });
5294
5415
  }
5295
5416
  }
5417
+ async _getAuthorizationHeader() {
5418
+ const username = await Supplier.get(this._options.username);
5419
+ const password = await Supplier.get(this._options.password);
5420
+ if (username != null && password != null) {
5421
+ return BasicAuth.toAuthorizationHeader({
5422
+ username,
5423
+ password
5424
+ });
5425
+ }
5426
+ return void 0;
5427
+ }
5428
+ };
5429
+
5430
+ // src/api/api/resources/legacy/resources/observationsV1/client/Client.ts
5431
+ var ObservationsV1 = class {
5432
+ constructor(_options) {
5433
+ this._options = _options;
5434
+ }
5296
5435
  /**
5297
- * Create or update an LLM connection. The connection is upserted on provider.
5436
+ * Get a observation
5298
5437
  *
5299
- * @param {LangfuseAPI.UpsertLlmConnectionRequest} request
5300
- * @param {LlmConnections.RequestOptions} requestOptions - Request-specific configuration.
5438
+ * @param {string} observationId - The unique langfuse identifier of an observation, can be an event, span or generation
5439
+ * @param {ObservationsV1.RequestOptions} requestOptions - Request-specific configuration.
5301
5440
  *
5302
5441
  * @throws {@link LangfuseAPI.Error}
5303
5442
  * @throws {@link LangfuseAPI.UnauthorizedError}
@@ -5306,23 +5445,14 @@ var LlmConnections = class {
5306
5445
  * @throws {@link LangfuseAPI.NotFoundError}
5307
5446
  *
5308
5447
  * @example
5309
- * await client.llmConnections.upsert({
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
- * })
5448
+ * await client.legacy.observationsV1.get("observationId")
5319
5449
  */
5320
- upsert(request, requestOptions) {
5450
+ get(observationId, requestOptions) {
5321
5451
  return HttpResponsePromise.fromPromise(
5322
- this.__upsert(request, requestOptions)
5452
+ this.__get(observationId, requestOptions)
5323
5453
  );
5324
5454
  }
5325
- async __upsert(request, requestOptions) {
5455
+ async __get(observationId, requestOptions) {
5326
5456
  var _a2, _b, _c, _d, _e, _f, _g, _h;
5327
5457
  let _headers = mergeHeaders(
5328
5458
  (_a2 = this._options) == null ? void 0 : _a2.headers,
@@ -5337,14 +5467,11 @@ var LlmConnections = class {
5337
5467
  const _response = await fetcher({
5338
5468
  url: url_exports.join(
5339
5469
  (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
5340
- "/api/public/llm-connections"
5470
+ `/api/public/observations/${encodeURIComponent(observationId)}`
5341
5471
  ),
5342
- method: "PUT",
5472
+ method: "GET",
5343
5473
  headers: _headers,
5344
- contentType: "application/json",
5345
5474
  queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
5346
- requestType: "json",
5347
- body: request,
5348
5475
  timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
5349
5476
  maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
5350
5477
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
@@ -5399,7 +5526,7 @@ var LlmConnections = class {
5399
5526
  });
5400
5527
  case "timeout":
5401
5528
  throw new LangfuseAPITimeoutError(
5402
- "Timeout exceeded when calling PUT /api/public/llm-connections."
5529
+ "Timeout exceeded when calling GET /api/public/observations/{observationId}."
5403
5530
  );
5404
5531
  case "unknown":
5405
5532
  throw new LangfuseAPIError({
@@ -5408,29 +5535,13 @@ var LlmConnections = class {
5408
5535
  });
5409
5536
  }
5410
5537
  }
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
5538
  /**
5430
- * Get a media record
5539
+ * Get a list of observations.
5431
5540
  *
5432
- * @param {string} mediaId - The unique langfuse identifier of a media record
5433
- * @param {Media.RequestOptions} requestOptions - Request-specific configuration.
5541
+ * Consider using the [v2 observations endpoint](/api-reference#tag/observationsv2/GET/api/public/v2/observations) for cursor-based pagination and field selection.
5542
+ *
5543
+ * @param {LangfuseAPI.legacy.GetObservationsRequest} request
5544
+ * @param {ObservationsV1.RequestOptions} requestOptions - Request-specific configuration.
5434
5545
  *
5435
5546
  * @throws {@link LangfuseAPI.Error}
5436
5547
  * @throws {@link LangfuseAPI.UnauthorizedError}
@@ -5439,54 +5550,113 @@ var Media = class {
5439
5550
  * @throws {@link LangfuseAPI.NotFoundError}
5440
5551
  *
5441
5552
  * @example
5442
- * await client.media.get("mediaId")
5553
+ * await client.legacy.observationsV1.getMany()
5443
5554
  */
5444
- get(mediaId, requestOptions) {
5555
+ getMany(request = {}, requestOptions) {
5445
5556
  return HttpResponsePromise.fromPromise(
5446
- this.__get(mediaId, requestOptions)
5557
+ this.__getMany(request, requestOptions)
5447
5558
  );
5448
5559
  }
5449
- async __get(mediaId, requestOptions) {
5560
+ async __getMany(request = {}, requestOptions) {
5450
5561
  var _a2, _b, _c, _d, _e, _f, _g, _h;
5451
- let _headers = mergeHeaders(
5452
- (_a2 = this._options) == null ? void 0 : _a2.headers,
5453
- mergeOnlyDefinedHeaders({
5454
- Authorization: await this._getAuthorizationHeader(),
5455
- "X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
5456
- "X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
5457
- "X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
5458
- }),
5459
- requestOptions == null ? void 0 : requestOptions.headers
5460
- );
5461
- const _response = await fetcher({
5462
- url: url_exports.join(
5463
- (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
5464
- `/api/public/media/${encodeURIComponent(mediaId)}`
5465
- ),
5466
- method: "GET",
5467
- headers: _headers,
5468
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
5469
- timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
5470
- maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
5471
- abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
5472
- });
5473
- if (_response.ok) {
5474
- return {
5475
- data: _response.body,
5476
- rawResponse: _response.rawResponse
5477
- };
5478
- }
5479
- if (_response.error.reason === "status-code") {
5480
- switch (_response.error.statusCode) {
5481
- case 400:
5482
- throw new Error2(
5483
- _response.error.body,
5484
- _response.rawResponse
5485
- );
5486
- case 401:
5487
- throw new UnauthorizedError(
5488
- _response.error.body,
5489
- _response.rawResponse
5562
+ const {
5563
+ page,
5564
+ limit,
5565
+ name,
5566
+ userId,
5567
+ type: type_,
5568
+ traceId,
5569
+ level,
5570
+ parentObservationId,
5571
+ environment,
5572
+ fromStartTime,
5573
+ toStartTime,
5574
+ version,
5575
+ filter
5576
+ } = request;
5577
+ const _queryParams = {};
5578
+ if (page != null) {
5579
+ _queryParams["page"] = page.toString();
5580
+ }
5581
+ if (limit != null) {
5582
+ _queryParams["limit"] = limit.toString();
5583
+ }
5584
+ if (name != null) {
5585
+ _queryParams["name"] = name;
5586
+ }
5587
+ if (userId != null) {
5588
+ _queryParams["userId"] = userId;
5589
+ }
5590
+ if (type_ != null) {
5591
+ _queryParams["type"] = type_;
5592
+ }
5593
+ if (traceId != null) {
5594
+ _queryParams["traceId"] = traceId;
5595
+ }
5596
+ if (level != null) {
5597
+ _queryParams["level"] = level;
5598
+ }
5599
+ if (parentObservationId != null) {
5600
+ _queryParams["parentObservationId"] = parentObservationId;
5601
+ }
5602
+ if (environment != null) {
5603
+ if (Array.isArray(environment)) {
5604
+ _queryParams["environment"] = environment.map((item) => item);
5605
+ } else {
5606
+ _queryParams["environment"] = environment;
5607
+ }
5608
+ }
5609
+ if (fromStartTime != null) {
5610
+ _queryParams["fromStartTime"] = fromStartTime;
5611
+ }
5612
+ if (toStartTime != null) {
5613
+ _queryParams["toStartTime"] = toStartTime;
5614
+ }
5615
+ if (version != null) {
5616
+ _queryParams["version"] = version;
5617
+ }
5618
+ if (filter != null) {
5619
+ _queryParams["filter"] = filter;
5620
+ }
5621
+ let _headers = mergeHeaders(
5622
+ (_a2 = this._options) == null ? void 0 : _a2.headers,
5623
+ mergeOnlyDefinedHeaders({
5624
+ Authorization: await this._getAuthorizationHeader(),
5625
+ "X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
5626
+ "X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
5627
+ "X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
5628
+ }),
5629
+ requestOptions == null ? void 0 : requestOptions.headers
5630
+ );
5631
+ const _response = await fetcher({
5632
+ url: url_exports.join(
5633
+ (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
5634
+ "/api/public/observations"
5635
+ ),
5636
+ method: "GET",
5637
+ headers: _headers,
5638
+ queryParameters: { ..._queryParams, ...requestOptions == null ? void 0 : requestOptions.queryParams },
5639
+ timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
5640
+ maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
5641
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
5642
+ });
5643
+ if (_response.ok) {
5644
+ return {
5645
+ data: _response.body,
5646
+ rawResponse: _response.rawResponse
5647
+ };
5648
+ }
5649
+ if (_response.error.reason === "status-code") {
5650
+ switch (_response.error.statusCode) {
5651
+ case 400:
5652
+ throw new Error2(
5653
+ _response.error.body,
5654
+ _response.rawResponse
5655
+ );
5656
+ case 401:
5657
+ throw new UnauthorizedError(
5658
+ _response.error.body,
5659
+ _response.rawResponse
5490
5660
  );
5491
5661
  case 403:
5492
5662
  throw new AccessDeniedError(
@@ -5520,7 +5690,7 @@ var Media = class {
5520
5690
  });
5521
5691
  case "timeout":
5522
5692
  throw new LangfuseAPITimeoutError(
5523
- "Timeout exceeded when calling GET /api/public/media/{mediaId}."
5693
+ "Timeout exceeded when calling GET /api/public/observations."
5524
5694
  );
5525
5695
  case "unknown":
5526
5696
  throw new LangfuseAPIError({
@@ -5529,12 +5699,286 @@ var Media = class {
5529
5699
  });
5530
5700
  }
5531
5701
  }
5702
+ async _getAuthorizationHeader() {
5703
+ const username = await Supplier.get(this._options.username);
5704
+ const password = await Supplier.get(this._options.password);
5705
+ if (username != null && password != null) {
5706
+ return BasicAuth.toAuthorizationHeader({
5707
+ username,
5708
+ password
5709
+ });
5710
+ }
5711
+ return void 0;
5712
+ }
5713
+ };
5714
+
5715
+ // src/api/api/resources/legacy/resources/scoreV1/client/Client.ts
5716
+ var ScoreV1 = class {
5717
+ constructor(_options) {
5718
+ this._options = _options;
5719
+ }
5532
5720
  /**
5533
- * Patch a media record
5721
+ * Create a score (supports both trace and session scores)
5534
5722
  *
5535
- * @param {string} mediaId - The unique langfuse identifier of a media record
5536
- * @param {LangfuseAPI.PatchMediaBody} request
5537
- * @param {Media.RequestOptions} requestOptions - Request-specific configuration.
5723
+ * @param {LangfuseAPI.legacy.CreateScoreRequest} request
5724
+ * @param {ScoreV1.RequestOptions} requestOptions - Request-specific configuration.
5725
+ *
5726
+ * @throws {@link LangfuseAPI.Error}
5727
+ * @throws {@link LangfuseAPI.UnauthorizedError}
5728
+ * @throws {@link LangfuseAPI.AccessDeniedError}
5729
+ * @throws {@link LangfuseAPI.MethodNotAllowedError}
5730
+ * @throws {@link LangfuseAPI.NotFoundError}
5731
+ *
5732
+ * @example
5733
+ * await client.legacy.scoreV1.create({
5734
+ * id: undefined,
5735
+ * traceId: undefined,
5736
+ * sessionId: undefined,
5737
+ * observationId: undefined,
5738
+ * datasetRunId: undefined,
5739
+ * name: "name",
5740
+ * value: 1.1,
5741
+ * comment: undefined,
5742
+ * metadata: undefined,
5743
+ * environment: undefined,
5744
+ * queueId: undefined,
5745
+ * dataType: undefined,
5746
+ * configId: undefined
5747
+ * })
5748
+ */
5749
+ create(request, requestOptions) {
5750
+ return HttpResponsePromise.fromPromise(
5751
+ this.__create(request, requestOptions)
5752
+ );
5753
+ }
5754
+ async __create(request, requestOptions) {
5755
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
5756
+ let _headers = mergeHeaders(
5757
+ (_a2 = this._options) == null ? void 0 : _a2.headers,
5758
+ mergeOnlyDefinedHeaders({
5759
+ Authorization: await this._getAuthorizationHeader(),
5760
+ "X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
5761
+ "X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
5762
+ "X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
5763
+ }),
5764
+ requestOptions == null ? void 0 : requestOptions.headers
5765
+ );
5766
+ const _response = await fetcher({
5767
+ url: url_exports.join(
5768
+ (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
5769
+ "/api/public/scores"
5770
+ ),
5771
+ method: "POST",
5772
+ headers: _headers,
5773
+ contentType: "application/json",
5774
+ queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
5775
+ requestType: "json",
5776
+ body: request,
5777
+ timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
5778
+ maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
5779
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
5780
+ });
5781
+ if (_response.ok) {
5782
+ return {
5783
+ data: _response.body,
5784
+ rawResponse: _response.rawResponse
5785
+ };
5786
+ }
5787
+ if (_response.error.reason === "status-code") {
5788
+ switch (_response.error.statusCode) {
5789
+ case 400:
5790
+ throw new Error2(
5791
+ _response.error.body,
5792
+ _response.rawResponse
5793
+ );
5794
+ case 401:
5795
+ throw new UnauthorizedError(
5796
+ _response.error.body,
5797
+ _response.rawResponse
5798
+ );
5799
+ case 403:
5800
+ throw new AccessDeniedError(
5801
+ _response.error.body,
5802
+ _response.rawResponse
5803
+ );
5804
+ case 405:
5805
+ throw new MethodNotAllowedError(
5806
+ _response.error.body,
5807
+ _response.rawResponse
5808
+ );
5809
+ case 404:
5810
+ throw new NotFoundError(
5811
+ _response.error.body,
5812
+ _response.rawResponse
5813
+ );
5814
+ default:
5815
+ throw new LangfuseAPIError({
5816
+ statusCode: _response.error.statusCode,
5817
+ body: _response.error.body,
5818
+ rawResponse: _response.rawResponse
5819
+ });
5820
+ }
5821
+ }
5822
+ switch (_response.error.reason) {
5823
+ case "non-json":
5824
+ throw new LangfuseAPIError({
5825
+ statusCode: _response.error.statusCode,
5826
+ body: _response.error.rawBody,
5827
+ rawResponse: _response.rawResponse
5828
+ });
5829
+ case "timeout":
5830
+ throw new LangfuseAPITimeoutError(
5831
+ "Timeout exceeded when calling POST /api/public/scores."
5832
+ );
5833
+ case "unknown":
5834
+ throw new LangfuseAPIError({
5835
+ message: _response.error.errorMessage,
5836
+ rawResponse: _response.rawResponse
5837
+ });
5838
+ }
5839
+ }
5840
+ /**
5841
+ * Delete a score (supports both trace and session scores)
5842
+ *
5843
+ * @param {string} scoreId - The unique langfuse identifier of a score
5844
+ * @param {ScoreV1.RequestOptions} requestOptions - Request-specific configuration.
5845
+ *
5846
+ * @throws {@link LangfuseAPI.Error}
5847
+ * @throws {@link LangfuseAPI.UnauthorizedError}
5848
+ * @throws {@link LangfuseAPI.AccessDeniedError}
5849
+ * @throws {@link LangfuseAPI.MethodNotAllowedError}
5850
+ * @throws {@link LangfuseAPI.NotFoundError}
5851
+ *
5852
+ * @example
5853
+ * await client.legacy.scoreV1.delete("scoreId")
5854
+ */
5855
+ delete(scoreId, requestOptions) {
5856
+ return HttpResponsePromise.fromPromise(
5857
+ this.__delete(scoreId, requestOptions)
5858
+ );
5859
+ }
5860
+ async __delete(scoreId, requestOptions) {
5861
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
5862
+ let _headers = mergeHeaders(
5863
+ (_a2 = this._options) == null ? void 0 : _a2.headers,
5864
+ mergeOnlyDefinedHeaders({
5865
+ Authorization: await this._getAuthorizationHeader(),
5866
+ "X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
5867
+ "X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
5868
+ "X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
5869
+ }),
5870
+ requestOptions == null ? void 0 : requestOptions.headers
5871
+ );
5872
+ const _response = await fetcher({
5873
+ url: url_exports.join(
5874
+ (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
5875
+ `/api/public/scores/${encodeURIComponent(scoreId)}`
5876
+ ),
5877
+ method: "DELETE",
5878
+ headers: _headers,
5879
+ queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
5880
+ timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
5881
+ maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
5882
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
5883
+ });
5884
+ if (_response.ok) {
5885
+ return { data: void 0, rawResponse: _response.rawResponse };
5886
+ }
5887
+ if (_response.error.reason === "status-code") {
5888
+ switch (_response.error.statusCode) {
5889
+ case 400:
5890
+ throw new Error2(
5891
+ _response.error.body,
5892
+ _response.rawResponse
5893
+ );
5894
+ case 401:
5895
+ throw new UnauthorizedError(
5896
+ _response.error.body,
5897
+ _response.rawResponse
5898
+ );
5899
+ case 403:
5900
+ throw new AccessDeniedError(
5901
+ _response.error.body,
5902
+ _response.rawResponse
5903
+ );
5904
+ case 405:
5905
+ throw new MethodNotAllowedError(
5906
+ _response.error.body,
5907
+ _response.rawResponse
5908
+ );
5909
+ case 404:
5910
+ throw new NotFoundError(
5911
+ _response.error.body,
5912
+ _response.rawResponse
5913
+ );
5914
+ default:
5915
+ throw new LangfuseAPIError({
5916
+ statusCode: _response.error.statusCode,
5917
+ body: _response.error.body,
5918
+ rawResponse: _response.rawResponse
5919
+ });
5920
+ }
5921
+ }
5922
+ switch (_response.error.reason) {
5923
+ case "non-json":
5924
+ throw new LangfuseAPIError({
5925
+ statusCode: _response.error.statusCode,
5926
+ body: _response.error.rawBody,
5927
+ rawResponse: _response.rawResponse
5928
+ });
5929
+ case "timeout":
5930
+ throw new LangfuseAPITimeoutError(
5931
+ "Timeout exceeded when calling DELETE /api/public/scores/{scoreId}."
5932
+ );
5933
+ case "unknown":
5934
+ throw new LangfuseAPIError({
5935
+ message: _response.error.errorMessage,
5936
+ rawResponse: _response.rawResponse
5937
+ });
5938
+ }
5939
+ }
5940
+ async _getAuthorizationHeader() {
5941
+ const username = await Supplier.get(this._options.username);
5942
+ const password = await Supplier.get(this._options.password);
5943
+ if (username != null && password != null) {
5944
+ return BasicAuth.toAuthorizationHeader({
5945
+ username,
5946
+ password
5947
+ });
5948
+ }
5949
+ return void 0;
5950
+ }
5951
+ };
5952
+
5953
+ // src/api/api/resources/legacy/client/Client.ts
5954
+ var Legacy = class {
5955
+ constructor(_options) {
5956
+ this._options = _options;
5957
+ }
5958
+ get metricsV1() {
5959
+ var _a2;
5960
+ return (_a2 = this._metricsV1) != null ? _a2 : this._metricsV1 = new MetricsV1(this._options);
5961
+ }
5962
+ get observationsV1() {
5963
+ var _a2;
5964
+ return (_a2 = this._observationsV1) != null ? _a2 : this._observationsV1 = new ObservationsV1(this._options);
5965
+ }
5966
+ get scoreV1() {
5967
+ var _a2;
5968
+ return (_a2 = this._scoreV1) != null ? _a2 : this._scoreV1 = new ScoreV1(this._options);
5969
+ }
5970
+ };
5971
+
5972
+ // src/api/api/resources/llmConnections/client/Client.ts
5973
+ var LlmConnections = class {
5974
+ constructor(_options) {
5975
+ this._options = _options;
5976
+ }
5977
+ /**
5978
+ * Get all LLM connections in a project
5979
+ *
5980
+ * @param {LangfuseAPI.GetLlmConnectionsRequest} request
5981
+ * @param {LlmConnections.RequestOptions} requestOptions - Request-specific configuration.
5538
5982
  *
5539
5983
  * @throws {@link LangfuseAPI.Error}
5540
5984
  * @throws {@link LangfuseAPI.UnauthorizedError}
@@ -5543,20 +5987,23 @@ var Media = class {
5543
5987
  * @throws {@link LangfuseAPI.NotFoundError}
5544
5988
  *
5545
5989
  * @example
5546
- * await client.media.patch("mediaId", {
5547
- * uploadedAt: "2024-01-15T09:30:00Z",
5548
- * uploadHttpStatus: 1,
5549
- * uploadHttpError: undefined,
5550
- * uploadTimeMs: undefined
5551
- * })
5990
+ * await client.llmConnections.list()
5552
5991
  */
5553
- patch(mediaId, request, requestOptions) {
5992
+ list(request = {}, requestOptions) {
5554
5993
  return HttpResponsePromise.fromPromise(
5555
- this.__patch(mediaId, request, requestOptions)
5994
+ this.__list(request, requestOptions)
5556
5995
  );
5557
5996
  }
5558
- async __patch(mediaId, request, requestOptions) {
5997
+ async __list(request = {}, requestOptions) {
5559
5998
  var _a2, _b, _c, _d, _e, _f, _g, _h;
5999
+ const { page, limit } = request;
6000
+ const _queryParams = {};
6001
+ if (page != null) {
6002
+ _queryParams["page"] = page.toString();
6003
+ }
6004
+ if (limit != null) {
6005
+ _queryParams["limit"] = limit.toString();
6006
+ }
5560
6007
  let _headers = mergeHeaders(
5561
6008
  (_a2 = this._options) == null ? void 0 : _a2.headers,
5562
6009
  mergeOnlyDefinedHeaders({
@@ -5570,20 +6017,20 @@ var Media = class {
5570
6017
  const _response = await fetcher({
5571
6018
  url: url_exports.join(
5572
6019
  (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
5573
- `/api/public/media/${encodeURIComponent(mediaId)}`
6020
+ "/api/public/llm-connections"
5574
6021
  ),
5575
- method: "PATCH",
6022
+ method: "GET",
5576
6023
  headers: _headers,
5577
- contentType: "application/json",
5578
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
5579
- requestType: "json",
5580
- body: request,
6024
+ queryParameters: { ..._queryParams, ...requestOptions == null ? void 0 : requestOptions.queryParams },
5581
6025
  timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
5582
6026
  maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
5583
6027
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
5584
6028
  });
5585
6029
  if (_response.ok) {
5586
- return { data: void 0, rawResponse: _response.rawResponse };
6030
+ return {
6031
+ data: _response.body,
6032
+ rawResponse: _response.rawResponse
6033
+ };
5587
6034
  }
5588
6035
  if (_response.error.reason === "status-code") {
5589
6036
  switch (_response.error.statusCode) {
@@ -5629,7 +6076,7 @@ var Media = class {
5629
6076
  });
5630
6077
  case "timeout":
5631
6078
  throw new LangfuseAPITimeoutError(
5632
- "Timeout exceeded when calling PATCH /api/public/media/{mediaId}."
6079
+ "Timeout exceeded when calling GET /api/public/llm-connections."
5633
6080
  );
5634
6081
  case "unknown":
5635
6082
  throw new LangfuseAPIError({
@@ -5639,10 +6086,10 @@ var Media = class {
5639
6086
  }
5640
6087
  }
5641
6088
  /**
5642
- * Get a presigned upload URL for a media record
6089
+ * Create or update an LLM connection. The connection is upserted on provider.
5643
6090
  *
5644
- * @param {LangfuseAPI.GetMediaUploadUrlRequest} request
5645
- * @param {Media.RequestOptions} requestOptions - Request-specific configuration.
6091
+ * @param {LangfuseAPI.UpsertLlmConnectionRequest} request
6092
+ * @param {LlmConnections.RequestOptions} requestOptions - Request-specific configuration.
5646
6093
  *
5647
6094
  * @throws {@link LangfuseAPI.Error}
5648
6095
  * @throws {@link LangfuseAPI.UnauthorizedError}
@@ -5651,21 +6098,23 @@ var Media = class {
5651
6098
  * @throws {@link LangfuseAPI.NotFoundError}
5652
6099
  *
5653
6100
  * @example
5654
- * await client.media.getUploadUrl({
5655
- * traceId: "traceId",
5656
- * observationId: undefined,
5657
- * contentType: "image/png",
5658
- * contentLength: 1,
5659
- * sha256Hash: "sha256Hash",
5660
- * field: "field"
6101
+ * await client.llmConnections.upsert({
6102
+ * provider: "provider",
6103
+ * adapter: "anthropic",
6104
+ * secretKey: "secretKey",
6105
+ * baseURL: undefined,
6106
+ * customModels: undefined,
6107
+ * withDefaultModels: undefined,
6108
+ * extraHeaders: undefined,
6109
+ * config: undefined
5661
6110
  * })
5662
6111
  */
5663
- getUploadUrl(request, requestOptions) {
6112
+ upsert(request, requestOptions) {
5664
6113
  return HttpResponsePromise.fromPromise(
5665
- this.__getUploadUrl(request, requestOptions)
6114
+ this.__upsert(request, requestOptions)
5666
6115
  );
5667
6116
  }
5668
- async __getUploadUrl(request, requestOptions) {
6117
+ async __upsert(request, requestOptions) {
5669
6118
  var _a2, _b, _c, _d, _e, _f, _g, _h;
5670
6119
  let _headers = mergeHeaders(
5671
6120
  (_a2 = this._options) == null ? void 0 : _a2.headers,
@@ -5680,9 +6129,9 @@ var Media = class {
5680
6129
  const _response = await fetcher({
5681
6130
  url: url_exports.join(
5682
6131
  (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
5683
- "/api/public/media"
6132
+ "/api/public/llm-connections"
5684
6133
  ),
5685
- method: "POST",
6134
+ method: "PUT",
5686
6135
  headers: _headers,
5687
6136
  contentType: "application/json",
5688
6137
  queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
@@ -5742,7 +6191,7 @@ var Media = class {
5742
6191
  });
5743
6192
  case "timeout":
5744
6193
  throw new LangfuseAPITimeoutError(
5745
- "Timeout exceeded when calling POST /api/public/media."
6194
+ "Timeout exceeded when calling PUT /api/public/llm-connections."
5746
6195
  );
5747
6196
  case "unknown":
5748
6197
  throw new LangfuseAPIError({
@@ -5764,116 +6213,16 @@ var Media = class {
5764
6213
  }
5765
6214
  };
5766
6215
 
5767
- // src/api/api/resources/metricsV2/client/Client.ts
5768
- var MetricsV2 = class {
6216
+ // src/api/api/resources/media/client/Client.ts
6217
+ var Media = class {
5769
6218
  constructor(_options) {
5770
6219
  this._options = _options;
5771
6220
  }
5772
6221
  /**
5773
- * Get metrics from the Langfuse project using a query object. V2 endpoint with optimized performance.
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
6222
+ * Get a media record
5874
6223
  *
5875
- * @param {LangfuseAPI.GetMetricsV2Request} request
5876
- * @param {MetricsV2.RequestOptions} requestOptions - Request-specific configuration.
6224
+ * @param {string} mediaId - The unique langfuse identifier of a media record
6225
+ * @param {Media.RequestOptions} requestOptions - Request-specific configuration.
5877
6226
  *
5878
6227
  * @throws {@link LangfuseAPI.Error}
5879
6228
  * @throws {@link LangfuseAPI.UnauthorizedError}
@@ -5882,20 +6231,15 @@ var MetricsV2 = class {
5882
6231
  * @throws {@link LangfuseAPI.NotFoundError}
5883
6232
  *
5884
6233
  * @example
5885
- * await client.metricsV2.metrics({
5886
- * query: "query"
5887
- * })
6234
+ * await client.media.get("mediaId")
5888
6235
  */
5889
- metrics(request, requestOptions) {
6236
+ get(mediaId, requestOptions) {
5890
6237
  return HttpResponsePromise.fromPromise(
5891
- this.__metrics(request, requestOptions)
6238
+ this.__get(mediaId, requestOptions)
5892
6239
  );
5893
6240
  }
5894
- async __metrics(request, requestOptions) {
6241
+ async __get(mediaId, requestOptions) {
5895
6242
  var _a2, _b, _c, _d, _e, _f, _g, _h;
5896
- const { query } = request;
5897
- const _queryParams = {};
5898
- _queryParams["query"] = query;
5899
6243
  let _headers = mergeHeaders(
5900
6244
  (_a2 = this._options) == null ? void 0 : _a2.headers,
5901
6245
  mergeOnlyDefinedHeaders({
@@ -5909,11 +6253,11 @@ var MetricsV2 = class {
5909
6253
  const _response = await fetcher({
5910
6254
  url: url_exports.join(
5911
6255
  (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
5912
- "/api/public/v2/metrics"
6256
+ `/api/public/media/${encodeURIComponent(mediaId)}`
5913
6257
  ),
5914
6258
  method: "GET",
5915
6259
  headers: _headers,
5916
- queryParameters: { ..._queryParams, ...requestOptions == null ? void 0 : requestOptions.queryParams },
6260
+ queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
5917
6261
  timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
5918
6262
  maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
5919
6263
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
@@ -5968,7 +6312,7 @@ var MetricsV2 = class {
5968
6312
  });
5969
6313
  case "timeout":
5970
6314
  throw new LangfuseAPITimeoutError(
5971
- "Timeout exceeded when calling GET /api/public/v2/metrics."
6315
+ "Timeout exceeded when calling GET /api/public/media/{mediaId}."
5972
6316
  );
5973
6317
  case "unknown":
5974
6318
  throw new LangfuseAPIError({
@@ -5977,33 +6321,12 @@ var MetricsV2 = class {
5977
6321
  });
5978
6322
  }
5979
6323
  }
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
6324
  /**
5999
- * Get metrics from the Langfuse project using a query object.
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).
6325
+ * Patch a media record
6004
6326
  *
6005
- * @param {LangfuseAPI.GetMetricsRequest} request
6006
- * @param {Metrics.RequestOptions} requestOptions - Request-specific configuration.
6327
+ * @param {string} mediaId - The unique langfuse identifier of a media record
6328
+ * @param {LangfuseAPI.PatchMediaBody} request
6329
+ * @param {Media.RequestOptions} requestOptions - Request-specific configuration.
6007
6330
  *
6008
6331
  * @throws {@link LangfuseAPI.Error}
6009
6332
  * @throws {@link LangfuseAPI.UnauthorizedError}
@@ -6012,20 +6335,20 @@ var Metrics = class {
6012
6335
  * @throws {@link LangfuseAPI.NotFoundError}
6013
6336
  *
6014
6337
  * @example
6015
- * await client.metrics.metrics({
6016
- * query: "query"
6338
+ * await client.media.patch("mediaId", {
6339
+ * uploadedAt: "2024-01-15T09:30:00Z",
6340
+ * uploadHttpStatus: 1,
6341
+ * uploadHttpError: undefined,
6342
+ * uploadTimeMs: undefined
6017
6343
  * })
6018
6344
  */
6019
- metrics(request, requestOptions) {
6345
+ patch(mediaId, request, requestOptions) {
6020
6346
  return HttpResponsePromise.fromPromise(
6021
- this.__metrics(request, requestOptions)
6347
+ this.__patch(mediaId, request, requestOptions)
6022
6348
  );
6023
6349
  }
6024
- async __metrics(request, requestOptions) {
6350
+ async __patch(mediaId, request, requestOptions) {
6025
6351
  var _a2, _b, _c, _d, _e, _f, _g, _h;
6026
- const { query } = request;
6027
- const _queryParams = {};
6028
- _queryParams["query"] = query;
6029
6352
  let _headers = mergeHeaders(
6030
6353
  (_a2 = this._options) == null ? void 0 : _a2.headers,
6031
6354
  mergeOnlyDefinedHeaders({
@@ -6039,20 +6362,20 @@ var Metrics = class {
6039
6362
  const _response = await fetcher({
6040
6363
  url: url_exports.join(
6041
6364
  (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
6042
- "/api/public/metrics"
6365
+ `/api/public/media/${encodeURIComponent(mediaId)}`
6043
6366
  ),
6044
- method: "GET",
6367
+ method: "PATCH",
6045
6368
  headers: _headers,
6046
- queryParameters: { ..._queryParams, ...requestOptions == null ? void 0 : requestOptions.queryParams },
6369
+ contentType: "application/json",
6370
+ queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
6371
+ requestType: "json",
6372
+ body: request,
6047
6373
  timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
6048
6374
  maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
6049
6375
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
6050
6376
  });
6051
6377
  if (_response.ok) {
6052
- return {
6053
- data: _response.body,
6054
- rawResponse: _response.rawResponse
6055
- };
6378
+ return { data: void 0, rawResponse: _response.rawResponse };
6056
6379
  }
6057
6380
  if (_response.error.reason === "status-code") {
6058
6381
  switch (_response.error.statusCode) {
@@ -6098,7 +6421,7 @@ var Metrics = class {
6098
6421
  });
6099
6422
  case "timeout":
6100
6423
  throw new LangfuseAPITimeoutError(
6101
- "Timeout exceeded when calling GET /api/public/metrics."
6424
+ "Timeout exceeded when calling PATCH /api/public/media/{mediaId}."
6102
6425
  );
6103
6426
  case "unknown":
6104
6427
  throw new LangfuseAPIError({
@@ -6107,29 +6430,11 @@ var Metrics = class {
6107
6430
  });
6108
6431
  }
6109
6432
  }
6110
- async _getAuthorizationHeader() {
6111
- const username = await Supplier.get(this._options.username);
6112
- const password = await Supplier.get(this._options.password);
6113
- if (username != null && password != null) {
6114
- return BasicAuth.toAuthorizationHeader({
6115
- username,
6116
- password
6117
- });
6118
- }
6119
- return void 0;
6120
- }
6121
- };
6122
-
6123
- // src/api/api/resources/models/client/Client.ts
6124
- var Models = class {
6125
- constructor(_options) {
6126
- this._options = _options;
6127
- }
6128
6433
  /**
6129
- * Create a model
6434
+ * Get a presigned upload URL for a media record
6130
6435
  *
6131
- * @param {LangfuseAPI.CreateModelRequest} request
6132
- * @param {Models.RequestOptions} requestOptions - Request-specific configuration.
6436
+ * @param {LangfuseAPI.GetMediaUploadUrlRequest} request
6437
+ * @param {Media.RequestOptions} requestOptions - Request-specific configuration.
6133
6438
  *
6134
6439
  * @throws {@link LangfuseAPI.Error}
6135
6440
  * @throws {@link LangfuseAPI.UnauthorizedError}
@@ -6138,25 +6443,21 @@ var Models = class {
6138
6443
  * @throws {@link LangfuseAPI.NotFoundError}
6139
6444
  *
6140
6445
  * @example
6141
- * await client.models.create({
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
6446
+ * await client.media.getUploadUrl({
6447
+ * traceId: "traceId",
6448
+ * observationId: undefined,
6449
+ * contentType: "image/png",
6450
+ * contentLength: 1,
6451
+ * sha256Hash: "sha256Hash",
6452
+ * field: "field"
6152
6453
  * })
6153
6454
  */
6154
- create(request, requestOptions) {
6455
+ getUploadUrl(request, requestOptions) {
6155
6456
  return HttpResponsePromise.fromPromise(
6156
- this.__create(request, requestOptions)
6457
+ this.__getUploadUrl(request, requestOptions)
6157
6458
  );
6158
6459
  }
6159
- async __create(request, requestOptions) {
6460
+ async __getUploadUrl(request, requestOptions) {
6160
6461
  var _a2, _b, _c, _d, _e, _f, _g, _h;
6161
6462
  let _headers = mergeHeaders(
6162
6463
  (_a2 = this._options) == null ? void 0 : _a2.headers,
@@ -6171,7 +6472,7 @@ var Models = class {
6171
6472
  const _response = await fetcher({
6172
6473
  url: url_exports.join(
6173
6474
  (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
6174
- "/api/public/models"
6475
+ "/api/public/media"
6175
6476
  ),
6176
6477
  method: "POST",
6177
6478
  headers: _headers,
@@ -6233,7 +6534,7 @@ var Models = class {
6233
6534
  });
6234
6535
  case "timeout":
6235
6536
  throw new LangfuseAPITimeoutError(
6236
- "Timeout exceeded when calling POST /api/public/models."
6537
+ "Timeout exceeded when calling POST /api/public/media."
6237
6538
  );
6238
6539
  case "unknown":
6239
6540
  throw new LangfuseAPIError({
@@ -6242,11 +6543,129 @@ var Models = class {
6242
6543
  });
6243
6544
  }
6244
6545
  }
6546
+ async _getAuthorizationHeader() {
6547
+ const username = await Supplier.get(this._options.username);
6548
+ const password = await Supplier.get(this._options.password);
6549
+ if (username != null && password != null) {
6550
+ return BasicAuth.toAuthorizationHeader({
6551
+ username,
6552
+ password
6553
+ });
6554
+ }
6555
+ return void 0;
6556
+ }
6557
+ };
6558
+
6559
+ // src/api/api/resources/metrics/client/Client.ts
6560
+ var Metrics = class {
6561
+ constructor(_options) {
6562
+ this._options = _options;
6563
+ }
6245
6564
  /**
6246
- * Get all models
6565
+ * Get metrics from the Langfuse project using a query object. V2 endpoint with optimized performance.
6247
6566
  *
6248
- * @param {LangfuseAPI.GetModelsRequest} request
6249
- * @param {Models.RequestOptions} requestOptions - Request-specific configuration.
6567
+ * ## V2 Differences
6568
+ * - Supports `observations`, `scores-numeric`, and `scores-categorical` views only (traces view not supported)
6569
+ * - Direct access to tags and release fields on observations
6570
+ * - Backwards-compatible: traceName, traceRelease, traceVersion dimensions are still available on observations view
6571
+ * - High cardinality dimensions are not supported and will return a 400 error (see below)
6572
+ *
6573
+ * For more details, see the [Metrics API documentation](https://langfuse.com/docs/metrics/features/metrics-api).
6574
+ *
6575
+ * ## Available Views
6576
+ *
6577
+ * ### observations
6578
+ * Query observation-level data (spans, generations, events).
6579
+ *
6580
+ * **Dimensions:**
6581
+ * - `environment` - Deployment environment (e.g., production, staging)
6582
+ * - `type` - Type of observation (SPAN, GENERATION, EVENT)
6583
+ * - `name` - Name of the observation
6584
+ * - `level` - Logging level of the observation
6585
+ * - `version` - Version of the observation
6586
+ * - `tags` - User-defined tags
6587
+ * - `release` - Release version
6588
+ * - `traceName` - Name of the parent trace (backwards-compatible)
6589
+ * - `traceRelease` - Release version of the parent trace (backwards-compatible, maps to release)
6590
+ * - `traceVersion` - Version of the parent trace (backwards-compatible, maps to version)
6591
+ * - `providedModelName` - Name of the model used
6592
+ * - `promptName` - Name of the prompt used
6593
+ * - `promptVersion` - Version of the prompt used
6594
+ * - `startTimeMonth` - Month of start_time in YYYY-MM format
6595
+ *
6596
+ * **Measures:**
6597
+ * - `count` - Total number of observations
6598
+ * - `latency` - Observation latency (milliseconds)
6599
+ * - `streamingLatency` - Generation latency from completion start to end (milliseconds)
6600
+ * - `inputTokens` - Sum of input tokens consumed
6601
+ * - `outputTokens` - Sum of output tokens produced
6602
+ * - `totalTokens` - Sum of all tokens consumed
6603
+ * - `outputTokensPerSecond` - Output tokens per second
6604
+ * - `tokensPerSecond` - Total tokens per second
6605
+ * - `inputCost` - Input cost (USD)
6606
+ * - `outputCost` - Output cost (USD)
6607
+ * - `totalCost` - Total cost (USD)
6608
+ * - `timeToFirstToken` - Time to first token (milliseconds)
6609
+ * - `countScores` - Number of scores attached to the observation
6610
+ *
6611
+ * ### scores-numeric
6612
+ * Query numeric and boolean score data.
6613
+ *
6614
+ * **Dimensions:**
6615
+ * - `environment` - Deployment environment
6616
+ * - `name` - Name of the score (e.g., accuracy, toxicity)
6617
+ * - `source` - Origin of the score (API, ANNOTATION, EVAL)
6618
+ * - `dataType` - Data type (NUMERIC, BOOLEAN)
6619
+ * - `configId` - Identifier of the score config
6620
+ * - `timestampMonth` - Month in YYYY-MM format
6621
+ * - `timestampDay` - Day in YYYY-MM-DD format
6622
+ * - `value` - Numeric value of the score
6623
+ * - `traceName` - Name of the parent trace
6624
+ * - `tags` - Tags
6625
+ * - `traceRelease` - Release version
6626
+ * - `traceVersion` - Version
6627
+ * - `observationName` - Name of the associated observation
6628
+ * - `observationModelName` - Model name of the associated observation
6629
+ * - `observationPromptName` - Prompt name of the associated observation
6630
+ * - `observationPromptVersion` - Prompt version of the associated observation
6631
+ *
6632
+ * **Measures:**
6633
+ * - `count` - Total number of scores
6634
+ * - `value` - Score value (for aggregations)
6635
+ *
6636
+ * ### scores-categorical
6637
+ * Query categorical score data. Same dimensions as scores-numeric except uses `stringValue` instead of `value`.
6638
+ *
6639
+ * **Measures:**
6640
+ * - `count` - Total number of scores
6641
+ *
6642
+ * ## High Cardinality Dimensions
6643
+ * The following dimensions cannot be used as grouping dimensions in v2 metrics API as they can cause performance issues.
6644
+ * Use them in filters instead.
6645
+ *
6646
+ * **observations view:**
6647
+ * - `id` - Use traceId filter to narrow down results
6648
+ * - `traceId` - Use traceId filter instead
6649
+ * - `userId` - Use userId filter instead
6650
+ * - `sessionId` - Use sessionId filter instead
6651
+ * - `parentObservationId` - Use parentObservationId filter instead
6652
+ *
6653
+ * **scores-numeric / scores-categorical views:**
6654
+ * - `id` - Use specific filters to narrow down results
6655
+ * - `traceId` - Use traceId filter instead
6656
+ * - `userId` - Use userId filter instead
6657
+ * - `sessionId` - Use sessionId filter instead
6658
+ * - `observationId` - Use observationId filter instead
6659
+ *
6660
+ * ## Aggregations
6661
+ * Available aggregation functions: `sum`, `avg`, `count`, `max`, `min`, `p50`, `p75`, `p90`, `p95`, `p99`, `histogram`
6662
+ *
6663
+ * ## Time Granularities
6664
+ * Available granularities for timeDimension: `auto`, `minute`, `hour`, `day`, `week`, `month`
6665
+ * - `auto` bins the data into approximately 50 buckets based on the time range
6666
+ *
6667
+ * @param {LangfuseAPI.GetMetricsV2Request} request
6668
+ * @param {Metrics.RequestOptions} requestOptions - Request-specific configuration.
6250
6669
  *
6251
6670
  * @throws {@link LangfuseAPI.Error}
6252
6671
  * @throws {@link LangfuseAPI.UnauthorizedError}
@@ -6255,23 +6674,20 @@ var Models = class {
6255
6674
  * @throws {@link LangfuseAPI.NotFoundError}
6256
6675
  *
6257
6676
  * @example
6258
- * await client.models.list()
6677
+ * await client.metrics.metrics({
6678
+ * query: "query"
6679
+ * })
6259
6680
  */
6260
- list(request = {}, requestOptions) {
6681
+ metrics(request, requestOptions) {
6261
6682
  return HttpResponsePromise.fromPromise(
6262
- this.__list(request, requestOptions)
6683
+ this.__metrics(request, requestOptions)
6263
6684
  );
6264
6685
  }
6265
- async __list(request = {}, requestOptions) {
6686
+ async __metrics(request, requestOptions) {
6266
6687
  var _a2, _b, _c, _d, _e, _f, _g, _h;
6267
- const { page, limit } = request;
6688
+ const { query } = request;
6268
6689
  const _queryParams = {};
6269
- if (page != null) {
6270
- _queryParams["page"] = page.toString();
6271
- }
6272
- if (limit != null) {
6273
- _queryParams["limit"] = limit.toString();
6274
- }
6690
+ _queryParams["query"] = query;
6275
6691
  let _headers = mergeHeaders(
6276
6692
  (_a2 = this._options) == null ? void 0 : _a2.headers,
6277
6693
  mergeOnlyDefinedHeaders({
@@ -6285,7 +6701,7 @@ var Models = class {
6285
6701
  const _response = await fetcher({
6286
6702
  url: url_exports.join(
6287
6703
  (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
6288
- "/api/public/models"
6704
+ "/api/public/v2/metrics"
6289
6705
  ),
6290
6706
  method: "GET",
6291
6707
  headers: _headers,
@@ -6344,7 +6760,7 @@ var Models = class {
6344
6760
  });
6345
6761
  case "timeout":
6346
6762
  throw new LangfuseAPITimeoutError(
6347
- "Timeout exceeded when calling GET /api/public/models."
6763
+ "Timeout exceeded when calling GET /api/public/v2/metrics."
6348
6764
  );
6349
6765
  case "unknown":
6350
6766
  throw new LangfuseAPIError({
@@ -6353,10 +6769,28 @@ var Models = class {
6353
6769
  });
6354
6770
  }
6355
6771
  }
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/models/client/Client.ts
6786
+ var Models = class {
6787
+ constructor(_options) {
6788
+ this._options = _options;
6789
+ }
6356
6790
  /**
6357
- * Get a model
6791
+ * Create a model
6358
6792
  *
6359
- * @param {string} id
6793
+ * @param {LangfuseAPI.CreateModelRequest} request
6360
6794
  * @param {Models.RequestOptions} requestOptions - Request-specific configuration.
6361
6795
  *
6362
6796
  * @throws {@link LangfuseAPI.Error}
@@ -6366,12 +6800,25 @@ var Models = class {
6366
6800
  * @throws {@link LangfuseAPI.NotFoundError}
6367
6801
  *
6368
6802
  * @example
6369
- * await client.models.get("id")
6803
+ * await client.models.create({
6804
+ * modelName: "modelName",
6805
+ * matchPattern: "matchPattern",
6806
+ * startDate: undefined,
6807
+ * unit: undefined,
6808
+ * inputPrice: undefined,
6809
+ * outputPrice: undefined,
6810
+ * totalPrice: undefined,
6811
+ * pricingTiers: undefined,
6812
+ * tokenizerId: undefined,
6813
+ * tokenizerConfig: undefined
6814
+ * })
6370
6815
  */
6371
- get(id, requestOptions) {
6372
- return HttpResponsePromise.fromPromise(this.__get(id, requestOptions));
6816
+ create(request, requestOptions) {
6817
+ return HttpResponsePromise.fromPromise(
6818
+ this.__create(request, requestOptions)
6819
+ );
6373
6820
  }
6374
- async __get(id, requestOptions) {
6821
+ async __create(request, requestOptions) {
6375
6822
  var _a2, _b, _c, _d, _e, _f, _g, _h;
6376
6823
  let _headers = mergeHeaders(
6377
6824
  (_a2 = this._options) == null ? void 0 : _a2.headers,
@@ -6386,11 +6833,14 @@ var Models = class {
6386
6833
  const _response = await fetcher({
6387
6834
  url: url_exports.join(
6388
6835
  (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
6389
- `/api/public/models/${encodeURIComponent(id)}`
6836
+ "/api/public/models"
6390
6837
  ),
6391
- method: "GET",
6838
+ method: "POST",
6392
6839
  headers: _headers,
6840
+ contentType: "application/json",
6393
6841
  queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
6842
+ requestType: "json",
6843
+ body: request,
6394
6844
  timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
6395
6845
  maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
6396
6846
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
@@ -6445,7 +6895,7 @@ var Models = class {
6445
6895
  });
6446
6896
  case "timeout":
6447
6897
  throw new LangfuseAPITimeoutError(
6448
- "Timeout exceeded when calling GET /api/public/models/{id}."
6898
+ "Timeout exceeded when calling POST /api/public/models."
6449
6899
  );
6450
6900
  case "unknown":
6451
6901
  throw new LangfuseAPIError({
@@ -6455,9 +6905,9 @@ var Models = class {
6455
6905
  }
6456
6906
  }
6457
6907
  /**
6458
- * Delete a model. Cannot delete models managed by Langfuse. You can create your own definition with the same modelName to override the definition though.
6908
+ * Get all models
6459
6909
  *
6460
- * @param {string} id
6910
+ * @param {LangfuseAPI.GetModelsRequest} request
6461
6911
  * @param {Models.RequestOptions} requestOptions - Request-specific configuration.
6462
6912
  *
6463
6913
  * @throws {@link LangfuseAPI.Error}
@@ -6467,15 +6917,23 @@ var Models = class {
6467
6917
  * @throws {@link LangfuseAPI.NotFoundError}
6468
6918
  *
6469
6919
  * @example
6470
- * await client.models.delete("id")
6920
+ * await client.models.list()
6471
6921
  */
6472
- delete(id, requestOptions) {
6922
+ list(request = {}, requestOptions) {
6473
6923
  return HttpResponsePromise.fromPromise(
6474
- this.__delete(id, requestOptions)
6924
+ this.__list(request, requestOptions)
6475
6925
  );
6476
6926
  }
6477
- async __delete(id, requestOptions) {
6927
+ async __list(request = {}, requestOptions) {
6478
6928
  var _a2, _b, _c, _d, _e, _f, _g, _h;
6929
+ const { page, limit } = request;
6930
+ const _queryParams = {};
6931
+ if (page != null) {
6932
+ _queryParams["page"] = page.toString();
6933
+ }
6934
+ if (limit != null) {
6935
+ _queryParams["limit"] = limit.toString();
6936
+ }
6479
6937
  let _headers = mergeHeaders(
6480
6938
  (_a2 = this._options) == null ? void 0 : _a2.headers,
6481
6939
  mergeOnlyDefinedHeaders({
@@ -6489,17 +6947,20 @@ var Models = class {
6489
6947
  const _response = await fetcher({
6490
6948
  url: url_exports.join(
6491
6949
  (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
6492
- `/api/public/models/${encodeURIComponent(id)}`
6950
+ "/api/public/models"
6493
6951
  ),
6494
- method: "DELETE",
6952
+ method: "GET",
6495
6953
  headers: _headers,
6496
- queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
6954
+ queryParameters: { ..._queryParams, ...requestOptions == null ? void 0 : requestOptions.queryParams },
6497
6955
  timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
6498
6956
  maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
6499
6957
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
6500
6958
  });
6501
6959
  if (_response.ok) {
6502
- return { data: void 0, rawResponse: _response.rawResponse };
6960
+ return {
6961
+ data: _response.body,
6962
+ rawResponse: _response.rawResponse
6963
+ };
6503
6964
  }
6504
6965
  if (_response.error.reason === "status-code") {
6505
6966
  switch (_response.error.statusCode) {
@@ -6545,7 +7006,7 @@ var Models = class {
6545
7006
  });
6546
7007
  case "timeout":
6547
7008
  throw new LangfuseAPITimeoutError(
6548
- "Timeout exceeded when calling DELETE /api/public/models/{id}."
7009
+ "Timeout exceeded when calling GET /api/public/models."
6549
7010
  );
6550
7011
  case "unknown":
6551
7012
  throw new LangfuseAPIError({
@@ -6554,52 +7015,11 @@ var Models = class {
6554
7015
  });
6555
7016
  }
6556
7017
  }
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
7018
  /**
6576
- * Get a list of observations with cursor-based pagination and flexible field selection.
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.
7019
+ * Get a model
6600
7020
  *
6601
- * @param {LangfuseAPI.GetObservationsV2Request} request
6602
- * @param {ObservationsV2.RequestOptions} requestOptions - Request-specific configuration.
7021
+ * @param {string} id
7022
+ * @param {Models.RequestOptions} requestOptions - Request-specific configuration.
6603
7023
  *
6604
7024
  * @throws {@link LangfuseAPI.Error}
6605
7025
  * @throws {@link LangfuseAPI.UnauthorizedError}
@@ -6608,86 +7028,13 @@ var ObservationsV2 = class {
6608
7028
  * @throws {@link LangfuseAPI.NotFoundError}
6609
7029
  *
6610
7030
  * @example
6611
- * await client.observationsV2.getMany()
7031
+ * await client.models.get("id")
6612
7032
  */
6613
- getMany(request = {}, requestOptions) {
6614
- return HttpResponsePromise.fromPromise(
6615
- this.__getMany(request, requestOptions)
6616
- );
7033
+ get(id, requestOptions) {
7034
+ return HttpResponsePromise.fromPromise(this.__get(id, requestOptions));
6617
7035
  }
6618
- async __getMany(request = {}, requestOptions) {
7036
+ async __get(id, requestOptions) {
6619
7037
  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
7038
  let _headers = mergeHeaders(
6692
7039
  (_a2 = this._options) == null ? void 0 : _a2.headers,
6693
7040
  mergeOnlyDefinedHeaders({
@@ -6701,11 +7048,11 @@ var ObservationsV2 = class {
6701
7048
  const _response = await fetcher({
6702
7049
  url: url_exports.join(
6703
7050
  (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
6704
- "/api/public/v2/observations"
7051
+ `/api/public/models/${encodeURIComponent(id)}`
6705
7052
  ),
6706
7053
  method: "GET",
6707
7054
  headers: _headers,
6708
- queryParameters: { ..._queryParams, ...requestOptions == null ? void 0 : requestOptions.queryParams },
7055
+ queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
6709
7056
  timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
6710
7057
  maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
6711
7058
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
@@ -6760,7 +7107,7 @@ var ObservationsV2 = class {
6760
7107
  });
6761
7108
  case "timeout":
6762
7109
  throw new LangfuseAPITimeoutError(
6763
- "Timeout exceeded when calling GET /api/public/v2/observations."
7110
+ "Timeout exceeded when calling GET /api/public/models/{id}."
6764
7111
  );
6765
7112
  case "unknown":
6766
7113
  throw new LangfuseAPIError({
@@ -6769,29 +7116,11 @@ var ObservationsV2 = class {
6769
7116
  });
6770
7117
  }
6771
7118
  }
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
7119
  /**
6791
- * Get a observation
7120
+ * 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
7121
  *
6793
- * @param {string} observationId - The unique langfuse identifier of an observation, can be an event, span or generation
6794
- * @param {Observations.RequestOptions} requestOptions - Request-specific configuration.
7122
+ * @param {string} id
7123
+ * @param {Models.RequestOptions} requestOptions - Request-specific configuration.
6795
7124
  *
6796
7125
  * @throws {@link LangfuseAPI.Error}
6797
7126
  * @throws {@link LangfuseAPI.UnauthorizedError}
@@ -6800,14 +7129,14 @@ var Observations = class {
6800
7129
  * @throws {@link LangfuseAPI.NotFoundError}
6801
7130
  *
6802
7131
  * @example
6803
- * await client.observations.get("observationId")
7132
+ * await client.models.delete("id")
6804
7133
  */
6805
- get(observationId, requestOptions) {
7134
+ delete(id, requestOptions) {
6806
7135
  return HttpResponsePromise.fromPromise(
6807
- this.__get(observationId, requestOptions)
7136
+ this.__delete(id, requestOptions)
6808
7137
  );
6809
7138
  }
6810
- async __get(observationId, requestOptions) {
7139
+ async __delete(id, requestOptions) {
6811
7140
  var _a2, _b, _c, _d, _e, _f, _g, _h;
6812
7141
  let _headers = mergeHeaders(
6813
7142
  (_a2 = this._options) == null ? void 0 : _a2.headers,
@@ -6822,9 +7151,9 @@ var Observations = class {
6822
7151
  const _response = await fetcher({
6823
7152
  url: url_exports.join(
6824
7153
  (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
6825
- `/api/public/observations/${encodeURIComponent(observationId)}`
7154
+ `/api/public/models/${encodeURIComponent(id)}`
6826
7155
  ),
6827
- method: "GET",
7156
+ method: "DELETE",
6828
7157
  headers: _headers,
6829
7158
  queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
6830
7159
  timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
@@ -6832,10 +7161,7 @@ var Observations = class {
6832
7161
  abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
6833
7162
  });
6834
7163
  if (_response.ok) {
6835
- return {
6836
- data: _response.body,
6837
- rawResponse: _response.rawResponse
6838
- };
7164
+ return { data: void 0, rawResponse: _response.rawResponse };
6839
7165
  }
6840
7166
  if (_response.error.reason === "status-code") {
6841
7167
  switch (_response.error.statusCode) {
@@ -6881,7 +7207,7 @@ var Observations = class {
6881
7207
  });
6882
7208
  case "timeout":
6883
7209
  throw new LangfuseAPITimeoutError(
6884
- "Timeout exceeded when calling GET /api/public/observations/{observationId}."
7210
+ "Timeout exceeded when calling DELETE /api/public/models/{id}."
6885
7211
  );
6886
7212
  case "unknown":
6887
7213
  throw new LangfuseAPIError({
@@ -6890,12 +7216,51 @@ var Observations = class {
6890
7216
  });
6891
7217
  }
6892
7218
  }
7219
+ async _getAuthorizationHeader() {
7220
+ const username = await Supplier.get(this._options.username);
7221
+ const password = await Supplier.get(this._options.password);
7222
+ if (username != null && password != null) {
7223
+ return BasicAuth.toAuthorizationHeader({
7224
+ username,
7225
+ password
7226
+ });
7227
+ }
7228
+ return void 0;
7229
+ }
7230
+ };
7231
+
7232
+ // src/api/api/resources/observations/client/Client.ts
7233
+ var Observations = class {
7234
+ constructor(_options) {
7235
+ this._options = _options;
7236
+ }
6893
7237
  /**
6894
- * Get a list of observations.
7238
+ * Get a list of observations with cursor-based pagination and flexible field selection.
6895
7239
  *
6896
- * Consider using the [v2 observations endpoint](/api-reference#tag/observationsv2/GET/api/public/v2/observations) for cursor-based pagination and field selection.
7240
+ * ## Cursor-based Pagination
7241
+ * This endpoint uses cursor-based pagination for efficient traversal of large datasets.
7242
+ * The cursor is returned in the response metadata and should be passed in subsequent requests
7243
+ * to retrieve the next page of results.
7244
+ *
7245
+ * ## Field Selection
7246
+ * Use the `fields` parameter to control which observation fields are returned:
7247
+ * - `core` - Always included: id, traceId, startTime, endTime, projectId, parentObservationId, type
7248
+ * - `basic` - name, level, statusMessage, version, environment, bookmarked, public, userId, sessionId
7249
+ * - `time` - completionStartTime, createdAt, updatedAt
7250
+ * - `io` - input, output
7251
+ * - `metadata` - metadata (truncated to 200 chars by default, use `expandMetadata` to get full values)
7252
+ * - `model` - providedModelName, internalModelId, modelParameters
7253
+ * - `usage` - usageDetails, costDetails, totalCost
7254
+ * - `prompt` - promptId, promptName, promptVersion
7255
+ * - `metrics` - latency, timeToFirstToken
7256
+ *
7257
+ * If not specified, `core` and `basic` field groups are returned.
7258
+ *
7259
+ * ## Filters
7260
+ * Multiple filtering options are available via query parameters or the structured `filter` parameter.
7261
+ * When using the `filter` parameter, it takes precedence over individual query parameter filters.
6897
7262
  *
6898
- * @param {LangfuseAPI.GetObservationsRequest} request
7263
+ * @param {LangfuseAPI.GetObservationsV2Request} request
6899
7264
  * @param {Observations.RequestOptions} requestOptions - Request-specific configuration.
6900
7265
  *
6901
7266
  * @throws {@link LangfuseAPI.Error}
@@ -6915,8 +7280,11 @@ var Observations = class {
6915
7280
  async __getMany(request = {}, requestOptions) {
6916
7281
  var _a2, _b, _c, _d, _e, _f, _g, _h;
6917
7282
  const {
6918
- page,
7283
+ fields,
7284
+ expandMetadata,
6919
7285
  limit,
7286
+ cursor,
7287
+ parseIoAsJson,
6920
7288
  name,
6921
7289
  userId,
6922
7290
  type: type_,
@@ -6930,12 +7298,21 @@ var Observations = class {
6930
7298
  filter
6931
7299
  } = request;
6932
7300
  const _queryParams = {};
6933
- if (page != null) {
6934
- _queryParams["page"] = page.toString();
7301
+ if (fields != null) {
7302
+ _queryParams["fields"] = fields;
7303
+ }
7304
+ if (expandMetadata != null) {
7305
+ _queryParams["expandMetadata"] = expandMetadata;
6935
7306
  }
6936
7307
  if (limit != null) {
6937
7308
  _queryParams["limit"] = limit.toString();
6938
7309
  }
7310
+ if (cursor != null) {
7311
+ _queryParams["cursor"] = cursor;
7312
+ }
7313
+ if (parseIoAsJson != null) {
7314
+ _queryParams["parseIoAsJson"] = parseIoAsJson.toString();
7315
+ }
6939
7316
  if (name != null) {
6940
7317
  _queryParams["name"] = name;
6941
7318
  }
@@ -6986,7 +7363,7 @@ var Observations = class {
6986
7363
  const _response = await fetcher({
6987
7364
  url: url_exports.join(
6988
7365
  (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
6989
- "/api/public/observations"
7366
+ "/api/public/v2/observations"
6990
7367
  ),
6991
7368
  method: "GET",
6992
7369
  headers: _headers,
@@ -7045,7 +7422,7 @@ var Observations = class {
7045
7422
  });
7046
7423
  case "timeout":
7047
7424
  throw new LangfuseAPITimeoutError(
7048
- "Timeout exceeded when calling GET /api/public/observations."
7425
+ "Timeout exceeded when calling GET /api/public/v2/observations."
7049
7426
  );
7050
7427
  case "unknown":
7051
7428
  throw new LangfuseAPIError({
@@ -9024,7 +9401,7 @@ var Prompts = class {
9024
9401
  }
9025
9402
  async __get(promptName, request = {}, requestOptions) {
9026
9403
  var _a2, _b, _c, _d, _e, _f, _g, _h;
9027
- const { version, label } = request;
9404
+ const { version, label, resolve } = request;
9028
9405
  const _queryParams = {};
9029
9406
  if (version != null) {
9030
9407
  _queryParams["version"] = version.toString();
@@ -9032,6 +9409,9 @@ var Prompts = class {
9032
9409
  if (label != null) {
9033
9410
  _queryParams["label"] = label;
9034
9411
  }
9412
+ if (resolve != null) {
9413
+ _queryParams["resolve"] = resolve.toString();
9414
+ }
9035
9415
  let _headers = mergeHeaders(
9036
9416
  (_a2 = this._options) == null ? void 0 : _a2.headers,
9037
9417
  mergeOnlyDefinedHeaders({
@@ -10700,8 +11080,8 @@ var ScoreConfigs = class {
10700
11080
  }
10701
11081
  };
10702
11082
 
10703
- // src/api/api/resources/scoreV2/client/Client.ts
10704
- var ScoreV2 = class {
11083
+ // src/api/api/resources/scores/client/Client.ts
11084
+ var Scores = class {
10705
11085
  constructor(_options) {
10706
11086
  this._options = _options;
10707
11087
  }
@@ -10709,7 +11089,7 @@ var ScoreV2 = class {
10709
11089
  * Get a list of scores (supports both trace and session scores)
10710
11090
  *
10711
11091
  * @param {LangfuseAPI.GetScoresRequest} request
10712
- * @param {ScoreV2.RequestOptions} requestOptions - Request-specific configuration.
11092
+ * @param {Scores.RequestOptions} requestOptions - Request-specific configuration.
10713
11093
  *
10714
11094
  * @throws {@link LangfuseAPI.Error}
10715
11095
  * @throws {@link LangfuseAPI.UnauthorizedError}
@@ -10718,14 +11098,14 @@ var ScoreV2 = class {
10718
11098
  * @throws {@link LangfuseAPI.NotFoundError}
10719
11099
  *
10720
11100
  * @example
10721
- * await client.scoreV2.get()
11101
+ * await client.scores.getMany()
10722
11102
  */
10723
- get(request = {}, requestOptions) {
11103
+ getMany(request = {}, requestOptions) {
10724
11104
  return HttpResponsePromise.fromPromise(
10725
- this.__get(request, requestOptions)
11105
+ this.__getMany(request, requestOptions)
10726
11106
  );
10727
11107
  }
10728
- async __get(request = {}, requestOptions) {
11108
+ async __getMany(request = {}, requestOptions) {
10729
11109
  var _a2, _b, _c, _d, _e, _f, _g, _h;
10730
11110
  const {
10731
11111
  page,
@@ -10907,7 +11287,7 @@ var ScoreV2 = class {
10907
11287
  * Get a score (supports both trace and session scores)
10908
11288
  *
10909
11289
  * @param {string} scoreId - The unique langfuse identifier of a score
10910
- * @param {ScoreV2.RequestOptions} requestOptions - Request-specific configuration.
11290
+ * @param {Scores.RequestOptions} requestOptions - Request-specific configuration.
10911
11291
  *
10912
11292
  * @throws {@link LangfuseAPI.Error}
10913
11293
  * @throws {@link LangfuseAPI.UnauthorizedError}
@@ -10916,7 +11296,7 @@ var ScoreV2 = class {
10916
11296
  * @throws {@link LangfuseAPI.NotFoundError}
10917
11297
  *
10918
11298
  * @example
10919
- * await client.scoreV2.getById("scoreId")
11299
+ * await client.scores.getById("scoreId")
10920
11300
  */
10921
11301
  getById(scoreId, requestOptions) {
10922
11302
  return HttpResponsePromise.fromPromise(
@@ -11019,244 +11399,6 @@ var ScoreV2 = class {
11019
11399
  }
11020
11400
  };
11021
11401
 
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
11402
  // src/api/api/resources/sessions/client/Client.ts
11261
11403
  var Sessions = class {
11262
11404
  constructor(_options) {
@@ -12053,6 +12195,10 @@ var LangfuseAPIClient = class {
12053
12195
  var _a2;
12054
12196
  return (_a2 = this._ingestion) != null ? _a2 : this._ingestion = new Ingestion(this._options);
12055
12197
  }
12198
+ get legacy() {
12199
+ var _a2;
12200
+ return (_a2 = this._legacy) != null ? _a2 : this._legacy = new Legacy(this._options);
12201
+ }
12056
12202
  get llmConnections() {
12057
12203
  var _a2;
12058
12204
  return (_a2 = this._llmConnections) != null ? _a2 : this._llmConnections = new LlmConnections(this._options);
@@ -12061,10 +12207,6 @@ var LangfuseAPIClient = class {
12061
12207
  var _a2;
12062
12208
  return (_a2 = this._media) != null ? _a2 : this._media = new Media(this._options);
12063
12209
  }
12064
- get metricsV2() {
12065
- var _a2;
12066
- return (_a2 = this._metricsV2) != null ? _a2 : this._metricsV2 = new MetricsV2(this._options);
12067
- }
12068
12210
  get metrics() {
12069
12211
  var _a2;
12070
12212
  return (_a2 = this._metrics) != null ? _a2 : this._metrics = new Metrics(this._options);
@@ -12073,10 +12215,6 @@ var LangfuseAPIClient = class {
12073
12215
  var _a2;
12074
12216
  return (_a2 = this._models) != null ? _a2 : this._models = new Models(this._options);
12075
12217
  }
12076
- get observationsV2() {
12077
- var _a2;
12078
- return (_a2 = this._observationsV2) != null ? _a2 : this._observationsV2 = new ObservationsV2(this._options);
12079
- }
12080
12218
  get observations() {
12081
12219
  var _a2;
12082
12220
  return (_a2 = this._observations) != null ? _a2 : this._observations = new Observations(this._options);
@@ -12109,13 +12247,9 @@ var LangfuseAPIClient = class {
12109
12247
  var _a2;
12110
12248
  return (_a2 = this._scoreConfigs) != null ? _a2 : this._scoreConfigs = new ScoreConfigs(this._options);
12111
12249
  }
12112
- get scoreV2() {
12113
- var _a2;
12114
- return (_a2 = this._scoreV2) != null ? _a2 : this._scoreV2 = new ScoreV2(this._options);
12115
- }
12116
- get score() {
12250
+ get scores() {
12117
12251
  var _a2;
12118
- return (_a2 = this._score) != null ? _a2 : this._score = new Score(this._options);
12252
+ return (_a2 = this._scores) != null ? _a2 : this._scores = new Scores(this._options);
12119
12253
  }
12120
12254
  get sessions() {
12121
12255
  var _a2;
@@ -12694,6 +12828,7 @@ function getSpanKeyFromBaggageKey(baggageKey) {
12694
12828
  BlobStorageExportMode,
12695
12829
  BlobStorageIntegrationFileType,
12696
12830
  BlobStorageIntegrationType,
12831
+ BlobStorageSyncStatus,
12697
12832
  ChatMessageType,
12698
12833
  CommentObjectType,
12699
12834
  CreateChatPromptType,
@@ -12749,14 +12884,13 @@ function getSpanKeyFromBaggageKey(baggageKey) {
12749
12884
  getPropagatedAttributesFromContext,
12750
12885
  health,
12751
12886
  ingestion,
12887
+ legacy,
12752
12888
  llmConnections,
12753
12889
  logger,
12754
12890
  media,
12755
12891
  metrics,
12756
- metricsV2,
12757
12892
  models,
12758
12893
  observations,
12759
- observationsV2,
12760
12894
  opentelemetry,
12761
12895
  organizations,
12762
12896
  projects,
@@ -12766,9 +12900,8 @@ function getSpanKeyFromBaggageKey(baggageKey) {
12766
12900
  resetGlobalLogger,
12767
12901
  safeSetTimeout,
12768
12902
  scim,
12769
- score,
12770
12903
  scoreConfigs,
12771
- scoreV2,
12904
+ scores,
12772
12905
  serializeValue,
12773
12906
  sessions,
12774
12907
  trace,