@langfuse/core 5.5.0-beta.2 → 5.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -387,7 +387,7 @@ var resetGlobalLogger = () => {
387
387
  // package.json
388
388
  var package_default = {
389
389
  name: "@langfuse/core",
390
- version: "5.5.0-beta.2",
390
+ version: "5.5.0",
391
391
  description: "Core functions and utilities for Langfuse packages",
392
392
  type: "module",
393
393
  sideEffects: false,
@@ -11557,15 +11557,22 @@ var ScoresV3 = class {
11557
11557
  /**
11558
11558
  * Get a list of scores with a polymorphic `value` field (v3).
11559
11559
  *
11560
- * This endpoint requires Langfuse v4 or later.
11561
- *
11562
11560
  * The `value` field type depends on `dataType`:
11563
11561
  * - `NUMERIC` → number
11564
11562
  * - `BOOLEAN` → boolean
11565
11563
  * - `CATEGORICAL`, `TEXT`, `CORRECTION` → string
11566
11564
  *
11567
- * Use the `fields` parameter to include optional field groups beyond the
11568
- * default `core`. Unknown group names return HTTP 400.
11565
+ * The response always includes the core fields: id, projectId, name,
11566
+ * value, dataType, source, timestamp, environment, createdAt, updatedAt.
11567
+ *
11568
+ * Additional field groups can be requested via the `fields` parameter:
11569
+ * - `details` — adds comment, configId, metadata
11570
+ * - `subject` — adds the subject object describing the entity the score
11571
+ * is attached to: kind (trace, observation, session, or experiment),
11572
+ * id, and traceId for observation-level scores
11573
+ * - `annotation` — adds authorUserId, queueId
11574
+ *
11575
+ * Unknown group names return HTTP 400.
11569
11576
  *
11570
11577
  * @param {LangfuseAPI.GetScoresV3Request} request
11571
11578
  * @param {ScoresV3.RequestOptions} requestOptions - Request-specific configuration.
@@ -11769,6 +11776,9 @@ var Scores = class {
11769
11776
  this._options = _options;
11770
11777
  }
11771
11778
  /**
11779
+ * **Deprecated.** Use `GET /api/public/v3/scores` instead. This endpoint
11780
+ * is no longer available on Langfuse v4 and later.
11781
+ *
11772
11782
  * Get a list of scores (supports both trace and session scores)
11773
11783
  *
11774
11784
  * @param {LangfuseAPI.GetScoresRequest} request
@@ -11967,6 +11977,9 @@ var Scores = class {
11967
11977
  }
11968
11978
  }
11969
11979
  /**
11980
+ * **Deprecated.** Use `GET /api/public/v3/scores` with the `id` filter
11981
+ * instead. This endpoint is no longer available on Langfuse v4 and later.
11982
+ *
11970
11983
  * Get a score (supports both trace and session scores)
11971
11984
  *
11972
11985
  * @param {string} scoreId - The unique langfuse identifier of a score
@@ -14262,6 +14275,163 @@ var Evaluators = class {
14262
14275
  });
14263
14276
  }
14264
14277
  }
14278
+ /**
14279
+ * Delete an evaluator.
14280
+ *
14281
+ * Important behavior:
14282
+ * - This deletes the evaluator including all of its stored versions; `evaluatorId` may reference any version.
14283
+ * - The API returns `409` while evaluation rules still reference the evaluator. Delete those evaluation rules first.
14284
+ * - Langfuse-managed evaluators (`scope=managed`) cannot be deleted; the API returns `403`.
14285
+ * - Scores already produced by the evaluator are not deleted.
14286
+ *
14287
+ * @param {string} evaluatorId - Evaluator identifier returned by the evaluator endpoints.
14288
+ * @param {Evaluators.RequestOptions} requestOptions - Request-specific configuration.
14289
+ *
14290
+ * @throws {@link LangfuseAPI.unstable.BadRequestError}
14291
+ * @throws {@link LangfuseAPI.unstable.UnauthorizedError}
14292
+ * @throws {@link LangfuseAPI.unstable.AccessDeniedError}
14293
+ * @throws {@link LangfuseAPI.unstable.NotFoundError}
14294
+ * @throws {@link LangfuseAPI.unstable.MethodNotAllowedError}
14295
+ * @throws {@link LangfuseAPI.unstable.ConflictError}
14296
+ * @throws {@link LangfuseAPI.unstable.TooManyRequestsError}
14297
+ * @throws {@link LangfuseAPI.unstable.InternalServerError}
14298
+ * @throws {@link LangfuseAPI.Error}
14299
+ * @throws {@link LangfuseAPI.UnauthorizedError}
14300
+ * @throws {@link LangfuseAPI.AccessDeniedError}
14301
+ * @throws {@link LangfuseAPI.MethodNotAllowedError}
14302
+ * @throws {@link LangfuseAPI.NotFoundError}
14303
+ *
14304
+ * @example
14305
+ * await client.unstable.evaluators.delete("evaluatorId")
14306
+ */
14307
+ delete(evaluatorId, requestOptions) {
14308
+ return HttpResponsePromise.fromPromise(
14309
+ this.__delete(evaluatorId, requestOptions)
14310
+ );
14311
+ }
14312
+ async __delete(evaluatorId, requestOptions) {
14313
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
14314
+ let _headers = mergeHeaders(
14315
+ (_a2 = this._options) == null ? void 0 : _a2.headers,
14316
+ mergeOnlyDefinedHeaders({
14317
+ Authorization: await this._getAuthorizationHeader(),
14318
+ "X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
14319
+ "X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
14320
+ "X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
14321
+ }),
14322
+ requestOptions == null ? void 0 : requestOptions.headers
14323
+ );
14324
+ const _response = await fetcher({
14325
+ url: url_exports.join(
14326
+ (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
14327
+ `/api/public/unstable/evaluators/${encodeURIComponent(evaluatorId)}`
14328
+ ),
14329
+ method: "DELETE",
14330
+ headers: _headers,
14331
+ queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
14332
+ timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
14333
+ maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
14334
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
14335
+ });
14336
+ if (_response.ok) {
14337
+ return {
14338
+ data: _response.body,
14339
+ rawResponse: _response.rawResponse
14340
+ };
14341
+ }
14342
+ if (_response.error.reason === "status-code") {
14343
+ switch (_response.error.statusCode) {
14344
+ case 400:
14345
+ throw new unstable_exports.BadRequestError(
14346
+ _response.error.body,
14347
+ _response.rawResponse
14348
+ );
14349
+ case 401:
14350
+ throw new unstable_exports.UnauthorizedError(
14351
+ _response.error.body,
14352
+ _response.rawResponse
14353
+ );
14354
+ case 403:
14355
+ throw new unstable_exports.AccessDeniedError(
14356
+ _response.error.body,
14357
+ _response.rawResponse
14358
+ );
14359
+ case 404:
14360
+ throw new unstable_exports.NotFoundError(
14361
+ _response.error.body,
14362
+ _response.rawResponse
14363
+ );
14364
+ case 405:
14365
+ throw new unstable_exports.MethodNotAllowedError(
14366
+ _response.error.body,
14367
+ _response.rawResponse
14368
+ );
14369
+ case 409:
14370
+ throw new unstable_exports.ConflictError(
14371
+ _response.error.body,
14372
+ _response.rawResponse
14373
+ );
14374
+ case 429:
14375
+ throw new unstable_exports.TooManyRequestsError(
14376
+ _response.error.body,
14377
+ _response.rawResponse
14378
+ );
14379
+ case 500:
14380
+ throw new unstable_exports.InternalServerError(
14381
+ _response.error.body,
14382
+ _response.rawResponse
14383
+ );
14384
+ case 400:
14385
+ throw new Error2(
14386
+ _response.error.body,
14387
+ _response.rawResponse
14388
+ );
14389
+ case 401:
14390
+ throw new UnauthorizedError(
14391
+ _response.error.body,
14392
+ _response.rawResponse
14393
+ );
14394
+ case 403:
14395
+ throw new AccessDeniedError(
14396
+ _response.error.body,
14397
+ _response.rawResponse
14398
+ );
14399
+ case 405:
14400
+ throw new MethodNotAllowedError(
14401
+ _response.error.body,
14402
+ _response.rawResponse
14403
+ );
14404
+ case 404:
14405
+ throw new NotFoundError(
14406
+ _response.error.body,
14407
+ _response.rawResponse
14408
+ );
14409
+ default:
14410
+ throw new LangfuseAPIError({
14411
+ statusCode: _response.error.statusCode,
14412
+ body: _response.error.body,
14413
+ rawResponse: _response.rawResponse
14414
+ });
14415
+ }
14416
+ }
14417
+ switch (_response.error.reason) {
14418
+ case "non-json":
14419
+ throw new LangfuseAPIError({
14420
+ statusCode: _response.error.statusCode,
14421
+ body: _response.error.rawBody,
14422
+ rawResponse: _response.rawResponse
14423
+ });
14424
+ case "timeout":
14425
+ throw new LangfuseAPITimeoutError(
14426
+ "Timeout exceeded when calling DELETE /api/public/unstable/evaluators/{evaluatorId}."
14427
+ );
14428
+ case "unknown":
14429
+ throw new LangfuseAPIError({
14430
+ message: _response.error.errorMessage,
14431
+ rawResponse: _response.rawResponse
14432
+ });
14433
+ }
14434
+ }
14265
14435
  async _getAuthorizationHeader() {
14266
14436
  const username = await Supplier.get(this._options.username);
14267
14437
  const password = await Supplier.get(this._options.password);