@langfuse/core 5.10.1 → 5.11.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
@@ -23,6 +23,7 @@ __export(index_exports, {
23
23
  AccessDeniedError: () => AccessDeniedError,
24
24
  AnnotationQueueObjectType: () => AnnotationQueueObjectType,
25
25
  AnnotationQueueStatus: () => AnnotationQueueStatus,
26
+ BadRequestError: () => BadRequestError,
26
27
  BlobStorageExportFieldGroup: () => BlobStorageExportFieldGroup,
27
28
  BlobStorageExportFrequency: () => BlobStorageExportFrequency,
28
29
  BlobStorageExportMode: () => BlobStorageExportMode,
@@ -32,15 +33,31 @@ __export(index_exports, {
32
33
  BlobStorageIntegrationType: () => BlobStorageIntegrationType,
33
34
  BlobStorageSyncStatus: () => BlobStorageSyncStatus,
34
35
  ChatMessageType: () => ChatMessageType,
36
+ CodeEvaluatorSourceCodeLanguage: () => CodeEvaluatorSourceCodeLanguage,
35
37
  CommentObjectType: () => CommentObjectType,
38
+ ConflictError: () => ConflictError,
36
39
  CreateChatPromptType: () => CreateChatPromptType,
37
40
  CreateScoreSource: () => CreateScoreSource,
38
41
  CreateTextPromptType: () => CreateTextPromptType,
39
42
  DatasetItemMediaReferenceField: () => DatasetItemMediaReferenceField,
40
43
  DatasetStatus: () => DatasetStatus,
41
44
  Error: () => Error2,
45
+ EvaluationAccessDeniedError: () => EvaluationAccessDeniedError,
46
+ EvaluationMethodNotAllowedError: () => EvaluationMethodNotAllowedError,
47
+ EvaluationNotFoundError: () => EvaluationNotFoundError,
48
+ EvaluationRuleArrayOptionsFilterOperator: () => EvaluationRuleArrayOptionsFilterOperator,
49
+ EvaluationRuleBooleanFilterOperator: () => EvaluationRuleBooleanFilterOperator,
50
+ EvaluationRuleNullFilterOperator: () => EvaluationRuleNullFilterOperator,
51
+ EvaluationRuleNumberFilterOperator: () => EvaluationRuleNumberFilterOperator,
52
+ EvaluationRuleOptionsFilterOperator: () => EvaluationRuleOptionsFilterOperator,
53
+ EvaluationRuleStringFilterOperator: () => EvaluationRuleStringFilterOperator,
54
+ EvaluationUnauthorizedError: () => EvaluationUnauthorizedError,
55
+ EvaluatorOutputScoreType: () => EvaluatorOutputScoreType,
56
+ EvaluatorStatus: () => EvaluatorStatus,
57
+ EvaluatorType: () => EvaluatorType,
42
58
  FeedbackNotConfiguredError: () => FeedbackNotConfiguredError,
43
59
  FeedbackTargetType: () => FeedbackTargetType,
60
+ InternalServerError: () => InternalServerError,
44
61
  LANGFUSE_SDK_EXPERIMENT_ENVIRONMENT: () => LANGFUSE_SDK_EXPERIMENT_ENVIRONMENT,
45
62
  LANGFUSE_SDK_NAME: () => LANGFUSE_SDK_NAME,
46
63
  LANGFUSE_SDK_VERSION: () => LANGFUSE_SDK_VERSION,
@@ -53,23 +70,30 @@ __export(index_exports, {
53
70
  LangfuseMediaReference: () => LangfuseMediaReference,
54
71
  LangfuseOtelContextKeys: () => LangfuseOtelContextKeys,
55
72
  LangfuseOtelSpanAttributes: () => LangfuseOtelSpanAttributes,
73
+ LegacyEvaluationObject: () => LegacyEvaluationObject,
56
74
  LlmAdapter: () => LlmAdapter,
57
75
  LogLevel: () => LogLevel,
58
76
  Logger: () => Logger,
59
77
  MediaContentType: () => MediaContentType,
60
78
  MembershipRole: () => MembershipRole,
61
79
  MethodNotAllowedError: () => MethodNotAllowedError,
80
+ ModelTokenizerId: () => ModelTokenizerId,
62
81
  ModelUsageUnit: () => ModelUsageUnit,
63
82
  NotFoundError: () => NotFoundError,
64
83
  ObservationLevel: () => ObservationLevel,
65
84
  ObservationType: () => ObservationType,
66
85
  PlaceholderMessageType: () => PlaceholderMessageType,
86
+ PreconditionFailedError: () => PreconditionFailedError,
87
+ PricingTierAttributeSource: () => PricingTierAttributeSource,
67
88
  PricingTierOperator: () => PricingTierOperator,
68
89
  PromptType: () => PromptType,
90
+ PromptVariableMappingSource: () => PromptVariableMappingSource,
91
+ PublicApiErrorCode: () => PublicApiErrorCode,
69
92
  ScoreConfigDataType: () => ScoreConfigDataType,
70
93
  ScoreDataType: () => ScoreDataType,
71
94
  ScoreSource: () => ScoreSource,
72
95
  ServiceUnavailableError: () => ServiceUnavailableError,
96
+ TooManyRequestsError: () => TooManyRequestsError,
73
97
  UnauthorizedError: () => UnauthorizedError,
74
98
  annotationQueues: () => annotationQueues_exports,
75
99
  base64Decode: () => base64Decode,
@@ -86,6 +110,10 @@ __export(index_exports, {
86
110
  datasetItems: () => datasetItems_exports,
87
111
  datasetRunItems: () => datasetRunItems_exports,
88
112
  datasets: () => datasets_exports,
113
+ evaluationCommons: () => evaluationCommons_exports,
114
+ evaluationErrors: () => evaluationErrors_exports,
115
+ evaluationRules: () => evaluationRules_exports,
116
+ evaluators: () => evaluators_exports,
89
117
  experiments: () => experiments_exports,
90
118
  feedback: () => feedback_exports,
91
119
  generateUUID: () => generateUUID,
@@ -396,7 +424,7 @@ var resetGlobalLogger = () => {
396
424
  // package.json
397
425
  var package_default = {
398
426
  name: "@langfuse/core",
399
- version: "5.10.1",
427
+ version: "5.11.0",
400
428
  description: "Core functions and utilities for Langfuse packages",
401
429
  type: "module",
402
430
  sideEffects: false,
@@ -605,6 +633,7 @@ __export(commons_exports, {
605
633
  ModelUsageUnit: () => ModelUsageUnit,
606
634
  NotFoundError: () => NotFoundError,
607
635
  ObservationLevel: () => ObservationLevel,
636
+ PricingTierAttributeSource: () => PricingTierAttributeSource,
608
637
  PricingTierOperator: () => PricingTierOperator,
609
638
  ScoreConfigDataType: () => ScoreConfigDataType,
610
639
  ScoreDataType: () => ScoreDataType,
@@ -619,6 +648,12 @@ var DatasetItemMediaReferenceField = {
619
648
  Metadata: "metadata"
620
649
  };
621
650
 
651
+ // src/api/api/resources/commons/types/PricingTierAttributeSource.ts
652
+ var PricingTierAttributeSource = {
653
+ ModelParameters: "model_parameters",
654
+ Metadata: "metadata"
655
+ };
656
+
622
657
  // src/api/api/resources/commons/types/PricingTierOperator.ts
623
658
  var PricingTierOperator = {
624
659
  Gt: "gt",
@@ -808,6 +843,271 @@ var datasetRunItems_exports = {};
808
843
  // src/api/api/resources/datasets/index.ts
809
844
  var datasets_exports = {};
810
845
 
846
+ // src/api/api/resources/evaluationCommons/index.ts
847
+ var evaluationCommons_exports = {};
848
+ __export(evaluationCommons_exports, {
849
+ CodeEvaluatorSourceCodeLanguage: () => CodeEvaluatorSourceCodeLanguage,
850
+ EvaluationRuleArrayOptionsFilterOperator: () => EvaluationRuleArrayOptionsFilterOperator,
851
+ EvaluationRuleBooleanFilterOperator: () => EvaluationRuleBooleanFilterOperator,
852
+ EvaluationRuleNullFilterOperator: () => EvaluationRuleNullFilterOperator,
853
+ EvaluationRuleNumberFilterOperator: () => EvaluationRuleNumberFilterOperator,
854
+ EvaluationRuleOptionsFilterOperator: () => EvaluationRuleOptionsFilterOperator,
855
+ EvaluationRuleStringFilterOperator: () => EvaluationRuleStringFilterOperator,
856
+ EvaluatorOutputScoreType: () => EvaluatorOutputScoreType,
857
+ EvaluatorType: () => EvaluatorType,
858
+ LegacyEvaluationObject: () => LegacyEvaluationObject,
859
+ PromptVariableMappingSource: () => PromptVariableMappingSource
860
+ });
861
+
862
+ // src/api/api/resources/evaluationCommons/types/EvaluatorType.ts
863
+ var EvaluatorType = {
864
+ LlmAsJudge: "llm_as_judge",
865
+ Code: "code"
866
+ };
867
+
868
+ // src/api/api/resources/evaluationCommons/types/CodeEvaluatorSourceCodeLanguage.ts
869
+ var CodeEvaluatorSourceCodeLanguage = {
870
+ Python: "PYTHON",
871
+ Typescript: "TYPESCRIPT"
872
+ };
873
+
874
+ // src/api/api/resources/evaluationCommons/types/PromptVariableMappingSource.ts
875
+ var PromptVariableMappingSource = {
876
+ Input: "input",
877
+ Output: "output",
878
+ Metadata: "metadata",
879
+ ToolCalls: "tool_calls",
880
+ ExpectedOutput: "expected_output",
881
+ ExperimentItemMetadata: "experiment_item_metadata"
882
+ };
883
+
884
+ // src/api/api/resources/evaluationCommons/types/EvaluatorOutputScoreType.ts
885
+ var EvaluatorOutputScoreType = {
886
+ Numeric: "NUMERIC",
887
+ Boolean: "BOOLEAN",
888
+ Categorical: "CATEGORICAL"
889
+ };
890
+
891
+ // src/api/api/resources/evaluationCommons/types/EvaluationRuleStringFilterOperator.ts
892
+ var EvaluationRuleStringFilterOperator = {
893
+ Equals: "=",
894
+ Contains: "contains",
895
+ DoesNotContain: "does not contain",
896
+ StartsWith: "starts with",
897
+ EndsWith: "ends with"
898
+ };
899
+
900
+ // src/api/api/resources/evaluationCommons/types/EvaluationRuleNumberFilterOperator.ts
901
+ var EvaluationRuleNumberFilterOperator = {
902
+ Equals: "=",
903
+ GreaterThan: ">",
904
+ LessThan: "<",
905
+ GreaterThanOrEqual: ">=",
906
+ LessThanOrEqual: "<="
907
+ };
908
+
909
+ // src/api/api/resources/evaluationCommons/types/EvaluationRuleOptionsFilterOperator.ts
910
+ var EvaluationRuleOptionsFilterOperator = {
911
+ AnyOf: "any of",
912
+ NoneOf: "none of"
913
+ };
914
+
915
+ // src/api/api/resources/evaluationCommons/types/EvaluationRuleArrayOptionsFilterOperator.ts
916
+ var EvaluationRuleArrayOptionsFilterOperator = {
917
+ AnyOf: "any of",
918
+ NoneOf: "none of",
919
+ AllOf: "all of"
920
+ };
921
+
922
+ // src/api/api/resources/evaluationCommons/types/EvaluationRuleBooleanFilterOperator.ts
923
+ var EvaluationRuleBooleanFilterOperator = {
924
+ Equals: "=",
925
+ NotEquals: "<>"
926
+ };
927
+
928
+ // src/api/api/resources/evaluationCommons/types/EvaluationRuleNullFilterOperator.ts
929
+ var EvaluationRuleNullFilterOperator = {
930
+ IsNull: "is null",
931
+ IsNotNull: "is not null"
932
+ };
933
+
934
+ // src/api/api/resources/evaluationCommons/types/LegacyEvaluationObject.ts
935
+ var LegacyEvaluationObject = {
936
+ Trace: "trace",
937
+ Span: "span",
938
+ Generation: "generation",
939
+ Event: "event",
940
+ Agent: "agent",
941
+ Tool: "tool",
942
+ Chain: "chain",
943
+ Retriever: "retriever",
944
+ Evaluator: "evaluator",
945
+ Embedding: "embedding",
946
+ Guardrail: "guardrail",
947
+ DatasetItem: "dataset_item"
948
+ };
949
+
950
+ // src/api/api/resources/evaluationErrors/index.ts
951
+ var evaluationErrors_exports = {};
952
+ __export(evaluationErrors_exports, {
953
+ BadRequestError: () => BadRequestError,
954
+ ConflictError: () => ConflictError,
955
+ EvaluationAccessDeniedError: () => EvaluationAccessDeniedError,
956
+ EvaluationMethodNotAllowedError: () => EvaluationMethodNotAllowedError,
957
+ EvaluationNotFoundError: () => EvaluationNotFoundError,
958
+ EvaluationUnauthorizedError: () => EvaluationUnauthorizedError,
959
+ InternalServerError: () => InternalServerError,
960
+ PreconditionFailedError: () => PreconditionFailedError,
961
+ PublicApiErrorCode: () => PublicApiErrorCode,
962
+ TooManyRequestsError: () => TooManyRequestsError
963
+ });
964
+
965
+ // src/api/api/resources/evaluationErrors/types/PublicApiErrorCode.ts
966
+ var PublicApiErrorCode = {
967
+ AuthenticationFailed: "authentication_failed",
968
+ AccessDenied: "access_denied",
969
+ InvalidRequest: "invalid_request",
970
+ InvalidQuery: "invalid_query",
971
+ InvalidBody: "invalid_body",
972
+ ResourceNotFound: "resource_not_found",
973
+ Conflict: "conflict",
974
+ RateLimited: "rate_limited",
975
+ MethodNotAllowed: "method_not_allowed",
976
+ InternalError: "internal_error"
977
+ };
978
+
979
+ // src/api/api/resources/evaluationErrors/errors/BadRequestError.ts
980
+ var BadRequestError = class _BadRequestError extends LangfuseAPIError {
981
+ constructor(body, rawResponse) {
982
+ super({
983
+ message: "BadRequestError",
984
+ statusCode: 400,
985
+ body,
986
+ rawResponse
987
+ });
988
+ Object.setPrototypeOf(this, _BadRequestError.prototype);
989
+ }
990
+ };
991
+
992
+ // src/api/api/resources/evaluationErrors/errors/EvaluationUnauthorizedError.ts
993
+ var EvaluationUnauthorizedError = class _EvaluationUnauthorizedError extends LangfuseAPIError {
994
+ constructor(body, rawResponse) {
995
+ super({
996
+ message: "EvaluationUnauthorizedError",
997
+ statusCode: 401,
998
+ body,
999
+ rawResponse
1000
+ });
1001
+ Object.setPrototypeOf(this, _EvaluationUnauthorizedError.prototype);
1002
+ }
1003
+ };
1004
+
1005
+ // src/api/api/resources/evaluationErrors/errors/EvaluationAccessDeniedError.ts
1006
+ var EvaluationAccessDeniedError = class _EvaluationAccessDeniedError extends LangfuseAPIError {
1007
+ constructor(body, rawResponse) {
1008
+ super({
1009
+ message: "EvaluationAccessDeniedError",
1010
+ statusCode: 403,
1011
+ body,
1012
+ rawResponse
1013
+ });
1014
+ Object.setPrototypeOf(this, _EvaluationAccessDeniedError.prototype);
1015
+ }
1016
+ };
1017
+
1018
+ // src/api/api/resources/evaluationErrors/errors/EvaluationNotFoundError.ts
1019
+ var EvaluationNotFoundError = class _EvaluationNotFoundError extends LangfuseAPIError {
1020
+ constructor(body, rawResponse) {
1021
+ super({
1022
+ message: "EvaluationNotFoundError",
1023
+ statusCode: 404,
1024
+ body,
1025
+ rawResponse
1026
+ });
1027
+ Object.setPrototypeOf(this, _EvaluationNotFoundError.prototype);
1028
+ }
1029
+ };
1030
+
1031
+ // src/api/api/resources/evaluationErrors/errors/EvaluationMethodNotAllowedError.ts
1032
+ var EvaluationMethodNotAllowedError = class _EvaluationMethodNotAllowedError extends LangfuseAPIError {
1033
+ constructor(body, rawResponse) {
1034
+ super({
1035
+ message: "EvaluationMethodNotAllowedError",
1036
+ statusCode: 405,
1037
+ body,
1038
+ rawResponse
1039
+ });
1040
+ Object.setPrototypeOf(this, _EvaluationMethodNotAllowedError.prototype);
1041
+ }
1042
+ };
1043
+
1044
+ // src/api/api/resources/evaluationErrors/errors/ConflictError.ts
1045
+ var ConflictError = class _ConflictError extends LangfuseAPIError {
1046
+ constructor(body, rawResponse) {
1047
+ super({
1048
+ message: "ConflictError",
1049
+ statusCode: 409,
1050
+ body,
1051
+ rawResponse
1052
+ });
1053
+ Object.setPrototypeOf(this, _ConflictError.prototype);
1054
+ }
1055
+ };
1056
+
1057
+ // src/api/api/resources/evaluationErrors/errors/PreconditionFailedError.ts
1058
+ var PreconditionFailedError = class _PreconditionFailedError extends LangfuseAPIError {
1059
+ constructor(body, rawResponse) {
1060
+ super({
1061
+ message: "PreconditionFailedError",
1062
+ statusCode: 412,
1063
+ body,
1064
+ rawResponse
1065
+ });
1066
+ Object.setPrototypeOf(this, _PreconditionFailedError.prototype);
1067
+ }
1068
+ };
1069
+
1070
+ // src/api/api/resources/evaluationErrors/errors/TooManyRequestsError.ts
1071
+ var TooManyRequestsError = class _TooManyRequestsError extends LangfuseAPIError {
1072
+ constructor(body, rawResponse) {
1073
+ super({
1074
+ message: "TooManyRequestsError",
1075
+ statusCode: 429,
1076
+ body,
1077
+ rawResponse
1078
+ });
1079
+ Object.setPrototypeOf(this, _TooManyRequestsError.prototype);
1080
+ }
1081
+ };
1082
+
1083
+ // src/api/api/resources/evaluationErrors/errors/InternalServerError.ts
1084
+ var InternalServerError = class _InternalServerError extends LangfuseAPIError {
1085
+ constructor(body, rawResponse) {
1086
+ super({
1087
+ message: "InternalServerError",
1088
+ statusCode: 500,
1089
+ body,
1090
+ rawResponse
1091
+ });
1092
+ Object.setPrototypeOf(this, _InternalServerError.prototype);
1093
+ }
1094
+ };
1095
+
1096
+ // src/api/api/resources/evaluationRules/index.ts
1097
+ var evaluationRules_exports = {};
1098
+
1099
+ // src/api/api/resources/evaluators/index.ts
1100
+ var evaluators_exports = {};
1101
+ __export(evaluators_exports, {
1102
+ EvaluatorStatus: () => EvaluatorStatus
1103
+ });
1104
+
1105
+ // src/api/api/resources/evaluators/types/EvaluatorStatus.ts
1106
+ var EvaluatorStatus = {
1107
+ Active: "active",
1108
+ Paused: "paused"
1109
+ };
1110
+
811
1111
  // src/api/api/resources/experiments/index.ts
812
1112
  var experiments_exports = {};
813
1113
 
@@ -988,6 +1288,15 @@ var metrics_exports = {};
988
1288
 
989
1289
  // src/api/api/resources/models/index.ts
990
1290
  var models_exports = {};
1291
+ __export(models_exports, {
1292
+ ModelTokenizerId: () => ModelTokenizerId
1293
+ });
1294
+
1295
+ // src/api/api/resources/models/types/ModelTokenizerId.ts
1296
+ var ModelTokenizerId = {
1297
+ Openai: "openai",
1298
+ Claude: "claude"
1299
+ };
991
1300
 
992
1301
  // src/api/api/resources/observations/index.ts
993
1302
  var observations_exports = {};
@@ -1073,81 +1382,73 @@ var trace_exports = {};
1073
1382
  var unstable_exports = {};
1074
1383
  __export(unstable_exports, {
1075
1384
  AccessDeniedError: () => AccessDeniedError2,
1076
- BadRequestError: () => BadRequestError,
1077
- CodeEvaluatorSourceCodeLanguage: () => CodeEvaluatorSourceCodeLanguage,
1078
- ConflictError: () => ConflictError,
1385
+ BadRequestError: () => BadRequestError2,
1386
+ CodeEvaluatorSourceCodeLanguage: () => CodeEvaluatorSourceCodeLanguage2,
1387
+ ConflictError: () => ConflictError2,
1079
1388
  DashboardWidgetChartType: () => DashboardWidgetChartType,
1080
1389
  DashboardWidgetMetricAggregation: () => DashboardWidgetMetricAggregation,
1081
1390
  DashboardWidgetSortOrder: () => DashboardWidgetSortOrder,
1082
1391
  DashboardWidgetView: () => DashboardWidgetView,
1083
1392
  DashboardWidgetViewWithLegacy: () => DashboardWidgetViewWithLegacy,
1084
- EvaluationRuleArrayOptionsFilterOperator: () => EvaluationRuleArrayOptionsFilterOperator,
1085
- EvaluationRuleBooleanFilterOperator: () => EvaluationRuleBooleanFilterOperator,
1086
- EvaluationRuleMappingSource: () => EvaluationRuleMappingSource,
1087
- EvaluationRuleNullFilterOperator: () => EvaluationRuleNullFilterOperator,
1088
- EvaluationRuleNumberFilterOperator: () => EvaluationRuleNumberFilterOperator,
1089
- EvaluationRuleOptionsFilterOperator: () => EvaluationRuleOptionsFilterOperator,
1393
+ EvaluationRuleArrayOptionsFilterOperator: () => EvaluationRuleArrayOptionsFilterOperator2,
1394
+ EvaluationRuleBooleanFilterOperator: () => EvaluationRuleBooleanFilterOperator2,
1395
+ EvaluationRuleNullFilterOperator: () => EvaluationRuleNullFilterOperator2,
1396
+ EvaluationRuleNumberFilterOperator: () => EvaluationRuleNumberFilterOperator2,
1397
+ EvaluationRuleOptionsFilterOperator: () => EvaluationRuleOptionsFilterOperator2,
1090
1398
  EvaluationRuleStatus: () => EvaluationRuleStatus,
1091
- EvaluationRuleStringFilterOperator: () => EvaluationRuleStringFilterOperator,
1399
+ EvaluationRuleStringFilterOperator: () => EvaluationRuleStringFilterOperator2,
1092
1400
  EvaluationRuleTarget: () => EvaluationRuleTarget,
1093
1401
  EvaluationRuleTimeScope: () => EvaluationRuleTimeScope,
1094
1402
  EvaluatorOutputDataType: () => EvaluatorOutputDataType,
1095
- EvaluatorScope: () => EvaluatorScope,
1096
- EvaluatorType: () => EvaluatorType,
1097
- InternalServerError: () => InternalServerError,
1098
- LegacyEvaluationObject: () => LegacyEvaluationObject,
1403
+ EvaluatorType: () => EvaluatorType2,
1404
+ InternalServerError: () => InternalServerError2,
1405
+ LegacyEvaluationObject: () => LegacyEvaluationObject2,
1099
1406
  LegacyEvaluationRuleTarget: () => LegacyEvaluationRuleTarget,
1100
1407
  LlmAsJudgeEvaluatorType: () => LlmAsJudgeEvaluatorType,
1101
1408
  MethodNotAllowedError: () => MethodNotAllowedError2,
1102
1409
  NotFoundError: () => NotFoundError2,
1103
- PublicApiErrorCode: () => PublicApiErrorCode,
1104
- TooManyRequestsError: () => TooManyRequestsError,
1410
+ PromptVariableMappingSource: () => PromptVariableMappingSource2,
1411
+ PublicApiErrorCode: () => PublicApiErrorCode2,
1412
+ TooManyRequestsError: () => TooManyRequestsError2,
1105
1413
  UnauthorizedError: () => UnauthorizedError2,
1106
1414
  UnprocessableContentError: () => UnprocessableContentError,
1107
1415
  commons: () => commons_exports2,
1108
1416
  dashboardWidgets: () => dashboardWidgets_exports,
1109
1417
  dashboards: () => dashboards_exports,
1110
1418
  errors: () => errors_exports2,
1111
- evaluationRules: () => evaluationRules_exports,
1112
- evaluators: () => evaluators_exports
1419
+ evaluationRules: () => evaluationRules_exports2,
1420
+ evaluators: () => evaluators_exports2
1113
1421
  });
1114
1422
 
1115
1423
  // src/api/api/resources/unstable/resources/commons/index.ts
1116
1424
  var commons_exports2 = {};
1117
1425
  __export(commons_exports2, {
1118
- CodeEvaluatorSourceCodeLanguage: () => CodeEvaluatorSourceCodeLanguage,
1119
- EvaluationRuleArrayOptionsFilterOperator: () => EvaluationRuleArrayOptionsFilterOperator,
1120
- EvaluationRuleBooleanFilterOperator: () => EvaluationRuleBooleanFilterOperator,
1121
- EvaluationRuleMappingSource: () => EvaluationRuleMappingSource,
1122
- EvaluationRuleNullFilterOperator: () => EvaluationRuleNullFilterOperator,
1123
- EvaluationRuleNumberFilterOperator: () => EvaluationRuleNumberFilterOperator,
1124
- EvaluationRuleOptionsFilterOperator: () => EvaluationRuleOptionsFilterOperator,
1426
+ CodeEvaluatorSourceCodeLanguage: () => CodeEvaluatorSourceCodeLanguage2,
1427
+ EvaluationRuleArrayOptionsFilterOperator: () => EvaluationRuleArrayOptionsFilterOperator2,
1428
+ EvaluationRuleBooleanFilterOperator: () => EvaluationRuleBooleanFilterOperator2,
1429
+ EvaluationRuleNullFilterOperator: () => EvaluationRuleNullFilterOperator2,
1430
+ EvaluationRuleNumberFilterOperator: () => EvaluationRuleNumberFilterOperator2,
1431
+ EvaluationRuleOptionsFilterOperator: () => EvaluationRuleOptionsFilterOperator2,
1125
1432
  EvaluationRuleStatus: () => EvaluationRuleStatus,
1126
- EvaluationRuleStringFilterOperator: () => EvaluationRuleStringFilterOperator,
1433
+ EvaluationRuleStringFilterOperator: () => EvaluationRuleStringFilterOperator2,
1127
1434
  EvaluationRuleTarget: () => EvaluationRuleTarget,
1128
1435
  EvaluatorOutputDataType: () => EvaluatorOutputDataType,
1129
- EvaluatorScope: () => EvaluatorScope,
1130
- EvaluatorType: () => EvaluatorType
1436
+ EvaluatorType: () => EvaluatorType2,
1437
+ PromptVariableMappingSource: () => PromptVariableMappingSource2
1131
1438
  });
1132
1439
 
1133
1440
  // src/api/api/resources/unstable/resources/commons/types/EvaluatorType.ts
1134
- var EvaluatorType = {
1441
+ var EvaluatorType2 = {
1135
1442
  LlmAsJudge: "llm_as_judge",
1136
1443
  Code: "code"
1137
1444
  };
1138
1445
 
1139
1446
  // src/api/api/resources/unstable/resources/commons/types/CodeEvaluatorSourceCodeLanguage.ts
1140
- var CodeEvaluatorSourceCodeLanguage = {
1447
+ var CodeEvaluatorSourceCodeLanguage2 = {
1141
1448
  Python: "PYTHON",
1142
1449
  Typescript: "TYPESCRIPT"
1143
1450
  };
1144
1451
 
1145
- // src/api/api/resources/unstable/resources/commons/types/EvaluatorScope.ts
1146
- var EvaluatorScope = {
1147
- Project: "project",
1148
- Managed: "managed"
1149
- };
1150
-
1151
1452
  // src/api/api/resources/unstable/resources/commons/types/EvaluationRuleTarget.ts
1152
1453
  var EvaluationRuleTarget = {
1153
1454
  Observation: "observation",
@@ -1161,8 +1462,8 @@ var EvaluationRuleStatus = {
1161
1462
  Paused: "paused"
1162
1463
  };
1163
1464
 
1164
- // src/api/api/resources/unstable/resources/commons/types/EvaluationRuleMappingSource.ts
1165
- var EvaluationRuleMappingSource = {
1465
+ // src/api/api/resources/unstable/resources/commons/types/PromptVariableMappingSource.ts
1466
+ var PromptVariableMappingSource2 = {
1166
1467
  Input: "input",
1167
1468
  Output: "output",
1168
1469
  Metadata: "metadata",
@@ -1179,7 +1480,7 @@ var EvaluatorOutputDataType = {
1179
1480
  };
1180
1481
 
1181
1482
  // src/api/api/resources/unstable/resources/commons/types/EvaluationRuleStringFilterOperator.ts
1182
- var EvaluationRuleStringFilterOperator = {
1483
+ var EvaluationRuleStringFilterOperator2 = {
1183
1484
  Equals: "=",
1184
1485
  Contains: "contains",
1185
1486
  DoesNotContain: "does not contain",
@@ -1188,7 +1489,7 @@ var EvaluationRuleStringFilterOperator = {
1188
1489
  };
1189
1490
 
1190
1491
  // src/api/api/resources/unstable/resources/commons/types/EvaluationRuleNumberFilterOperator.ts
1191
- var EvaluationRuleNumberFilterOperator = {
1492
+ var EvaluationRuleNumberFilterOperator2 = {
1192
1493
  Equals: "=",
1193
1494
  GreaterThan: ">",
1194
1495
  LessThan: "<",
@@ -1197,26 +1498,26 @@ var EvaluationRuleNumberFilterOperator = {
1197
1498
  };
1198
1499
 
1199
1500
  // src/api/api/resources/unstable/resources/commons/types/EvaluationRuleOptionsFilterOperator.ts
1200
- var EvaluationRuleOptionsFilterOperator = {
1501
+ var EvaluationRuleOptionsFilterOperator2 = {
1201
1502
  AnyOf: "any of",
1202
1503
  NoneOf: "none of"
1203
1504
  };
1204
1505
 
1205
1506
  // src/api/api/resources/unstable/resources/commons/types/EvaluationRuleArrayOptionsFilterOperator.ts
1206
- var EvaluationRuleArrayOptionsFilterOperator = {
1507
+ var EvaluationRuleArrayOptionsFilterOperator2 = {
1207
1508
  AnyOf: "any of",
1208
1509
  NoneOf: "none of",
1209
1510
  AllOf: "all of"
1210
1511
  };
1211
1512
 
1212
1513
  // src/api/api/resources/unstable/resources/commons/types/EvaluationRuleBooleanFilterOperator.ts
1213
- var EvaluationRuleBooleanFilterOperator = {
1514
+ var EvaluationRuleBooleanFilterOperator2 = {
1214
1515
  Equals: "=",
1215
1516
  NotEquals: "<>"
1216
1517
  };
1217
1518
 
1218
1519
  // src/api/api/resources/unstable/resources/commons/types/EvaluationRuleNullFilterOperator.ts
1219
- var EvaluationRuleNullFilterOperator = {
1520
+ var EvaluationRuleNullFilterOperator2 = {
1220
1521
  IsNull: "is null",
1221
1522
  IsNotNull: "is not null"
1222
1523
  };
@@ -1290,19 +1591,19 @@ var dashboards_exports = {};
1290
1591
  var errors_exports2 = {};
1291
1592
  __export(errors_exports2, {
1292
1593
  AccessDeniedError: () => AccessDeniedError2,
1293
- BadRequestError: () => BadRequestError,
1294
- ConflictError: () => ConflictError,
1295
- InternalServerError: () => InternalServerError,
1594
+ BadRequestError: () => BadRequestError2,
1595
+ ConflictError: () => ConflictError2,
1596
+ InternalServerError: () => InternalServerError2,
1296
1597
  MethodNotAllowedError: () => MethodNotAllowedError2,
1297
1598
  NotFoundError: () => NotFoundError2,
1298
- PublicApiErrorCode: () => PublicApiErrorCode,
1299
- TooManyRequestsError: () => TooManyRequestsError,
1599
+ PublicApiErrorCode: () => PublicApiErrorCode2,
1600
+ TooManyRequestsError: () => TooManyRequestsError2,
1300
1601
  UnauthorizedError: () => UnauthorizedError2,
1301
1602
  UnprocessableContentError: () => UnprocessableContentError
1302
1603
  });
1303
1604
 
1304
1605
  // src/api/api/resources/unstable/resources/errors/types/PublicApiErrorCode.ts
1305
- var PublicApiErrorCode = {
1606
+ var PublicApiErrorCode2 = {
1306
1607
  AuthenticationFailed: "authentication_failed",
1307
1608
  AccessDenied: "access_denied",
1308
1609
  InvalidRequest: "invalid_request",
@@ -1324,7 +1625,7 @@ var PublicApiErrorCode = {
1324
1625
  };
1325
1626
 
1326
1627
  // src/api/api/resources/unstable/resources/errors/errors/BadRequestError.ts
1327
- var BadRequestError = class _BadRequestError extends LangfuseAPIError {
1628
+ var BadRequestError2 = class _BadRequestError extends LangfuseAPIError {
1328
1629
  constructor(body, rawResponse) {
1329
1630
  super({
1330
1631
  message: "BadRequestError",
@@ -1389,7 +1690,7 @@ var MethodNotAllowedError2 = class _MethodNotAllowedError extends LangfuseAPIErr
1389
1690
  };
1390
1691
 
1391
1692
  // src/api/api/resources/unstable/resources/errors/errors/ConflictError.ts
1392
- var ConflictError = class _ConflictError extends LangfuseAPIError {
1693
+ var ConflictError2 = class _ConflictError extends LangfuseAPIError {
1393
1694
  constructor(body, rawResponse) {
1394
1695
  super({
1395
1696
  message: "ConflictError",
@@ -1415,7 +1716,7 @@ var UnprocessableContentError = class _UnprocessableContentError extends Langfus
1415
1716
  };
1416
1717
 
1417
1718
  // src/api/api/resources/unstable/resources/errors/errors/TooManyRequestsError.ts
1418
- var TooManyRequestsError = class _TooManyRequestsError extends LangfuseAPIError {
1719
+ var TooManyRequestsError2 = class _TooManyRequestsError extends LangfuseAPIError {
1419
1720
  constructor(body, rawResponse) {
1420
1721
  super({
1421
1722
  message: "TooManyRequestsError",
@@ -1428,7 +1729,7 @@ var TooManyRequestsError = class _TooManyRequestsError extends LangfuseAPIError
1428
1729
  };
1429
1730
 
1430
1731
  // src/api/api/resources/unstable/resources/errors/errors/InternalServerError.ts
1431
- var InternalServerError = class _InternalServerError extends LangfuseAPIError {
1732
+ var InternalServerError2 = class _InternalServerError extends LangfuseAPIError {
1432
1733
  constructor(body, rawResponse) {
1433
1734
  super({
1434
1735
  message: "InternalServerError",
@@ -1441,10 +1742,10 @@ var InternalServerError = class _InternalServerError extends LangfuseAPIError {
1441
1742
  };
1442
1743
 
1443
1744
  // src/api/api/resources/unstable/resources/evaluationRules/index.ts
1444
- var evaluationRules_exports = {};
1445
- __export(evaluationRules_exports, {
1745
+ var evaluationRules_exports2 = {};
1746
+ __export(evaluationRules_exports2, {
1446
1747
  EvaluationRuleTimeScope: () => EvaluationRuleTimeScope,
1447
- LegacyEvaluationObject: () => LegacyEvaluationObject,
1748
+ LegacyEvaluationObject: () => LegacyEvaluationObject2,
1448
1749
  LegacyEvaluationRuleTarget: () => LegacyEvaluationRuleTarget,
1449
1750
  LlmAsJudgeEvaluatorType: () => LlmAsJudgeEvaluatorType
1450
1751
  });
@@ -1467,7 +1768,7 @@ var LegacyEvaluationRuleTarget = {
1467
1768
  };
1468
1769
 
1469
1770
  // src/api/api/resources/unstable/resources/evaluationRules/types/LegacyEvaluationObject.ts
1470
- var LegacyEvaluationObject = {
1771
+ var LegacyEvaluationObject2 = {
1471
1772
  Trace: "trace",
1472
1773
  Span: "span",
1473
1774
  Generation: "generation",
@@ -1483,7 +1784,7 @@ var LegacyEvaluationObject = {
1483
1784
  };
1484
1785
 
1485
1786
  // src/api/api/resources/unstable/resources/evaluators/index.ts
1486
- var evaluators_exports = {};
1787
+ var evaluators_exports2 = {};
1487
1788
 
1488
1789
  // src/api/api/resources/utils/index.ts
1489
1790
  var utils_exports = {};
@@ -4620,6 +4921,8 @@ var DatasetRunItems = class {
4620
4921
  /**
4621
4922
  * Create a dataset run item
4622
4923
  *
4924
+ * @deprecated On Langfuse Cloud, Langfuse v3 is deprecated and this endpoint will be removed on November 16, 2026. In Langfuse v4, create experiment data via the SDK experiment runner or the OpenTelemetry endpoint at POST /api/public/otel/v1/traces. Self-hosted deployments are unaffected by this date; the endpoint becomes unavailable when they upgrade to Langfuse v4.
4925
+ *
4623
4926
  * @param {LangfuseAPI.CreateDatasetRunItemRequest} request
4624
4927
  * @param {DatasetRunItems.RequestOptions} requestOptions - Request-specific configuration.
4625
4928
  *
@@ -4735,6 +5038,8 @@ var DatasetRunItems = class {
4735
5038
  /**
4736
5039
  * List dataset run items
4737
5040
  *
5041
+ * @deprecated On Langfuse Cloud, Langfuse v3 is deprecated and this endpoint will be removed on November 16, 2026. In Langfuse v4, dataset run items are replaced by experiment items; use `GET /api/public/experiment-items?fromStartTime=<from>&toStartTime=<to>` instead. Self-hosted deployments are unaffected by this date; the endpoint becomes unavailable when they upgrade to Langfuse v4.
5042
+ *
4738
5043
  * @param {LangfuseAPI.ListDatasetRunItemsRequest} request
4739
5044
  * @param {DatasetRunItems.RequestOptions} requestOptions - Request-specific configuration.
4740
5045
  *
@@ -5195,6 +5500,8 @@ var Datasets = class {
5195
5500
  /**
5196
5501
  * Get a dataset run and its items
5197
5502
  *
5503
+ * @deprecated On Langfuse Cloud, Langfuse v3 is deprecated and this endpoint will be removed on November 16, 2026. In Langfuse v4, dataset runs are replaced by experiments; use GET /api/public/experiments instead. Self-hosted deployments are unaffected by this date; the endpoint becomes unavailable when they upgrade to Langfuse v4.
5504
+ *
5198
5505
  * @param {string} datasetName
5199
5506
  * @param {string} runName
5200
5507
  * @param {Datasets.RequestOptions} requestOptions - Request-specific configuration.
@@ -5287,7 +5594,1663 @@ var Datasets = class {
5287
5594
  });
5288
5595
  case "timeout":
5289
5596
  throw new LangfuseAPITimeoutError(
5290
- "Timeout exceeded when calling GET /api/public/datasets/{datasetName}/runs/{runName}."
5597
+ "Timeout exceeded when calling GET /api/public/datasets/{datasetName}/runs/{runName}."
5598
+ );
5599
+ case "unknown":
5600
+ throw new LangfuseAPIError({
5601
+ message: _response.error.errorMessage,
5602
+ rawResponse: _response.rawResponse
5603
+ });
5604
+ }
5605
+ }
5606
+ /**
5607
+ * Delete a dataset run and all its run items. This action is irreversible.
5608
+ *
5609
+ * @deprecated On Langfuse Cloud, Langfuse v3 is deprecated and this endpoint will be removed on November 16, 2026. In Langfuse v4, dataset runs are replaced by experiments. Self-hosted deployments are unaffected by this date; the endpoint becomes unavailable when they upgrade to Langfuse v4.
5610
+ *
5611
+ * @param {string} datasetName
5612
+ * @param {string} runName
5613
+ * @param {Datasets.RequestOptions} requestOptions - Request-specific configuration.
5614
+ *
5615
+ * @throws {@link LangfuseAPI.Error}
5616
+ * @throws {@link LangfuseAPI.UnauthorizedError}
5617
+ * @throws {@link LangfuseAPI.AccessDeniedError}
5618
+ * @throws {@link LangfuseAPI.MethodNotAllowedError}
5619
+ * @throws {@link LangfuseAPI.NotFoundError}
5620
+ *
5621
+ * @example
5622
+ * await client.datasets.deleteRun("datasetName", "runName")
5623
+ */
5624
+ deleteRun(datasetName, runName, requestOptions) {
5625
+ return HttpResponsePromise.fromPromise(
5626
+ this.__deleteRun(datasetName, runName, requestOptions)
5627
+ );
5628
+ }
5629
+ async __deleteRun(datasetName, runName, requestOptions) {
5630
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
5631
+ let _headers = mergeHeaders(
5632
+ (_a2 = this._options) == null ? void 0 : _a2.headers,
5633
+ mergeOnlyDefinedHeaders({
5634
+ Authorization: await this._getAuthorizationHeader(),
5635
+ "X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
5636
+ "X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
5637
+ "X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
5638
+ }),
5639
+ requestOptions == null ? void 0 : requestOptions.headers
5640
+ );
5641
+ const _response = await fetcher({
5642
+ url: url_exports.join(
5643
+ (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
5644
+ `/api/public/datasets/${encodeURIComponent(datasetName)}/runs/${encodeURIComponent(runName)}`
5645
+ ),
5646
+ method: "DELETE",
5647
+ headers: _headers,
5648
+ queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
5649
+ timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
5650
+ maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
5651
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
5652
+ });
5653
+ if (_response.ok) {
5654
+ return {
5655
+ data: _response.body,
5656
+ rawResponse: _response.rawResponse
5657
+ };
5658
+ }
5659
+ if (_response.error.reason === "status-code") {
5660
+ switch (_response.error.statusCode) {
5661
+ case 400:
5662
+ throw new Error2(
5663
+ _response.error.body,
5664
+ _response.rawResponse
5665
+ );
5666
+ case 401:
5667
+ throw new UnauthorizedError(
5668
+ _response.error.body,
5669
+ _response.rawResponse
5670
+ );
5671
+ case 403:
5672
+ throw new AccessDeniedError(
5673
+ _response.error.body,
5674
+ _response.rawResponse
5675
+ );
5676
+ case 405:
5677
+ throw new MethodNotAllowedError(
5678
+ _response.error.body,
5679
+ _response.rawResponse
5680
+ );
5681
+ case 404:
5682
+ throw new NotFoundError(
5683
+ _response.error.body,
5684
+ _response.rawResponse
5685
+ );
5686
+ default:
5687
+ throw new LangfuseAPIError({
5688
+ statusCode: _response.error.statusCode,
5689
+ body: _response.error.body,
5690
+ rawResponse: _response.rawResponse
5691
+ });
5692
+ }
5693
+ }
5694
+ switch (_response.error.reason) {
5695
+ case "non-json":
5696
+ throw new LangfuseAPIError({
5697
+ statusCode: _response.error.statusCode,
5698
+ body: _response.error.rawBody,
5699
+ rawResponse: _response.rawResponse
5700
+ });
5701
+ case "timeout":
5702
+ throw new LangfuseAPITimeoutError(
5703
+ "Timeout exceeded when calling DELETE /api/public/datasets/{datasetName}/runs/{runName}."
5704
+ );
5705
+ case "unknown":
5706
+ throw new LangfuseAPIError({
5707
+ message: _response.error.errorMessage,
5708
+ rawResponse: _response.rawResponse
5709
+ });
5710
+ }
5711
+ }
5712
+ /**
5713
+ * Get dataset runs
5714
+ *
5715
+ * @deprecated On Langfuse Cloud, Langfuse v3 is deprecated and this endpoint will be removed on November 16, 2026. In Langfuse v4, dataset runs are replaced by experiments; use GET /api/public/experiments instead. Self-hosted deployments are unaffected by this date; the endpoint becomes unavailable when they upgrade to Langfuse v4.
5716
+ *
5717
+ * @param {string} datasetName
5718
+ * @param {LangfuseAPI.GetDatasetRunsRequest} request
5719
+ * @param {Datasets.RequestOptions} requestOptions - Request-specific configuration.
5720
+ *
5721
+ * @throws {@link LangfuseAPI.Error}
5722
+ * @throws {@link LangfuseAPI.UnauthorizedError}
5723
+ * @throws {@link LangfuseAPI.AccessDeniedError}
5724
+ * @throws {@link LangfuseAPI.MethodNotAllowedError}
5725
+ * @throws {@link LangfuseAPI.NotFoundError}
5726
+ *
5727
+ * @example
5728
+ * await client.datasets.getRuns("datasetName")
5729
+ */
5730
+ getRuns(datasetName, request = {}, requestOptions) {
5731
+ return HttpResponsePromise.fromPromise(
5732
+ this.__getRuns(datasetName, request, requestOptions)
5733
+ );
5734
+ }
5735
+ async __getRuns(datasetName, request = {}, requestOptions) {
5736
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
5737
+ const { page, limit } = request;
5738
+ const _queryParams = {};
5739
+ if (page != null) {
5740
+ _queryParams["page"] = page.toString();
5741
+ }
5742
+ if (limit != null) {
5743
+ _queryParams["limit"] = limit.toString();
5744
+ }
5745
+ let _headers = mergeHeaders(
5746
+ (_a2 = this._options) == null ? void 0 : _a2.headers,
5747
+ mergeOnlyDefinedHeaders({
5748
+ Authorization: await this._getAuthorizationHeader(),
5749
+ "X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
5750
+ "X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
5751
+ "X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
5752
+ }),
5753
+ requestOptions == null ? void 0 : requestOptions.headers
5754
+ );
5755
+ const _response = await fetcher({
5756
+ url: url_exports.join(
5757
+ (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
5758
+ `/api/public/datasets/${encodeURIComponent(datasetName)}/runs`
5759
+ ),
5760
+ method: "GET",
5761
+ headers: _headers,
5762
+ queryParameters: { ..._queryParams, ...requestOptions == null ? void 0 : requestOptions.queryParams },
5763
+ timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
5764
+ maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
5765
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
5766
+ });
5767
+ if (_response.ok) {
5768
+ return {
5769
+ data: _response.body,
5770
+ rawResponse: _response.rawResponse
5771
+ };
5772
+ }
5773
+ if (_response.error.reason === "status-code") {
5774
+ switch (_response.error.statusCode) {
5775
+ case 400:
5776
+ throw new Error2(
5777
+ _response.error.body,
5778
+ _response.rawResponse
5779
+ );
5780
+ case 401:
5781
+ throw new UnauthorizedError(
5782
+ _response.error.body,
5783
+ _response.rawResponse
5784
+ );
5785
+ case 403:
5786
+ throw new AccessDeniedError(
5787
+ _response.error.body,
5788
+ _response.rawResponse
5789
+ );
5790
+ case 405:
5791
+ throw new MethodNotAllowedError(
5792
+ _response.error.body,
5793
+ _response.rawResponse
5794
+ );
5795
+ case 404:
5796
+ throw new NotFoundError(
5797
+ _response.error.body,
5798
+ _response.rawResponse
5799
+ );
5800
+ default:
5801
+ throw new LangfuseAPIError({
5802
+ statusCode: _response.error.statusCode,
5803
+ body: _response.error.body,
5804
+ rawResponse: _response.rawResponse
5805
+ });
5806
+ }
5807
+ }
5808
+ switch (_response.error.reason) {
5809
+ case "non-json":
5810
+ throw new LangfuseAPIError({
5811
+ statusCode: _response.error.statusCode,
5812
+ body: _response.error.rawBody,
5813
+ rawResponse: _response.rawResponse
5814
+ });
5815
+ case "timeout":
5816
+ throw new LangfuseAPITimeoutError(
5817
+ "Timeout exceeded when calling GET /api/public/datasets/{datasetName}/runs."
5818
+ );
5819
+ case "unknown":
5820
+ throw new LangfuseAPIError({
5821
+ message: _response.error.errorMessage,
5822
+ rawResponse: _response.rawResponse
5823
+ });
5824
+ }
5825
+ }
5826
+ async _getAuthorizationHeader() {
5827
+ const username = await Supplier.get(this._options.username);
5828
+ const password = await Supplier.get(this._options.password);
5829
+ if (username != null && password != null) {
5830
+ return BasicAuth.toAuthorizationHeader({
5831
+ username,
5832
+ password
5833
+ });
5834
+ }
5835
+ return void 0;
5836
+ }
5837
+ };
5838
+
5839
+ // src/api/api/resources/evaluationRules/client/Client.ts
5840
+ var EvaluationRules = class {
5841
+ constructor(_options) {
5842
+ this._options = _options;
5843
+ }
5844
+ /**
5845
+ * Create an evaluation rule using stable evaluator identifiers.
5846
+ *
5847
+ * An evaluation rule defines **which** incoming observations should be evaluated and how prompt variables should be populated.
5848
+ *
5849
+ * Key behavior:
5850
+ * - rule names are not identifiers and do not need to be unique
5851
+ * - rules always use the latest version of each associated evaluator
5852
+ * - an enabled rule requires at least one evaluator assignment
5853
+ * - omit `sampling` to evaluate every matching observation
5854
+ * - omit `filter` to match every incoming observation
5855
+ * - `datasetId` is the public filter name for selecting experiment datasets
5856
+ *
5857
+ * @param {LangfuseAPI.CreateEvaluationRuleRequest} request
5858
+ * @param {EvaluationRules.RequestOptions} requestOptions - Request-specific configuration.
5859
+ *
5860
+ * @throws {@link LangfuseAPI.BadRequestError}
5861
+ * @throws {@link LangfuseAPI.EvaluationUnauthorizedError}
5862
+ * @throws {@link LangfuseAPI.EvaluationAccessDeniedError}
5863
+ * @throws {@link LangfuseAPI.EvaluationNotFoundError}
5864
+ * @throws {@link LangfuseAPI.EvaluationMethodNotAllowedError}
5865
+ * @throws {@link LangfuseAPI.ConflictError}
5866
+ * @throws {@link LangfuseAPI.TooManyRequestsError}
5867
+ * @throws {@link LangfuseAPI.InternalServerError}
5868
+ * @throws {@link LangfuseAPI.Error}
5869
+ * @throws {@link LangfuseAPI.UnauthorizedError}
5870
+ * @throws {@link LangfuseAPI.AccessDeniedError}
5871
+ * @throws {@link LangfuseAPI.MethodNotAllowedError}
5872
+ * @throws {@link LangfuseAPI.NotFoundError}
5873
+ *
5874
+ * @example
5875
+ * await client.evaluationRules.create({
5876
+ * name: "name",
5877
+ * enabled: true,
5878
+ * sampling: undefined,
5879
+ * filter: undefined,
5880
+ * evaluatorAssignments: [{
5881
+ * evaluatorId: "evaluatorId",
5882
+ * variableMapping: undefined
5883
+ * }, {
5884
+ * evaluatorId: "evaluatorId",
5885
+ * variableMapping: undefined
5886
+ * }]
5887
+ * })
5888
+ */
5889
+ create(request, requestOptions) {
5890
+ return HttpResponsePromise.fromPromise(
5891
+ this.__create(request, requestOptions)
5892
+ );
5893
+ }
5894
+ async __create(request, requestOptions) {
5895
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
5896
+ let _headers = mergeHeaders(
5897
+ (_a2 = this._options) == null ? void 0 : _a2.headers,
5898
+ mergeOnlyDefinedHeaders({
5899
+ Authorization: await this._getAuthorizationHeader(),
5900
+ "X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
5901
+ "X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
5902
+ "X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
5903
+ }),
5904
+ requestOptions == null ? void 0 : requestOptions.headers
5905
+ );
5906
+ const _response = await fetcher({
5907
+ url: url_exports.join(
5908
+ (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
5909
+ "/api/public/v2/evaluation-rules"
5910
+ ),
5911
+ method: "POST",
5912
+ headers: _headers,
5913
+ contentType: "application/json",
5914
+ queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
5915
+ requestType: "json",
5916
+ body: request,
5917
+ timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
5918
+ maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
5919
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
5920
+ });
5921
+ if (_response.ok) {
5922
+ return {
5923
+ data: _response.body,
5924
+ rawResponse: _response.rawResponse
5925
+ };
5926
+ }
5927
+ if (_response.error.reason === "status-code") {
5928
+ switch (_response.error.statusCode) {
5929
+ case 400:
5930
+ throw new BadRequestError(
5931
+ _response.error.body,
5932
+ _response.rawResponse
5933
+ );
5934
+ case 401:
5935
+ throw new EvaluationUnauthorizedError(
5936
+ _response.error.body,
5937
+ _response.rawResponse
5938
+ );
5939
+ case 403:
5940
+ throw new EvaluationAccessDeniedError(
5941
+ _response.error.body,
5942
+ _response.rawResponse
5943
+ );
5944
+ case 404:
5945
+ throw new EvaluationNotFoundError(
5946
+ _response.error.body,
5947
+ _response.rawResponse
5948
+ );
5949
+ case 405:
5950
+ throw new EvaluationMethodNotAllowedError(
5951
+ _response.error.body,
5952
+ _response.rawResponse
5953
+ );
5954
+ case 409:
5955
+ throw new ConflictError(
5956
+ _response.error.body,
5957
+ _response.rawResponse
5958
+ );
5959
+ case 429:
5960
+ throw new TooManyRequestsError(
5961
+ _response.error.body,
5962
+ _response.rawResponse
5963
+ );
5964
+ case 500:
5965
+ throw new InternalServerError(
5966
+ _response.error.body,
5967
+ _response.rawResponse
5968
+ );
5969
+ case 400:
5970
+ throw new Error2(
5971
+ _response.error.body,
5972
+ _response.rawResponse
5973
+ );
5974
+ case 401:
5975
+ throw new UnauthorizedError(
5976
+ _response.error.body,
5977
+ _response.rawResponse
5978
+ );
5979
+ case 403:
5980
+ throw new AccessDeniedError(
5981
+ _response.error.body,
5982
+ _response.rawResponse
5983
+ );
5984
+ case 405:
5985
+ throw new MethodNotAllowedError(
5986
+ _response.error.body,
5987
+ _response.rawResponse
5988
+ );
5989
+ case 404:
5990
+ throw new NotFoundError(
5991
+ _response.error.body,
5992
+ _response.rawResponse
5993
+ );
5994
+ default:
5995
+ throw new LangfuseAPIError({
5996
+ statusCode: _response.error.statusCode,
5997
+ body: _response.error.body,
5998
+ rawResponse: _response.rawResponse
5999
+ });
6000
+ }
6001
+ }
6002
+ switch (_response.error.reason) {
6003
+ case "non-json":
6004
+ throw new LangfuseAPIError({
6005
+ statusCode: _response.error.statusCode,
6006
+ body: _response.error.rawBody,
6007
+ rawResponse: _response.rawResponse
6008
+ });
6009
+ case "timeout":
6010
+ throw new LangfuseAPITimeoutError(
6011
+ "Timeout exceeded when calling POST /api/public/v2/evaluation-rules."
6012
+ );
6013
+ case "unknown":
6014
+ throw new LangfuseAPIError({
6015
+ message: _response.error.errorMessage,
6016
+ rawResponse: _response.rawResponse
6017
+ });
6018
+ }
6019
+ }
6020
+ /**
6021
+ * List evaluation rules in newest-first creation order.
6022
+ *
6023
+ * This includes legacy trace and dataset rules so they can be inspected and migrated. Treat the cursor as opaque and return it unchanged.
6024
+ *
6025
+ * @param {LangfuseAPI.ListEvaluationRulesRequest} request
6026
+ * @param {EvaluationRules.RequestOptions} requestOptions - Request-specific configuration.
6027
+ *
6028
+ * @throws {@link LangfuseAPI.BadRequestError}
6029
+ * @throws {@link LangfuseAPI.EvaluationUnauthorizedError}
6030
+ * @throws {@link LangfuseAPI.EvaluationAccessDeniedError}
6031
+ * @throws {@link LangfuseAPI.EvaluationMethodNotAllowedError}
6032
+ * @throws {@link LangfuseAPI.TooManyRequestsError}
6033
+ * @throws {@link LangfuseAPI.InternalServerError}
6034
+ * @throws {@link LangfuseAPI.Error}
6035
+ * @throws {@link LangfuseAPI.UnauthorizedError}
6036
+ * @throws {@link LangfuseAPI.AccessDeniedError}
6037
+ * @throws {@link LangfuseAPI.MethodNotAllowedError}
6038
+ * @throws {@link LangfuseAPI.NotFoundError}
6039
+ *
6040
+ * @example
6041
+ * await client.evaluationRules.list()
6042
+ */
6043
+ list(request = {}, requestOptions) {
6044
+ return HttpResponsePromise.fromPromise(
6045
+ this.__list(request, requestOptions)
6046
+ );
6047
+ }
6048
+ async __list(request = {}, requestOptions) {
6049
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
6050
+ const { limit, cursor } = request;
6051
+ const _queryParams = {};
6052
+ if (limit != null) {
6053
+ _queryParams["limit"] = limit.toString();
6054
+ }
6055
+ if (cursor != null) {
6056
+ _queryParams["cursor"] = cursor;
6057
+ }
6058
+ let _headers = mergeHeaders(
6059
+ (_a2 = this._options) == null ? void 0 : _a2.headers,
6060
+ mergeOnlyDefinedHeaders({
6061
+ Authorization: await this._getAuthorizationHeader(),
6062
+ "X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
6063
+ "X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
6064
+ "X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
6065
+ }),
6066
+ requestOptions == null ? void 0 : requestOptions.headers
6067
+ );
6068
+ const _response = await fetcher({
6069
+ url: url_exports.join(
6070
+ (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
6071
+ "/api/public/v2/evaluation-rules"
6072
+ ),
6073
+ method: "GET",
6074
+ headers: _headers,
6075
+ queryParameters: { ..._queryParams, ...requestOptions == null ? void 0 : requestOptions.queryParams },
6076
+ timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
6077
+ maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
6078
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
6079
+ });
6080
+ if (_response.ok) {
6081
+ return {
6082
+ data: _response.body,
6083
+ rawResponse: _response.rawResponse
6084
+ };
6085
+ }
6086
+ if (_response.error.reason === "status-code") {
6087
+ switch (_response.error.statusCode) {
6088
+ case 400:
6089
+ throw new BadRequestError(
6090
+ _response.error.body,
6091
+ _response.rawResponse
6092
+ );
6093
+ case 401:
6094
+ throw new EvaluationUnauthorizedError(
6095
+ _response.error.body,
6096
+ _response.rawResponse
6097
+ );
6098
+ case 403:
6099
+ throw new EvaluationAccessDeniedError(
6100
+ _response.error.body,
6101
+ _response.rawResponse
6102
+ );
6103
+ case 405:
6104
+ throw new EvaluationMethodNotAllowedError(
6105
+ _response.error.body,
6106
+ _response.rawResponse
6107
+ );
6108
+ case 429:
6109
+ throw new TooManyRequestsError(
6110
+ _response.error.body,
6111
+ _response.rawResponse
6112
+ );
6113
+ case 500:
6114
+ throw new InternalServerError(
6115
+ _response.error.body,
6116
+ _response.rawResponse
6117
+ );
6118
+ case 400:
6119
+ throw new Error2(
6120
+ _response.error.body,
6121
+ _response.rawResponse
6122
+ );
6123
+ case 401:
6124
+ throw new UnauthorizedError(
6125
+ _response.error.body,
6126
+ _response.rawResponse
6127
+ );
6128
+ case 403:
6129
+ throw new AccessDeniedError(
6130
+ _response.error.body,
6131
+ _response.rawResponse
6132
+ );
6133
+ case 405:
6134
+ throw new MethodNotAllowedError(
6135
+ _response.error.body,
6136
+ _response.rawResponse
6137
+ );
6138
+ case 404:
6139
+ throw new NotFoundError(
6140
+ _response.error.body,
6141
+ _response.rawResponse
6142
+ );
6143
+ default:
6144
+ throw new LangfuseAPIError({
6145
+ statusCode: _response.error.statusCode,
6146
+ body: _response.error.body,
6147
+ rawResponse: _response.rawResponse
6148
+ });
6149
+ }
6150
+ }
6151
+ switch (_response.error.reason) {
6152
+ case "non-json":
6153
+ throw new LangfuseAPIError({
6154
+ statusCode: _response.error.statusCode,
6155
+ body: _response.error.rawBody,
6156
+ rawResponse: _response.rawResponse
6157
+ });
6158
+ case "timeout":
6159
+ throw new LangfuseAPITimeoutError(
6160
+ "Timeout exceeded when calling GET /api/public/v2/evaluation-rules."
6161
+ );
6162
+ case "unknown":
6163
+ throw new LangfuseAPIError({
6164
+ message: _response.error.errorMessage,
6165
+ rawResponse: _response.rawResponse
6166
+ });
6167
+ }
6168
+ }
6169
+ /**
6170
+ * Get one evaluation rule, including a legacy trace or dataset rule, by its stable identifier.
6171
+ *
6172
+ * @param {string} evaluationRuleId - Stable evaluation-rule identifier returned by the evaluation-rule endpoints.
6173
+ * @param {EvaluationRules.RequestOptions} requestOptions - Request-specific configuration.
6174
+ *
6175
+ * @throws {@link LangfuseAPI.EvaluationUnauthorizedError}
6176
+ * @throws {@link LangfuseAPI.EvaluationAccessDeniedError}
6177
+ * @throws {@link LangfuseAPI.EvaluationNotFoundError}
6178
+ * @throws {@link LangfuseAPI.EvaluationMethodNotAllowedError}
6179
+ * @throws {@link LangfuseAPI.TooManyRequestsError}
6180
+ * @throws {@link LangfuseAPI.InternalServerError}
6181
+ * @throws {@link LangfuseAPI.Error}
6182
+ * @throws {@link LangfuseAPI.UnauthorizedError}
6183
+ * @throws {@link LangfuseAPI.AccessDeniedError}
6184
+ * @throws {@link LangfuseAPI.MethodNotAllowedError}
6185
+ * @throws {@link LangfuseAPI.NotFoundError}
6186
+ *
6187
+ * @example
6188
+ * await client.evaluationRules.get("evaluationRuleId")
6189
+ */
6190
+ get(evaluationRuleId, requestOptions) {
6191
+ return HttpResponsePromise.fromPromise(
6192
+ this.__get(evaluationRuleId, requestOptions)
6193
+ );
6194
+ }
6195
+ async __get(evaluationRuleId, requestOptions) {
6196
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
6197
+ let _headers = mergeHeaders(
6198
+ (_a2 = this._options) == null ? void 0 : _a2.headers,
6199
+ mergeOnlyDefinedHeaders({
6200
+ Authorization: await this._getAuthorizationHeader(),
6201
+ "X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
6202
+ "X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
6203
+ "X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
6204
+ }),
6205
+ requestOptions == null ? void 0 : requestOptions.headers
6206
+ );
6207
+ const _response = await fetcher({
6208
+ url: url_exports.join(
6209
+ (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
6210
+ `/api/public/v2/evaluation-rules/${encodeURIComponent(evaluationRuleId)}`
6211
+ ),
6212
+ method: "GET",
6213
+ headers: _headers,
6214
+ queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
6215
+ timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
6216
+ maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
6217
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
6218
+ });
6219
+ if (_response.ok) {
6220
+ return {
6221
+ data: _response.body,
6222
+ rawResponse: _response.rawResponse
6223
+ };
6224
+ }
6225
+ if (_response.error.reason === "status-code") {
6226
+ switch (_response.error.statusCode) {
6227
+ case 401:
6228
+ throw new EvaluationUnauthorizedError(
6229
+ _response.error.body,
6230
+ _response.rawResponse
6231
+ );
6232
+ case 403:
6233
+ throw new EvaluationAccessDeniedError(
6234
+ _response.error.body,
6235
+ _response.rawResponse
6236
+ );
6237
+ case 404:
6238
+ throw new EvaluationNotFoundError(
6239
+ _response.error.body,
6240
+ _response.rawResponse
6241
+ );
6242
+ case 405:
6243
+ throw new EvaluationMethodNotAllowedError(
6244
+ _response.error.body,
6245
+ _response.rawResponse
6246
+ );
6247
+ case 429:
6248
+ throw new TooManyRequestsError(
6249
+ _response.error.body,
6250
+ _response.rawResponse
6251
+ );
6252
+ case 500:
6253
+ throw new InternalServerError(
6254
+ _response.error.body,
6255
+ _response.rawResponse
6256
+ );
6257
+ case 400:
6258
+ throw new Error2(
6259
+ _response.error.body,
6260
+ _response.rawResponse
6261
+ );
6262
+ case 401:
6263
+ throw new UnauthorizedError(
6264
+ _response.error.body,
6265
+ _response.rawResponse
6266
+ );
6267
+ case 403:
6268
+ throw new AccessDeniedError(
6269
+ _response.error.body,
6270
+ _response.rawResponse
6271
+ );
6272
+ case 405:
6273
+ throw new MethodNotAllowedError(
6274
+ _response.error.body,
6275
+ _response.rawResponse
6276
+ );
6277
+ case 404:
6278
+ throw new NotFoundError(
6279
+ _response.error.body,
6280
+ _response.rawResponse
6281
+ );
6282
+ default:
6283
+ throw new LangfuseAPIError({
6284
+ statusCode: _response.error.statusCode,
6285
+ body: _response.error.body,
6286
+ rawResponse: _response.rawResponse
6287
+ });
6288
+ }
6289
+ }
6290
+ switch (_response.error.reason) {
6291
+ case "non-json":
6292
+ throw new LangfuseAPIError({
6293
+ statusCode: _response.error.statusCode,
6294
+ body: _response.error.rawBody,
6295
+ rawResponse: _response.rawResponse
6296
+ });
6297
+ case "timeout":
6298
+ throw new LangfuseAPITimeoutError(
6299
+ "Timeout exceeded when calling GET /api/public/v2/evaluation-rules/{evaluationRuleId}."
6300
+ );
6301
+ case "unknown":
6302
+ throw new LangfuseAPIError({
6303
+ message: _response.error.errorMessage,
6304
+ rawResponse: _response.rawResponse
6305
+ });
6306
+ }
6307
+ }
6308
+ /**
6309
+ * Update an evaluation rule by its stable identifier.
6310
+ *
6311
+ * Provide only the fields to change. Providing `evaluatorAssignments` replaces the complete assignment list. Replacing the list with an empty array disables the rule. Setting `enabled=true` is rejected when the resulting assignment list is empty, including when both fields are sent in the same request.
6312
+ *
6313
+ * Legacy trace and dataset rules follow the existing lifecycle restrictions: they can be deactivated with `enabled=false`, but their name, filters, sampling, and evaluator assignments cannot be changed.
6314
+ *
6315
+ * @param {string} evaluationRuleId - Stable evaluation-rule identifier returned by the evaluation-rule endpoints.
6316
+ * @param {LangfuseAPI.UpdateEvaluationRuleRequest} request
6317
+ * @param {EvaluationRules.RequestOptions} requestOptions - Request-specific configuration.
6318
+ *
6319
+ * @throws {@link LangfuseAPI.BadRequestError}
6320
+ * @throws {@link LangfuseAPI.EvaluationUnauthorizedError}
6321
+ * @throws {@link LangfuseAPI.EvaluationAccessDeniedError}
6322
+ * @throws {@link LangfuseAPI.EvaluationNotFoundError}
6323
+ * @throws {@link LangfuseAPI.EvaluationMethodNotAllowedError}
6324
+ * @throws {@link LangfuseAPI.ConflictError}
6325
+ * @throws {@link LangfuseAPI.TooManyRequestsError}
6326
+ * @throws {@link LangfuseAPI.InternalServerError}
6327
+ * @throws {@link LangfuseAPI.Error}
6328
+ * @throws {@link LangfuseAPI.UnauthorizedError}
6329
+ * @throws {@link LangfuseAPI.AccessDeniedError}
6330
+ * @throws {@link LangfuseAPI.MethodNotAllowedError}
6331
+ * @throws {@link LangfuseAPI.NotFoundError}
6332
+ *
6333
+ * @example
6334
+ * await client.evaluationRules.update("evaluationRuleId", {
6335
+ * name: undefined,
6336
+ * enabled: undefined,
6337
+ * sampling: undefined,
6338
+ * filter: undefined,
6339
+ * evaluatorAssignments: undefined
6340
+ * })
6341
+ */
6342
+ update(evaluationRuleId, request, requestOptions) {
6343
+ return HttpResponsePromise.fromPromise(
6344
+ this.__update(evaluationRuleId, request, requestOptions)
6345
+ );
6346
+ }
6347
+ async __update(evaluationRuleId, request, requestOptions) {
6348
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
6349
+ let _headers = mergeHeaders(
6350
+ (_a2 = this._options) == null ? void 0 : _a2.headers,
6351
+ mergeOnlyDefinedHeaders({
6352
+ Authorization: await this._getAuthorizationHeader(),
6353
+ "X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
6354
+ "X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
6355
+ "X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
6356
+ }),
6357
+ requestOptions == null ? void 0 : requestOptions.headers
6358
+ );
6359
+ const _response = await fetcher({
6360
+ url: url_exports.join(
6361
+ (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
6362
+ `/api/public/v2/evaluation-rules/${encodeURIComponent(evaluationRuleId)}`
6363
+ ),
6364
+ method: "PATCH",
6365
+ headers: _headers,
6366
+ contentType: "application/json",
6367
+ queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
6368
+ requestType: "json",
6369
+ body: request,
6370
+ timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
6371
+ maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
6372
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
6373
+ });
6374
+ if (_response.ok) {
6375
+ return {
6376
+ data: _response.body,
6377
+ rawResponse: _response.rawResponse
6378
+ };
6379
+ }
6380
+ if (_response.error.reason === "status-code") {
6381
+ switch (_response.error.statusCode) {
6382
+ case 400:
6383
+ throw new BadRequestError(
6384
+ _response.error.body,
6385
+ _response.rawResponse
6386
+ );
6387
+ case 401:
6388
+ throw new EvaluationUnauthorizedError(
6389
+ _response.error.body,
6390
+ _response.rawResponse
6391
+ );
6392
+ case 403:
6393
+ throw new EvaluationAccessDeniedError(
6394
+ _response.error.body,
6395
+ _response.rawResponse
6396
+ );
6397
+ case 404:
6398
+ throw new EvaluationNotFoundError(
6399
+ _response.error.body,
6400
+ _response.rawResponse
6401
+ );
6402
+ case 405:
6403
+ throw new EvaluationMethodNotAllowedError(
6404
+ _response.error.body,
6405
+ _response.rawResponse
6406
+ );
6407
+ case 409:
6408
+ throw new ConflictError(
6409
+ _response.error.body,
6410
+ _response.rawResponse
6411
+ );
6412
+ case 429:
6413
+ throw new TooManyRequestsError(
6414
+ _response.error.body,
6415
+ _response.rawResponse
6416
+ );
6417
+ case 500:
6418
+ throw new InternalServerError(
6419
+ _response.error.body,
6420
+ _response.rawResponse
6421
+ );
6422
+ case 400:
6423
+ throw new Error2(
6424
+ _response.error.body,
6425
+ _response.rawResponse
6426
+ );
6427
+ case 401:
6428
+ throw new UnauthorizedError(
6429
+ _response.error.body,
6430
+ _response.rawResponse
6431
+ );
6432
+ case 403:
6433
+ throw new AccessDeniedError(
6434
+ _response.error.body,
6435
+ _response.rawResponse
6436
+ );
6437
+ case 405:
6438
+ throw new MethodNotAllowedError(
6439
+ _response.error.body,
6440
+ _response.rawResponse
6441
+ );
6442
+ case 404:
6443
+ throw new NotFoundError(
6444
+ _response.error.body,
6445
+ _response.rawResponse
6446
+ );
6447
+ default:
6448
+ throw new LangfuseAPIError({
6449
+ statusCode: _response.error.statusCode,
6450
+ body: _response.error.body,
6451
+ rawResponse: _response.rawResponse
6452
+ });
6453
+ }
6454
+ }
6455
+ switch (_response.error.reason) {
6456
+ case "non-json":
6457
+ throw new LangfuseAPIError({
6458
+ statusCode: _response.error.statusCode,
6459
+ body: _response.error.rawBody,
6460
+ rawResponse: _response.rawResponse
6461
+ });
6462
+ case "timeout":
6463
+ throw new LangfuseAPITimeoutError(
6464
+ "Timeout exceeded when calling PATCH /api/public/v2/evaluation-rules/{evaluationRuleId}."
6465
+ );
6466
+ case "unknown":
6467
+ throw new LangfuseAPIError({
6468
+ message: _response.error.errorMessage,
6469
+ rawResponse: _response.rawResponse
6470
+ });
6471
+ }
6472
+ }
6473
+ /**
6474
+ * Delete an evaluation rule.
6475
+ *
6476
+ * This removes the live-ingestion rule only. It does not delete associated evaluators or scores already produced by them.
6477
+ *
6478
+ * Legacy trace and dataset rules can also be deleted. Their evaluators and previously produced scores are preserved.
6479
+ *
6480
+ * @param {string} evaluationRuleId - Stable evaluation-rule identifier returned by the evaluation-rule endpoints.
6481
+ * @param {EvaluationRules.RequestOptions} requestOptions - Request-specific configuration.
6482
+ *
6483
+ * @throws {@link LangfuseAPI.EvaluationUnauthorizedError}
6484
+ * @throws {@link LangfuseAPI.EvaluationAccessDeniedError}
6485
+ * @throws {@link LangfuseAPI.EvaluationNotFoundError}
6486
+ * @throws {@link LangfuseAPI.EvaluationMethodNotAllowedError}
6487
+ * @throws {@link LangfuseAPI.TooManyRequestsError}
6488
+ * @throws {@link LangfuseAPI.InternalServerError}
6489
+ * @throws {@link LangfuseAPI.Error}
6490
+ * @throws {@link LangfuseAPI.UnauthorizedError}
6491
+ * @throws {@link LangfuseAPI.AccessDeniedError}
6492
+ * @throws {@link LangfuseAPI.MethodNotAllowedError}
6493
+ * @throws {@link LangfuseAPI.NotFoundError}
6494
+ *
6495
+ * @example
6496
+ * await client.evaluationRules.delete("evaluationRuleId")
6497
+ */
6498
+ delete(evaluationRuleId, requestOptions) {
6499
+ return HttpResponsePromise.fromPromise(
6500
+ this.__delete(evaluationRuleId, requestOptions)
6501
+ );
6502
+ }
6503
+ async __delete(evaluationRuleId, requestOptions) {
6504
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
6505
+ let _headers = mergeHeaders(
6506
+ (_a2 = this._options) == null ? void 0 : _a2.headers,
6507
+ mergeOnlyDefinedHeaders({
6508
+ Authorization: await this._getAuthorizationHeader(),
6509
+ "X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
6510
+ "X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
6511
+ "X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
6512
+ }),
6513
+ requestOptions == null ? void 0 : requestOptions.headers
6514
+ );
6515
+ const _response = await fetcher({
6516
+ url: url_exports.join(
6517
+ (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
6518
+ `/api/public/v2/evaluation-rules/${encodeURIComponent(evaluationRuleId)}`
6519
+ ),
6520
+ method: "DELETE",
6521
+ headers: _headers,
6522
+ queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
6523
+ timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
6524
+ maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
6525
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
6526
+ });
6527
+ if (_response.ok) {
6528
+ return {
6529
+ data: _response.body,
6530
+ rawResponse: _response.rawResponse
6531
+ };
6532
+ }
6533
+ if (_response.error.reason === "status-code") {
6534
+ switch (_response.error.statusCode) {
6535
+ case 401:
6536
+ throw new EvaluationUnauthorizedError(
6537
+ _response.error.body,
6538
+ _response.rawResponse
6539
+ );
6540
+ case 403:
6541
+ throw new EvaluationAccessDeniedError(
6542
+ _response.error.body,
6543
+ _response.rawResponse
6544
+ );
6545
+ case 404:
6546
+ throw new EvaluationNotFoundError(
6547
+ _response.error.body,
6548
+ _response.rawResponse
6549
+ );
6550
+ case 405:
6551
+ throw new EvaluationMethodNotAllowedError(
6552
+ _response.error.body,
6553
+ _response.rawResponse
6554
+ );
6555
+ case 429:
6556
+ throw new TooManyRequestsError(
6557
+ _response.error.body,
6558
+ _response.rawResponse
6559
+ );
6560
+ case 500:
6561
+ throw new InternalServerError(
6562
+ _response.error.body,
6563
+ _response.rawResponse
6564
+ );
6565
+ case 400:
6566
+ throw new Error2(
6567
+ _response.error.body,
6568
+ _response.rawResponse
6569
+ );
6570
+ case 401:
6571
+ throw new UnauthorizedError(
6572
+ _response.error.body,
6573
+ _response.rawResponse
6574
+ );
6575
+ case 403:
6576
+ throw new AccessDeniedError(
6577
+ _response.error.body,
6578
+ _response.rawResponse
6579
+ );
6580
+ case 405:
6581
+ throw new MethodNotAllowedError(
6582
+ _response.error.body,
6583
+ _response.rawResponse
6584
+ );
6585
+ case 404:
6586
+ throw new NotFoundError(
6587
+ _response.error.body,
6588
+ _response.rawResponse
6589
+ );
6590
+ default:
6591
+ throw new LangfuseAPIError({
6592
+ statusCode: _response.error.statusCode,
6593
+ body: _response.error.body,
6594
+ rawResponse: _response.rawResponse
6595
+ });
6596
+ }
6597
+ }
6598
+ switch (_response.error.reason) {
6599
+ case "non-json":
6600
+ throw new LangfuseAPIError({
6601
+ statusCode: _response.error.statusCode,
6602
+ body: _response.error.rawBody,
6603
+ rawResponse: _response.rawResponse
6604
+ });
6605
+ case "timeout":
6606
+ throw new LangfuseAPITimeoutError(
6607
+ "Timeout exceeded when calling DELETE /api/public/v2/evaluation-rules/{evaluationRuleId}."
6608
+ );
6609
+ case "unknown":
6610
+ throw new LangfuseAPIError({
6611
+ message: _response.error.errorMessage,
6612
+ rawResponse: _response.rawResponse
6613
+ });
6614
+ }
6615
+ }
6616
+ async _getAuthorizationHeader() {
6617
+ const username = await Supplier.get(this._options.username);
6618
+ const password = await Supplier.get(this._options.password);
6619
+ if (username != null && password != null) {
6620
+ return BasicAuth.toAuthorizationHeader({
6621
+ username,
6622
+ password
6623
+ });
6624
+ }
6625
+ return void 0;
6626
+ }
6627
+ };
6628
+
6629
+ // src/api/api/resources/evaluators/client/Client.ts
6630
+ var Evaluators = class {
6631
+ constructor(_options) {
6632
+ this._options = _options;
6633
+ }
6634
+ /**
6635
+ * Create an evaluator in the authenticated project.
6636
+ *
6637
+ * An evaluator defines **how** Langfuse should score data. LLM-as-a-judge evaluators define a prompt, expected structured output, and optional model configuration. Code evaluators define source code and a runtime language.
6638
+ *
6639
+ * This always creates a new evaluator with version `1`. Names are not identifiers and do not need to be unique.
6640
+ *
6641
+ * @param {LangfuseAPI.CreateEvaluatorRequest} request
6642
+ * @param {Evaluators.RequestOptions} requestOptions - Request-specific configuration.
6643
+ *
6644
+ * @throws {@link LangfuseAPI.BadRequestError}
6645
+ * @throws {@link LangfuseAPI.EvaluationUnauthorizedError}
6646
+ * @throws {@link LangfuseAPI.EvaluationAccessDeniedError}
6647
+ * @throws {@link LangfuseAPI.EvaluationMethodNotAllowedError}
6648
+ * @throws {@link LangfuseAPI.PreconditionFailedError}
6649
+ * @throws {@link LangfuseAPI.TooManyRequestsError}
6650
+ * @throws {@link LangfuseAPI.InternalServerError}
6651
+ * @throws {@link LangfuseAPI.Error}
6652
+ * @throws {@link LangfuseAPI.UnauthorizedError}
6653
+ * @throws {@link LangfuseAPI.AccessDeniedError}
6654
+ * @throws {@link LangfuseAPI.MethodNotAllowedError}
6655
+ * @throws {@link LangfuseAPI.NotFoundError}
6656
+ *
6657
+ * @example
6658
+ * await client.evaluators.create({
6659
+ * type: "llm_as_judge",
6660
+ * name: "name",
6661
+ * description: undefined,
6662
+ * type: "llm_as_judge",
6663
+ * prompt: "prompt",
6664
+ * modelConfig: undefined,
6665
+ * variableMapping: undefined,
6666
+ * outputDefinition: {
6667
+ * dataType: "NUMERIC",
6668
+ * dataType: "NUMERIC",
6669
+ * minValue: undefined,
6670
+ * maxValue: undefined,
6671
+ * scoreReasoningInstructions: undefined,
6672
+ * scoreValueInstructions: undefined
6673
+ * }
6674
+ * })
6675
+ */
6676
+ create(request, requestOptions) {
6677
+ return HttpResponsePromise.fromPromise(
6678
+ this.__create(request, requestOptions)
6679
+ );
6680
+ }
6681
+ async __create(request, requestOptions) {
6682
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
6683
+ let _headers = mergeHeaders(
6684
+ (_a2 = this._options) == null ? void 0 : _a2.headers,
6685
+ mergeOnlyDefinedHeaders({
6686
+ Authorization: await this._getAuthorizationHeader(),
6687
+ "X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
6688
+ "X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
6689
+ "X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
6690
+ }),
6691
+ requestOptions == null ? void 0 : requestOptions.headers
6692
+ );
6693
+ const _response = await fetcher({
6694
+ url: url_exports.join(
6695
+ (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
6696
+ "/api/public/v2/evaluators"
6697
+ ),
6698
+ method: "POST",
6699
+ headers: _headers,
6700
+ contentType: "application/json",
6701
+ queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
6702
+ requestType: "json",
6703
+ body: request,
6704
+ timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
6705
+ maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
6706
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
6707
+ });
6708
+ if (_response.ok) {
6709
+ return {
6710
+ data: _response.body,
6711
+ rawResponse: _response.rawResponse
6712
+ };
6713
+ }
6714
+ if (_response.error.reason === "status-code") {
6715
+ switch (_response.error.statusCode) {
6716
+ case 400:
6717
+ throw new BadRequestError(
6718
+ _response.error.body,
6719
+ _response.rawResponse
6720
+ );
6721
+ case 401:
6722
+ throw new EvaluationUnauthorizedError(
6723
+ _response.error.body,
6724
+ _response.rawResponse
6725
+ );
6726
+ case 403:
6727
+ throw new EvaluationAccessDeniedError(
6728
+ _response.error.body,
6729
+ _response.rawResponse
6730
+ );
6731
+ case 405:
6732
+ throw new EvaluationMethodNotAllowedError(
6733
+ _response.error.body,
6734
+ _response.rawResponse
6735
+ );
6736
+ case 412:
6737
+ throw new PreconditionFailedError(
6738
+ _response.error.body,
6739
+ _response.rawResponse
6740
+ );
6741
+ case 429:
6742
+ throw new TooManyRequestsError(
6743
+ _response.error.body,
6744
+ _response.rawResponse
6745
+ );
6746
+ case 500:
6747
+ throw new InternalServerError(
6748
+ _response.error.body,
6749
+ _response.rawResponse
6750
+ );
6751
+ case 400:
6752
+ throw new Error2(
6753
+ _response.error.body,
6754
+ _response.rawResponse
6755
+ );
6756
+ case 401:
6757
+ throw new UnauthorizedError(
6758
+ _response.error.body,
6759
+ _response.rawResponse
6760
+ );
6761
+ case 403:
6762
+ throw new AccessDeniedError(
6763
+ _response.error.body,
6764
+ _response.rawResponse
6765
+ );
6766
+ case 405:
6767
+ throw new MethodNotAllowedError(
6768
+ _response.error.body,
6769
+ _response.rawResponse
6770
+ );
6771
+ case 404:
6772
+ throw new NotFoundError(
6773
+ _response.error.body,
6774
+ _response.rawResponse
6775
+ );
6776
+ default:
6777
+ throw new LangfuseAPIError({
6778
+ statusCode: _response.error.statusCode,
6779
+ body: _response.error.body,
6780
+ rawResponse: _response.rawResponse
6781
+ });
6782
+ }
6783
+ }
6784
+ switch (_response.error.reason) {
6785
+ case "non-json":
6786
+ throw new LangfuseAPIError({
6787
+ statusCode: _response.error.statusCode,
6788
+ body: _response.error.rawBody,
6789
+ rawResponse: _response.rawResponse
6790
+ });
6791
+ case "timeout":
6792
+ throw new LangfuseAPITimeoutError(
6793
+ "Timeout exceeded when calling POST /api/public/v2/evaluators."
6794
+ );
6795
+ case "unknown":
6796
+ throw new LangfuseAPIError({
6797
+ message: _response.error.errorMessage,
6798
+ rawResponse: _response.rawResponse
6799
+ });
6800
+ }
6801
+ }
6802
+ /**
6803
+ * List evaluators in newest-first creation order.
6804
+ *
6805
+ * Every evaluator includes its latest definition and version metadata flattened into the evaluator object, plus associated evaluation rules. Treat the cursor as opaque and return it unchanged.
6806
+ *
6807
+ * @param {LangfuseAPI.ListEvaluatorsRequest} request
6808
+ * @param {Evaluators.RequestOptions} requestOptions - Request-specific configuration.
6809
+ *
6810
+ * @throws {@link LangfuseAPI.BadRequestError}
6811
+ * @throws {@link LangfuseAPI.EvaluationUnauthorizedError}
6812
+ * @throws {@link LangfuseAPI.EvaluationAccessDeniedError}
6813
+ * @throws {@link LangfuseAPI.EvaluationMethodNotAllowedError}
6814
+ * @throws {@link LangfuseAPI.TooManyRequestsError}
6815
+ * @throws {@link LangfuseAPI.InternalServerError}
6816
+ * @throws {@link LangfuseAPI.Error}
6817
+ * @throws {@link LangfuseAPI.UnauthorizedError}
6818
+ * @throws {@link LangfuseAPI.AccessDeniedError}
6819
+ * @throws {@link LangfuseAPI.MethodNotAllowedError}
6820
+ * @throws {@link LangfuseAPI.NotFoundError}
6821
+ *
6822
+ * @example
6823
+ * await client.evaluators.list()
6824
+ */
6825
+ list(request = {}, requestOptions) {
6826
+ return HttpResponsePromise.fromPromise(
6827
+ this.__list(request, requestOptions)
6828
+ );
6829
+ }
6830
+ async __list(request = {}, requestOptions) {
6831
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
6832
+ const { limit, cursor } = request;
6833
+ const _queryParams = {};
6834
+ if (limit != null) {
6835
+ _queryParams["limit"] = limit.toString();
6836
+ }
6837
+ if (cursor != null) {
6838
+ _queryParams["cursor"] = cursor;
6839
+ }
6840
+ let _headers = mergeHeaders(
6841
+ (_a2 = this._options) == null ? void 0 : _a2.headers,
6842
+ mergeOnlyDefinedHeaders({
6843
+ Authorization: await this._getAuthorizationHeader(),
6844
+ "X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
6845
+ "X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
6846
+ "X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
6847
+ }),
6848
+ requestOptions == null ? void 0 : requestOptions.headers
6849
+ );
6850
+ const _response = await fetcher({
6851
+ url: url_exports.join(
6852
+ (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
6853
+ "/api/public/v2/evaluators"
6854
+ ),
6855
+ method: "GET",
6856
+ headers: _headers,
6857
+ queryParameters: { ..._queryParams, ...requestOptions == null ? void 0 : requestOptions.queryParams },
6858
+ timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
6859
+ maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
6860
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
6861
+ });
6862
+ if (_response.ok) {
6863
+ return {
6864
+ data: _response.body,
6865
+ rawResponse: _response.rawResponse
6866
+ };
6867
+ }
6868
+ if (_response.error.reason === "status-code") {
6869
+ switch (_response.error.statusCode) {
6870
+ case 400:
6871
+ throw new BadRequestError(
6872
+ _response.error.body,
6873
+ _response.rawResponse
6874
+ );
6875
+ case 401:
6876
+ throw new EvaluationUnauthorizedError(
6877
+ _response.error.body,
6878
+ _response.rawResponse
6879
+ );
6880
+ case 403:
6881
+ throw new EvaluationAccessDeniedError(
6882
+ _response.error.body,
6883
+ _response.rawResponse
6884
+ );
6885
+ case 405:
6886
+ throw new EvaluationMethodNotAllowedError(
6887
+ _response.error.body,
6888
+ _response.rawResponse
6889
+ );
6890
+ case 429:
6891
+ throw new TooManyRequestsError(
6892
+ _response.error.body,
6893
+ _response.rawResponse
6894
+ );
6895
+ case 500:
6896
+ throw new InternalServerError(
6897
+ _response.error.body,
6898
+ _response.rawResponse
6899
+ );
6900
+ case 400:
6901
+ throw new Error2(
6902
+ _response.error.body,
6903
+ _response.rawResponse
6904
+ );
6905
+ case 401:
6906
+ throw new UnauthorizedError(
6907
+ _response.error.body,
6908
+ _response.rawResponse
6909
+ );
6910
+ case 403:
6911
+ throw new AccessDeniedError(
6912
+ _response.error.body,
6913
+ _response.rawResponse
6914
+ );
6915
+ case 405:
6916
+ throw new MethodNotAllowedError(
6917
+ _response.error.body,
6918
+ _response.rawResponse
6919
+ );
6920
+ case 404:
6921
+ throw new NotFoundError(
6922
+ _response.error.body,
6923
+ _response.rawResponse
6924
+ );
6925
+ default:
6926
+ throw new LangfuseAPIError({
6927
+ statusCode: _response.error.statusCode,
6928
+ body: _response.error.body,
6929
+ rawResponse: _response.rawResponse
6930
+ });
6931
+ }
6932
+ }
6933
+ switch (_response.error.reason) {
6934
+ case "non-json":
6935
+ throw new LangfuseAPIError({
6936
+ statusCode: _response.error.statusCode,
6937
+ body: _response.error.rawBody,
6938
+ rawResponse: _response.rawResponse
6939
+ });
6940
+ case "timeout":
6941
+ throw new LangfuseAPITimeoutError(
6942
+ "Timeout exceeded when calling GET /api/public/v2/evaluators."
6943
+ );
6944
+ case "unknown":
6945
+ throw new LangfuseAPIError({
6946
+ message: _response.error.errorMessage,
6947
+ rawResponse: _response.rawResponse
6948
+ });
6949
+ }
6950
+ }
6951
+ /**
6952
+ * Get one evaluator by its stable identifier.
6953
+ *
6954
+ * The response includes the evaluator's latest definition and version metadata flattened into the evaluator object, plus associated evaluation rules. Use the version-history endpoint when older definitions are needed.
6955
+ *
6956
+ * @param {string} evaluatorId - Stable evaluator identifier returned by the evaluator endpoints.
6957
+ * @param {Evaluators.RequestOptions} requestOptions - Request-specific configuration.
6958
+ *
6959
+ * @throws {@link LangfuseAPI.EvaluationUnauthorizedError}
6960
+ * @throws {@link LangfuseAPI.EvaluationAccessDeniedError}
6961
+ * @throws {@link LangfuseAPI.EvaluationNotFoundError}
6962
+ * @throws {@link LangfuseAPI.EvaluationMethodNotAllowedError}
6963
+ * @throws {@link LangfuseAPI.TooManyRequestsError}
6964
+ * @throws {@link LangfuseAPI.InternalServerError}
6965
+ * @throws {@link LangfuseAPI.Error}
6966
+ * @throws {@link LangfuseAPI.UnauthorizedError}
6967
+ * @throws {@link LangfuseAPI.AccessDeniedError}
6968
+ * @throws {@link LangfuseAPI.MethodNotAllowedError}
6969
+ * @throws {@link LangfuseAPI.NotFoundError}
6970
+ *
6971
+ * @example
6972
+ * await client.evaluators.get("evaluatorId")
6973
+ */
6974
+ get(evaluatorId, requestOptions) {
6975
+ return HttpResponsePromise.fromPromise(
6976
+ this.__get(evaluatorId, requestOptions)
6977
+ );
6978
+ }
6979
+ async __get(evaluatorId, requestOptions) {
6980
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
6981
+ let _headers = mergeHeaders(
6982
+ (_a2 = this._options) == null ? void 0 : _a2.headers,
6983
+ mergeOnlyDefinedHeaders({
6984
+ Authorization: await this._getAuthorizationHeader(),
6985
+ "X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
6986
+ "X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
6987
+ "X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
6988
+ }),
6989
+ requestOptions == null ? void 0 : requestOptions.headers
6990
+ );
6991
+ const _response = await fetcher({
6992
+ url: url_exports.join(
6993
+ (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
6994
+ `/api/public/v2/evaluators/${encodeURIComponent(evaluatorId)}`
6995
+ ),
6996
+ method: "GET",
6997
+ headers: _headers,
6998
+ queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
6999
+ timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
7000
+ maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
7001
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
7002
+ });
7003
+ if (_response.ok) {
7004
+ return {
7005
+ data: _response.body,
7006
+ rawResponse: _response.rawResponse
7007
+ };
7008
+ }
7009
+ if (_response.error.reason === "status-code") {
7010
+ switch (_response.error.statusCode) {
7011
+ case 401:
7012
+ throw new EvaluationUnauthorizedError(
7013
+ _response.error.body,
7014
+ _response.rawResponse
7015
+ );
7016
+ case 403:
7017
+ throw new EvaluationAccessDeniedError(
7018
+ _response.error.body,
7019
+ _response.rawResponse
7020
+ );
7021
+ case 404:
7022
+ throw new EvaluationNotFoundError(
7023
+ _response.error.body,
7024
+ _response.rawResponse
7025
+ );
7026
+ case 405:
7027
+ throw new EvaluationMethodNotAllowedError(
7028
+ _response.error.body,
7029
+ _response.rawResponse
7030
+ );
7031
+ case 429:
7032
+ throw new TooManyRequestsError(
7033
+ _response.error.body,
7034
+ _response.rawResponse
7035
+ );
7036
+ case 500:
7037
+ throw new InternalServerError(
7038
+ _response.error.body,
7039
+ _response.rawResponse
7040
+ );
7041
+ case 400:
7042
+ throw new Error2(
7043
+ _response.error.body,
7044
+ _response.rawResponse
7045
+ );
7046
+ case 401:
7047
+ throw new UnauthorizedError(
7048
+ _response.error.body,
7049
+ _response.rawResponse
7050
+ );
7051
+ case 403:
7052
+ throw new AccessDeniedError(
7053
+ _response.error.body,
7054
+ _response.rawResponse
7055
+ );
7056
+ case 405:
7057
+ throw new MethodNotAllowedError(
7058
+ _response.error.body,
7059
+ _response.rawResponse
7060
+ );
7061
+ case 404:
7062
+ throw new NotFoundError(
7063
+ _response.error.body,
7064
+ _response.rawResponse
7065
+ );
7066
+ default:
7067
+ throw new LangfuseAPIError({
7068
+ statusCode: _response.error.statusCode,
7069
+ body: _response.error.body,
7070
+ rawResponse: _response.rawResponse
7071
+ });
7072
+ }
7073
+ }
7074
+ switch (_response.error.reason) {
7075
+ case "non-json":
7076
+ throw new LangfuseAPIError({
7077
+ statusCode: _response.error.statusCode,
7078
+ body: _response.error.rawBody,
7079
+ rawResponse: _response.rawResponse
7080
+ });
7081
+ case "timeout":
7082
+ throw new LangfuseAPITimeoutError(
7083
+ "Timeout exceeded when calling GET /api/public/v2/evaluators/{evaluatorId}."
7084
+ );
7085
+ case "unknown":
7086
+ throw new LangfuseAPIError({
7087
+ message: _response.error.errorMessage,
7088
+ rawResponse: _response.rawResponse
7089
+ });
7090
+ }
7091
+ }
7092
+ /**
7093
+ * Update an evaluator by its stable identifier.
7094
+ *
7095
+ * Provide only the top-level fields to change. Metadata-only changes do not create a version. Evaluator type cannot change.
7096
+ *
7097
+ * Definition fields are flattened into the request. To replace a definition, include `type` and every definition field for that type. Definition fields are replaced as a complete unit rather than merged. For LLM-as-a-judge evaluators, omitting or setting `modelConfig` to `null` selects the project's default evaluation model.
7098
+ *
7099
+ * Replacing a definition automatically returns an evaluator paused by an invalid or missing model configuration to `active`, while preserving its id and evaluation-rule assignments. Pauses caused by provider authentication, billing, connectivity, account state, or an unknown legacy reason remain paused until the explicit reactivation check succeeds.
7100
+ *
7101
+ * @param {string} evaluatorId - Stable evaluator identifier returned by the evaluator endpoints.
7102
+ * @param {LangfuseAPI.UpdateEvaluatorRequest} request
7103
+ * @param {Evaluators.RequestOptions} requestOptions - Request-specific configuration.
7104
+ *
7105
+ * @throws {@link LangfuseAPI.BadRequestError}
7106
+ * @throws {@link LangfuseAPI.EvaluationUnauthorizedError}
7107
+ * @throws {@link LangfuseAPI.EvaluationAccessDeniedError}
7108
+ * @throws {@link LangfuseAPI.EvaluationNotFoundError}
7109
+ * @throws {@link LangfuseAPI.EvaluationMethodNotAllowedError}
7110
+ * @throws {@link LangfuseAPI.ConflictError}
7111
+ * @throws {@link LangfuseAPI.PreconditionFailedError}
7112
+ * @throws {@link LangfuseAPI.TooManyRequestsError}
7113
+ * @throws {@link LangfuseAPI.InternalServerError}
7114
+ * @throws {@link LangfuseAPI.Error}
7115
+ * @throws {@link LangfuseAPI.UnauthorizedError}
7116
+ * @throws {@link LangfuseAPI.AccessDeniedError}
7117
+ * @throws {@link LangfuseAPI.MethodNotAllowedError}
7118
+ * @throws {@link LangfuseAPI.NotFoundError}
7119
+ *
7120
+ * @example
7121
+ * await client.evaluators.update("evaluatorId", {
7122
+ * name: undefined,
7123
+ * description: undefined
7124
+ * })
7125
+ */
7126
+ update(evaluatorId, request, requestOptions) {
7127
+ return HttpResponsePromise.fromPromise(
7128
+ this.__update(evaluatorId, request, requestOptions)
7129
+ );
7130
+ }
7131
+ async __update(evaluatorId, request, requestOptions) {
7132
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
7133
+ let _headers = mergeHeaders(
7134
+ (_a2 = this._options) == null ? void 0 : _a2.headers,
7135
+ mergeOnlyDefinedHeaders({
7136
+ Authorization: await this._getAuthorizationHeader(),
7137
+ "X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
7138
+ "X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
7139
+ "X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
7140
+ }),
7141
+ requestOptions == null ? void 0 : requestOptions.headers
7142
+ );
7143
+ const _response = await fetcher({
7144
+ url: url_exports.join(
7145
+ (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
7146
+ `/api/public/v2/evaluators/${encodeURIComponent(evaluatorId)}`
7147
+ ),
7148
+ method: "PATCH",
7149
+ headers: _headers,
7150
+ contentType: "application/json",
7151
+ queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
7152
+ requestType: "json",
7153
+ body: request,
7154
+ timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
7155
+ maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
7156
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
7157
+ });
7158
+ if (_response.ok) {
7159
+ return {
7160
+ data: _response.body,
7161
+ rawResponse: _response.rawResponse
7162
+ };
7163
+ }
7164
+ if (_response.error.reason === "status-code") {
7165
+ switch (_response.error.statusCode) {
7166
+ case 400:
7167
+ throw new BadRequestError(
7168
+ _response.error.body,
7169
+ _response.rawResponse
7170
+ );
7171
+ case 401:
7172
+ throw new EvaluationUnauthorizedError(
7173
+ _response.error.body,
7174
+ _response.rawResponse
7175
+ );
7176
+ case 403:
7177
+ throw new EvaluationAccessDeniedError(
7178
+ _response.error.body,
7179
+ _response.rawResponse
7180
+ );
7181
+ case 404:
7182
+ throw new EvaluationNotFoundError(
7183
+ _response.error.body,
7184
+ _response.rawResponse
7185
+ );
7186
+ case 405:
7187
+ throw new EvaluationMethodNotAllowedError(
7188
+ _response.error.body,
7189
+ _response.rawResponse
7190
+ );
7191
+ case 409:
7192
+ throw new ConflictError(
7193
+ _response.error.body,
7194
+ _response.rawResponse
7195
+ );
7196
+ case 412:
7197
+ throw new PreconditionFailedError(
7198
+ _response.error.body,
7199
+ _response.rawResponse
7200
+ );
7201
+ case 429:
7202
+ throw new TooManyRequestsError(
7203
+ _response.error.body,
7204
+ _response.rawResponse
7205
+ );
7206
+ case 500:
7207
+ throw new InternalServerError(
7208
+ _response.error.body,
7209
+ _response.rawResponse
7210
+ );
7211
+ case 400:
7212
+ throw new Error2(
7213
+ _response.error.body,
7214
+ _response.rawResponse
7215
+ );
7216
+ case 401:
7217
+ throw new UnauthorizedError(
7218
+ _response.error.body,
7219
+ _response.rawResponse
7220
+ );
7221
+ case 403:
7222
+ throw new AccessDeniedError(
7223
+ _response.error.body,
7224
+ _response.rawResponse
7225
+ );
7226
+ case 405:
7227
+ throw new MethodNotAllowedError(
7228
+ _response.error.body,
7229
+ _response.rawResponse
7230
+ );
7231
+ case 404:
7232
+ throw new NotFoundError(
7233
+ _response.error.body,
7234
+ _response.rawResponse
7235
+ );
7236
+ default:
7237
+ throw new LangfuseAPIError({
7238
+ statusCode: _response.error.statusCode,
7239
+ body: _response.error.body,
7240
+ rawResponse: _response.rawResponse
7241
+ });
7242
+ }
7243
+ }
7244
+ switch (_response.error.reason) {
7245
+ case "non-json":
7246
+ throw new LangfuseAPIError({
7247
+ statusCode: _response.error.statusCode,
7248
+ body: _response.error.rawBody,
7249
+ rawResponse: _response.rawResponse
7250
+ });
7251
+ case "timeout":
7252
+ throw new LangfuseAPITimeoutError(
7253
+ "Timeout exceeded when calling PATCH /api/public/v2/evaluators/{evaluatorId}."
5291
7254
  );
5292
7255
  case "unknown":
5293
7256
  throw new LangfuseAPIError({
@@ -5297,12 +7260,19 @@ var Datasets = class {
5297
7260
  }
5298
7261
  }
5299
7262
  /**
5300
- * Delete a dataset run and all its run items. This action is irreversible.
7263
+ * Delete an evaluator and all of its stored versions.
5301
7264
  *
5302
- * @param {string} datasetName
5303
- * @param {string} runName
5304
- * @param {Datasets.RequestOptions} requestOptions - Request-specific configuration.
7265
+ * Associated evaluation-rule assignments are also removed. Scores already produced by the evaluator are preserved.
5305
7266
  *
7267
+ * @param {string} evaluatorId - Stable evaluator identifier returned by the evaluator endpoints.
7268
+ * @param {Evaluators.RequestOptions} requestOptions - Request-specific configuration.
7269
+ *
7270
+ * @throws {@link LangfuseAPI.EvaluationUnauthorizedError}
7271
+ * @throws {@link LangfuseAPI.EvaluationAccessDeniedError}
7272
+ * @throws {@link LangfuseAPI.EvaluationNotFoundError}
7273
+ * @throws {@link LangfuseAPI.EvaluationMethodNotAllowedError}
7274
+ * @throws {@link LangfuseAPI.TooManyRequestsError}
7275
+ * @throws {@link LangfuseAPI.InternalServerError}
5306
7276
  * @throws {@link LangfuseAPI.Error}
5307
7277
  * @throws {@link LangfuseAPI.UnauthorizedError}
5308
7278
  * @throws {@link LangfuseAPI.AccessDeniedError}
@@ -5310,14 +7280,14 @@ var Datasets = class {
5310
7280
  * @throws {@link LangfuseAPI.NotFoundError}
5311
7281
  *
5312
7282
  * @example
5313
- * await client.datasets.deleteRun("datasetName", "runName")
7283
+ * await client.evaluators.delete("evaluatorId")
5314
7284
  */
5315
- deleteRun(datasetName, runName, requestOptions) {
7285
+ delete(evaluatorId, requestOptions) {
5316
7286
  return HttpResponsePromise.fromPromise(
5317
- this.__deleteRun(datasetName, runName, requestOptions)
7287
+ this.__delete(evaluatorId, requestOptions)
5318
7288
  );
5319
7289
  }
5320
- async __deleteRun(datasetName, runName, requestOptions) {
7290
+ async __delete(evaluatorId, requestOptions) {
5321
7291
  var _a2, _b, _c, _d, _e, _f, _g, _h;
5322
7292
  let _headers = mergeHeaders(
5323
7293
  (_a2 = this._options) == null ? void 0 : _a2.headers,
@@ -5332,7 +7302,7 @@ var Datasets = class {
5332
7302
  const _response = await fetcher({
5333
7303
  url: url_exports.join(
5334
7304
  (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
5335
- `/api/public/datasets/${encodeURIComponent(datasetName)}/runs/${encodeURIComponent(runName)}`
7305
+ `/api/public/v2/evaluators/${encodeURIComponent(evaluatorId)}`
5336
7306
  ),
5337
7307
  method: "DELETE",
5338
7308
  headers: _headers,
@@ -5349,6 +7319,36 @@ var Datasets = class {
5349
7319
  }
5350
7320
  if (_response.error.reason === "status-code") {
5351
7321
  switch (_response.error.statusCode) {
7322
+ case 401:
7323
+ throw new EvaluationUnauthorizedError(
7324
+ _response.error.body,
7325
+ _response.rawResponse
7326
+ );
7327
+ case 403:
7328
+ throw new EvaluationAccessDeniedError(
7329
+ _response.error.body,
7330
+ _response.rawResponse
7331
+ );
7332
+ case 404:
7333
+ throw new EvaluationNotFoundError(
7334
+ _response.error.body,
7335
+ _response.rawResponse
7336
+ );
7337
+ case 405:
7338
+ throw new EvaluationMethodNotAllowedError(
7339
+ _response.error.body,
7340
+ _response.rawResponse
7341
+ );
7342
+ case 429:
7343
+ throw new TooManyRequestsError(
7344
+ _response.error.body,
7345
+ _response.rawResponse
7346
+ );
7347
+ case 500:
7348
+ throw new InternalServerError(
7349
+ _response.error.body,
7350
+ _response.rawResponse
7351
+ );
5352
7352
  case 400:
5353
7353
  throw new Error2(
5354
7354
  _response.error.body,
@@ -5391,7 +7391,7 @@ var Datasets = class {
5391
7391
  });
5392
7392
  case "timeout":
5393
7393
  throw new LangfuseAPITimeoutError(
5394
- "Timeout exceeded when calling DELETE /api/public/datasets/{datasetName}/runs/{runName}."
7394
+ "Timeout exceeded when calling DELETE /api/public/v2/evaluators/{evaluatorId}."
5395
7395
  );
5396
7396
  case "unknown":
5397
7397
  throw new LangfuseAPIError({
@@ -5401,12 +7401,21 @@ var Datasets = class {
5401
7401
  }
5402
7402
  }
5403
7403
  /**
5404
- * Get dataset runs
7404
+ * List an evaluator's version history in newest-first order.
5405
7405
  *
5406
- * @param {string} datasetName
5407
- * @param {LangfuseAPI.GetDatasetRunsRequest} request
5408
- * @param {Datasets.RequestOptions} requestOptions - Request-specific configuration.
7406
+ * This endpoint is intended for history and audit use cases. Ordinary clients can use the flattened `version` and definition fields on the evaluator response.
7407
+ *
7408
+ * @param {string} evaluatorId - Stable evaluator identifier returned by the evaluator endpoints.
7409
+ * @param {LangfuseAPI.ListEvaluatorVersionsRequest} request
7410
+ * @param {Evaluators.RequestOptions} requestOptions - Request-specific configuration.
5409
7411
  *
7412
+ * @throws {@link LangfuseAPI.BadRequestError}
7413
+ * @throws {@link LangfuseAPI.EvaluationUnauthorizedError}
7414
+ * @throws {@link LangfuseAPI.EvaluationAccessDeniedError}
7415
+ * @throws {@link LangfuseAPI.EvaluationNotFoundError}
7416
+ * @throws {@link LangfuseAPI.EvaluationMethodNotAllowedError}
7417
+ * @throws {@link LangfuseAPI.TooManyRequestsError}
7418
+ * @throws {@link LangfuseAPI.InternalServerError}
5410
7419
  * @throws {@link LangfuseAPI.Error}
5411
7420
  * @throws {@link LangfuseAPI.UnauthorizedError}
5412
7421
  * @throws {@link LangfuseAPI.AccessDeniedError}
@@ -5414,23 +7423,23 @@ var Datasets = class {
5414
7423
  * @throws {@link LangfuseAPI.NotFoundError}
5415
7424
  *
5416
7425
  * @example
5417
- * await client.datasets.getRuns("datasetName")
7426
+ * await client.evaluators.listVersions("evaluatorId")
5418
7427
  */
5419
- getRuns(datasetName, request = {}, requestOptions) {
7428
+ listVersions(evaluatorId, request = {}, requestOptions) {
5420
7429
  return HttpResponsePromise.fromPromise(
5421
- this.__getRuns(datasetName, request, requestOptions)
7430
+ this.__listVersions(evaluatorId, request, requestOptions)
5422
7431
  );
5423
7432
  }
5424
- async __getRuns(datasetName, request = {}, requestOptions) {
7433
+ async __listVersions(evaluatorId, request = {}, requestOptions) {
5425
7434
  var _a2, _b, _c, _d, _e, _f, _g, _h;
5426
- const { page, limit } = request;
7435
+ const { limit, cursor } = request;
5427
7436
  const _queryParams = {};
5428
- if (page != null) {
5429
- _queryParams["page"] = page.toString();
5430
- }
5431
7437
  if (limit != null) {
5432
7438
  _queryParams["limit"] = limit.toString();
5433
7439
  }
7440
+ if (cursor != null) {
7441
+ _queryParams["cursor"] = cursor;
7442
+ }
5434
7443
  let _headers = mergeHeaders(
5435
7444
  (_a2 = this._options) == null ? void 0 : _a2.headers,
5436
7445
  mergeOnlyDefinedHeaders({
@@ -5444,7 +7453,7 @@ var Datasets = class {
5444
7453
  const _response = await fetcher({
5445
7454
  url: url_exports.join(
5446
7455
  (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
5447
- `/api/public/datasets/${encodeURIComponent(datasetName)}/runs`
7456
+ `/api/public/v2/evaluators/${encodeURIComponent(evaluatorId)}/versions`
5448
7457
  ),
5449
7458
  method: "GET",
5450
7459
  headers: _headers,
@@ -5461,6 +7470,41 @@ var Datasets = class {
5461
7470
  }
5462
7471
  if (_response.error.reason === "status-code") {
5463
7472
  switch (_response.error.statusCode) {
7473
+ case 400:
7474
+ throw new BadRequestError(
7475
+ _response.error.body,
7476
+ _response.rawResponse
7477
+ );
7478
+ case 401:
7479
+ throw new EvaluationUnauthorizedError(
7480
+ _response.error.body,
7481
+ _response.rawResponse
7482
+ );
7483
+ case 403:
7484
+ throw new EvaluationAccessDeniedError(
7485
+ _response.error.body,
7486
+ _response.rawResponse
7487
+ );
7488
+ case 404:
7489
+ throw new EvaluationNotFoundError(
7490
+ _response.error.body,
7491
+ _response.rawResponse
7492
+ );
7493
+ case 405:
7494
+ throw new EvaluationMethodNotAllowedError(
7495
+ _response.error.body,
7496
+ _response.rawResponse
7497
+ );
7498
+ case 429:
7499
+ throw new TooManyRequestsError(
7500
+ _response.error.body,
7501
+ _response.rawResponse
7502
+ );
7503
+ case 500:
7504
+ throw new InternalServerError(
7505
+ _response.error.body,
7506
+ _response.rawResponse
7507
+ );
5464
7508
  case 400:
5465
7509
  throw new Error2(
5466
7510
  _response.error.body,
@@ -5503,7 +7547,7 @@ var Datasets = class {
5503
7547
  });
5504
7548
  case "timeout":
5505
7549
  throw new LangfuseAPITimeoutError(
5506
- "Timeout exceeded when calling GET /api/public/datasets/{datasetName}/runs."
7550
+ "Timeout exceeded when calling GET /api/public/v2/evaluators/{evaluatorId}/versions."
5507
7551
  );
5508
7552
  case "unknown":
5509
7553
  throw new LangfuseAPIError({
@@ -5851,6 +7895,8 @@ var Feedback = class {
5851
7895
  /**
5852
7896
  * Submit explicit user-approved feedback about Langfuse skills, MCP tools, CLI, docs, or public API. Do not include secrets, credentials, customer data, trace payloads, or unrelated use-case details.
5853
7897
  *
7898
+ * Not available in the HIPAA cloud region.
7899
+ *
5854
7900
  * @param {LangfuseAPI.SubmitFeedbackRequest} request
5855
7901
  * @param {Feedback.RequestOptions} requestOptions - Request-specific configuration.
5856
7902
  *
@@ -6121,6 +8167,8 @@ var Ingestion = class {
6121
8167
  * - Batch sizes are limited to 3.5 MB in total. You need to adjust the number of events per batch accordingly.
6122
8168
  * - The API does not return a 4xx status code for input errors. Instead, it responds with a 207 status code, which includes a list of the encountered errors.
6123
8169
  *
8170
+ * @deprecated On Langfuse Cloud, Langfuse v3 is deprecated and this endpoint will be removed on November 16, 2026. Send data via the OpenTelemetry endpoint at `POST /api/public/otel/v1/traces` instead, see the [OpenTelemetry integration docs](https://langfuse.com/integrations/native/opentelemetry). Self-hosted deployments are unaffected by this date; the endpoint becomes unavailable when they upgrade to Langfuse v4.
8171
+ *
6124
8172
  * @param {LangfuseAPI.IngestionRequest} request
6125
8173
  * @param {Ingestion.RequestOptions} requestOptions - Request-specific configuration.
6126
8174
  *
@@ -6301,6 +8349,8 @@ var MetricsV1 = class {
6301
8349
  *
6302
8350
  * For more details, see the [Metrics API documentation](https://langfuse.com/docs/metrics/features/metrics-api).
6303
8351
  *
8352
+ * @deprecated On Langfuse Cloud, Langfuse v3 is deprecated and this endpoint will be removed on November 16, 2026. Use `GET /api/public/v2/metrics?query=<urlencoded json query>` instead. Self-hosted deployments are unaffected by this date; the endpoint becomes unavailable when they upgrade to Langfuse v4.
8353
+ *
6304
8354
  * @param {LangfuseAPI.legacy.GetMetricsRequest} request
6305
8355
  * @param {MetricsV1.RequestOptions} requestOptions - Request-specific configuration.
6306
8356
  *
@@ -6427,6 +8477,8 @@ var ObservationsV1 = class {
6427
8477
  /**
6428
8478
  * Get a observation
6429
8479
  *
8480
+ * @deprecated On Langfuse Cloud, Langfuse v3 is deprecated and this endpoint will be removed on November 16, 2026. Use `GET /api/public/v2/observations?fromStartTime=<from>&toStartTime=<to>` instead. Self-hosted deployments are unaffected by this date; the endpoint becomes unavailable when they upgrade to Langfuse v4.
8481
+ *
6430
8482
  * @param {string} observationId - The unique langfuse identifier of an observation, can be an event, span or generation
6431
8483
  * @param {ObservationsV1.RequestOptions} requestOptions - Request-specific configuration.
6432
8484
  *
@@ -6532,6 +8584,8 @@ var ObservationsV1 = class {
6532
8584
  *
6533
8585
  * Consider using the [v2 observations endpoint](/api-reference#tag/observationsv2/GET/api/public/v2/observations) for cursor-based pagination and field selection.
6534
8586
  *
8587
+ * @deprecated On Langfuse Cloud, Langfuse v3 is deprecated and this endpoint will be removed on November 16, 2026. Use `GET /api/public/v2/observations?fromStartTime=<from>&toStartTime=<to>` instead. Self-hosted deployments are unaffected by this date; the endpoint becomes unavailable when they upgrade to Langfuse v4.
8588
+ *
6535
8589
  * @param {LangfuseAPI.legacy.GetObservationsRequest} request
6536
8590
  * @param {ObservationsV1.RequestOptions} requestOptions - Request-specific configuration.
6537
8591
  *
@@ -6833,6 +8887,8 @@ var Scores = class {
6833
8887
  /**
6834
8888
  * Get a list of scores (supports both trace and session scores)
6835
8889
  *
8890
+ * @deprecated On Langfuse Cloud, Langfuse v3 is deprecated and this endpoint will be removed on November 16, 2026. Use `GET /api/public/v3/scores` instead. Self-hosted deployments are unaffected by this date; the endpoint becomes unavailable when they upgrade to Langfuse v4.
8891
+ *
6836
8892
  * @param {LangfuseAPI.GetScoresRequest} request
6837
8893
  * @param {Scores.RequestOptions} requestOptions - Request-specific configuration.
6838
8894
  *
@@ -7031,6 +9087,8 @@ var Scores = class {
7031
9087
  /**
7032
9088
  * Get a score (supports both trace and session scores)
7033
9089
  *
9090
+ * @deprecated On Langfuse Cloud, Langfuse v3 is deprecated and this endpoint will be removed on November 16, 2026. Use `GET /api/public/v3/scores` with the `id` filter instead. Self-hosted deployments are unaffected by this date; the endpoint becomes unavailable when they upgrade to Langfuse v4.
9091
+ *
7034
9092
  * @param {string} scoreId - The unique langfuse identifier of a score
7035
9093
  * @param {Scores.RequestOptions} requestOptions - Request-specific configuration.
7036
9094
  *
@@ -8242,7 +10300,7 @@ var Models = class {
8242
10300
  * modelName: "modelName",
8243
10301
  * matchPattern: "matchPattern",
8244
10302
  * startDate: undefined,
8245
- * unit: undefined,
10303
+ * unit: "CHARACTERS",
8246
10304
  * inputPrice: undefined,
8247
10305
  * outputPrice: undefined,
8248
10306
  * totalPrice: undefined,
@@ -8342,6 +10400,124 @@ var Models = class {
8342
10400
  });
8343
10401
  }
8344
10402
  }
10403
+ /**
10404
+ * Create or replace a project-owned model using its id. Built-in models cannot be modified.
10405
+ *
10406
+ * @param {string} id
10407
+ * @param {LangfuseAPI.CreateModelRequest} request
10408
+ * @param {Models.RequestOptions} requestOptions - Request-specific configuration.
10409
+ *
10410
+ * @throws {@link LangfuseAPI.Error}
10411
+ * @throws {@link LangfuseAPI.UnauthorizedError}
10412
+ * @throws {@link LangfuseAPI.AccessDeniedError}
10413
+ * @throws {@link LangfuseAPI.MethodNotAllowedError}
10414
+ * @throws {@link LangfuseAPI.NotFoundError}
10415
+ *
10416
+ * @example
10417
+ * await client.models.upsert("id", {
10418
+ * modelName: "modelName",
10419
+ * matchPattern: "matchPattern",
10420
+ * startDate: undefined,
10421
+ * unit: "CHARACTERS",
10422
+ * inputPrice: undefined,
10423
+ * outputPrice: undefined,
10424
+ * totalPrice: undefined,
10425
+ * pricingTiers: undefined,
10426
+ * tokenizerId: undefined,
10427
+ * tokenizerConfig: undefined
10428
+ * })
10429
+ */
10430
+ upsert(id, request, requestOptions) {
10431
+ return HttpResponsePromise.fromPromise(
10432
+ this.__upsert(id, request, requestOptions)
10433
+ );
10434
+ }
10435
+ async __upsert(id, request, requestOptions) {
10436
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
10437
+ let _headers = mergeHeaders(
10438
+ (_a2 = this._options) == null ? void 0 : _a2.headers,
10439
+ mergeOnlyDefinedHeaders({
10440
+ Authorization: await this._getAuthorizationHeader(),
10441
+ "X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
10442
+ "X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
10443
+ "X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
10444
+ }),
10445
+ requestOptions == null ? void 0 : requestOptions.headers
10446
+ );
10447
+ const _response = await fetcher({
10448
+ url: url_exports.join(
10449
+ (_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
10450
+ `/api/public/models/${encodeURIComponent(id)}`
10451
+ ),
10452
+ method: "PUT",
10453
+ headers: _headers,
10454
+ contentType: "application/json",
10455
+ queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
10456
+ requestType: "json",
10457
+ body: request,
10458
+ timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
10459
+ maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
10460
+ abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
10461
+ });
10462
+ if (_response.ok) {
10463
+ return {
10464
+ data: _response.body,
10465
+ rawResponse: _response.rawResponse
10466
+ };
10467
+ }
10468
+ if (_response.error.reason === "status-code") {
10469
+ switch (_response.error.statusCode) {
10470
+ case 400:
10471
+ throw new Error2(
10472
+ _response.error.body,
10473
+ _response.rawResponse
10474
+ );
10475
+ case 401:
10476
+ throw new UnauthorizedError(
10477
+ _response.error.body,
10478
+ _response.rawResponse
10479
+ );
10480
+ case 403:
10481
+ throw new AccessDeniedError(
10482
+ _response.error.body,
10483
+ _response.rawResponse
10484
+ );
10485
+ case 405:
10486
+ throw new MethodNotAllowedError(
10487
+ _response.error.body,
10488
+ _response.rawResponse
10489
+ );
10490
+ case 404:
10491
+ throw new NotFoundError(
10492
+ _response.error.body,
10493
+ _response.rawResponse
10494
+ );
10495
+ default:
10496
+ throw new LangfuseAPIError({
10497
+ statusCode: _response.error.statusCode,
10498
+ body: _response.error.body,
10499
+ rawResponse: _response.rawResponse
10500
+ });
10501
+ }
10502
+ }
10503
+ switch (_response.error.reason) {
10504
+ case "non-json":
10505
+ throw new LangfuseAPIError({
10506
+ statusCode: _response.error.statusCode,
10507
+ body: _response.error.rawBody,
10508
+ rawResponse: _response.rawResponse
10509
+ });
10510
+ case "timeout":
10511
+ throw new LangfuseAPITimeoutError(
10512
+ "Timeout exceeded when calling PUT /api/public/models/{id}."
10513
+ );
10514
+ case "unknown":
10515
+ throw new LangfuseAPIError({
10516
+ message: _response.error.errorMessage,
10517
+ rawResponse: _response.rawResponse
10518
+ });
10519
+ }
10520
+ }
8345
10521
  /**
8346
10522
  * Get all models
8347
10523
  *
@@ -12761,6 +14937,8 @@ var Sessions = class {
12761
14937
  * `sessionId` instead:
12762
14938
  * `GET /api/public/v2/observations?fromStartTime=<from>&toStartTime=<to>`.
12763
14939
  *
14940
+ * @deprecated On Langfuse Cloud, Langfuse v3 is deprecated and this endpoint will be removed on November 16, 2026. In Langfuse v4, read session data via `GET /api/public/v2/observations?filter=<urlencoded sessionId filter>&fromStartTime=<from>&toStartTime=<to>`. Self-hosted deployments are unaffected by this date; the endpoint becomes unavailable when they upgrade to Langfuse v4.
14941
+ *
12764
14942
  * @param {LangfuseAPI.GetSessionsRequest} request
12765
14943
  * @param {Sessions.RequestOptions} requestOptions - Request-specific configuration.
12766
14944
  *
@@ -12890,6 +15068,8 @@ var Sessions = class {
12890
15068
  * with a URL-encoded `sessionId` filter and a bounded time range:
12891
15069
  * `GET /api/public/v2/observations?filter=<sessionId filter>&fromStartTime=<from>&toStartTime=<to>`.
12892
15070
  *
15071
+ * @deprecated On Langfuse Cloud, Langfuse v3 is deprecated and this endpoint will be removed on November 16, 2026. In Langfuse v4, read session data via `GET /api/public/v2/observations?filter=<urlencoded sessionId filter>&fromStartTime=<from>&toStartTime=<to>`. Self-hosted deployments are unaffected by this date; the endpoint becomes unavailable when they upgrade to Langfuse v4.
15072
+ *
12893
15073
  * @param {string} sessionId - The unique id of a session
12894
15074
  * @param {Sessions.RequestOptions} requestOptions - Request-specific configuration.
12895
15075
  *
@@ -13011,6 +15191,8 @@ var Trace = class {
13011
15191
  /**
13012
15192
  * Get a specific trace
13013
15193
  *
15194
+ * @deprecated On Langfuse Cloud, Langfuse v3 is deprecated and this endpoint will be removed on November 16, 2026. In Langfuse v4, read span and trace data via `GET /api/public/v2/observations?fromStartTime=<from>&toStartTime=<to>`. Self-hosted deployments are unaffected by this date; the endpoint becomes unavailable when they upgrade to Langfuse v4.
15195
+ *
13014
15196
  * @param {string} traceId - The unique langfuse identifier of a trace
13015
15197
  * @param {LangfuseAPI.GetTraceRequest} request
13016
15198
  * @param {Trace.RequestOptions} requestOptions - Request-specific configuration.
@@ -13223,6 +15405,8 @@ var Trace = class {
13223
15405
  /**
13224
15406
  * Get list of traces
13225
15407
  *
15408
+ * @deprecated On Langfuse Cloud, Langfuse v3 is deprecated and this endpoint will be removed on November 16, 2026. In Langfuse v4, read span and trace data via `GET /api/public/v2/observations?fromStartTime=<from>&toStartTime=<to>`. Self-hosted deployments are unaffected by this date; the endpoint becomes unavailable when they upgrade to Langfuse v4.
15409
+ *
13226
15410
  * @param {LangfuseAPI.GetTracesRequest} request
13227
15411
  * @param {Trace.RequestOptions} requestOptions - Request-specific configuration.
13228
15412
  *
@@ -15560,7 +17744,7 @@ var Dashboards = class {
15560
17744
  };
15561
17745
 
15562
17746
  // src/api/api/resources/unstable/resources/evaluationRules/client/Client.ts
15563
- var EvaluationRules = class {
17747
+ var EvaluationRules2 = class {
15564
17748
  constructor(_options) {
15565
17749
  this._options = _options;
15566
17750
  }
@@ -15574,19 +17758,21 @@ var EvaluationRules = class {
15574
17758
  * Key rules:
15575
17759
  * - `name` must be unique within the project for public evaluation rules
15576
17760
  * - `target` must be `observation` or `experiment`
15577
- * - `evaluator.name` + `evaluator.scope` must identify an existing evaluator family returned by the evaluator endpoints
17761
+ * - provide either the compatibility `evaluator` field or the new `evaluators` array, never both
17762
+ * - each evaluator `name` + `type` must identify an existing evaluator family returned by the evaluator endpoints
15578
17763
  * - Langfuse resolves that family to its latest version before saving the evaluation rule
15579
17764
  * - for `target=experiment`, use dataset `id` values from `GET /api/public/v2/datasets` when filtering by `datasetId`
15580
- * - for `llm_as_judge` evaluators, every evaluator prompt variable must be mapped exactly once
17765
+ * - an omitted LLM-as-judge assignment mapping inherits the evaluator version's default mapping
17766
+ * - the effective mapping must map every evaluator prompt variable exactly once
15581
17767
  * - for `code` evaluators, Langfuse uses the fixed code runtime mapping; omit `mapping` in create and update requests
15582
17768
  * - for user-provided `llm_as_judge` mappings, `expected_output` and `experiment_item_metadata` are only valid for `target=experiment`
15583
17769
  * - if `enabled=true`, Langfuse validates that the referenced evaluator can currently run
15584
- * - at most 50 evaluation rules can be effectively active in one project at the same time
17770
+ * - at most 500 evaluation rules can be effectively active in one project at the same time (enforced identically by the API, the MCP tools, and the app)
15585
17771
  *
15586
17772
  * If an evaluation rule with the same `name` already exists in the project, the API returns `409`.
15587
17773
  * In that case, update the existing resource with `PATCH /api/public/unstable/evaluation-rules/{evaluationRuleId}` instead of creating a second one.
15588
17774
  *
15589
- * If enabling this resource would exceed the 50-active limit, the API also returns `409`.
17775
+ * If enabling this resource would exceed the 500-active limit, the API also returns `409`.
15590
17776
  * In that case, disable or pause another active evaluation rule before enabling a new one.
15591
17777
  *
15592
17778
  * Current scope:
@@ -15602,6 +17788,8 @@ var EvaluationRules = class {
15602
17788
  * - `400 invalid_json_path`: remove or correct the `jsonPath`
15603
17789
  * - `422 evaluator_preflight_failed`: the selected evaluator cannot run with the resolved model configuration. Fix the evaluator/default model setup, then retry the create request.
15604
17790
  *
17791
+ * @deprecated On Langfuse Cloud, this unstable endpoint is deprecated and will be removed on November 16, 2026. Use the stable `/api/public/v2/evaluation-rules` API instead. Self-hosted deployments are unaffected by this date; the endpoint becomes unavailable when they upgrade to Langfuse v4.
17792
+ *
15605
17793
  * @param {LangfuseAPI.unstable.CreateEvaluationRuleRequest} request
15606
17794
  * @param {EvaluationRules.RequestOptions} requestOptions - Request-specific configuration.
15607
17795
  *
@@ -15625,7 +17813,6 @@ var EvaluationRules = class {
15625
17813
  * name: "answer-correctness-live",
15626
17814
  * evaluator: {
15627
17815
  * name: "answer-correctness",
15628
- * scope: "project",
15629
17816
  * type: "llm_as_judge"
15630
17817
  * },
15631
17818
  * target: "observation",
@@ -15651,7 +17838,6 @@ var EvaluationRules = class {
15651
17838
  * name: "toxicity-code-live",
15652
17839
  * evaluator: {
15653
17840
  * name: "toxicity-detector",
15654
- * scope: "project",
15655
17841
  * type: "code"
15656
17842
  * },
15657
17843
  * target: "observation",
@@ -15670,7 +17856,6 @@ var EvaluationRules = class {
15670
17856
  * name: "experiment-expected-output-match",
15671
17857
  * evaluator: {
15672
17858
  * name: "expected-output-match",
15673
- * scope: "project",
15674
17859
  * type: "llm_as_judge"
15675
17860
  * },
15676
17861
  * target: "experiment",
@@ -15832,6 +18017,8 @@ var EvaluationRules = class {
15832
18017
  *
15833
18018
  * This includes legacy `trace` and `dataset` rules so they can be inspected and migrated to v4 rules. Legacy rules are read-only through this API; create, update, and delete continue to support only `observation` and `experiment` rules.
15834
18019
  *
18020
+ * @deprecated On Langfuse Cloud, this unstable endpoint is deprecated and will be removed on November 16, 2026. Use the stable `/api/public/v2/evaluation-rules` API instead. Self-hosted deployments are unaffected by this date; the endpoint becomes unavailable when they upgrade to Langfuse v4.
18021
+ *
15835
18022
  * @param {LangfuseAPI.unstable.ListEvaluationRulesRequest} request
15836
18023
  * @param {EvaluationRules.RequestOptions} requestOptions - Request-specific configuration.
15837
18024
  *
@@ -15981,6 +18168,8 @@ var EvaluationRules = class {
15981
18168
  *
15982
18169
  * Use this endpoint to inspect the current evaluator, target, mapping, filters, execution timing, and effective runtime status. Legacy `trace` and `dataset` rules are returned for migration and are read-only through this API.
15983
18170
  *
18171
+ * @deprecated On Langfuse Cloud, this unstable endpoint is deprecated and will be removed on November 16, 2026. Use the stable `/api/public/v2/evaluation-rules` API instead. Self-hosted deployments are unaffected by this date; the endpoint becomes unavailable when they upgrade to Langfuse v4.
18172
+ *
15984
18173
  * @param {string} evaluationRuleId - Evaluation rule identifier returned by the evaluation rule endpoints.
15985
18174
  * @param {EvaluationRules.RequestOptions} requestOptions - Request-specific configuration.
15986
18175
  *
@@ -16140,12 +18329,14 @@ var EvaluationRules = class {
16140
18329
  * - if you change `target` for an LLM-as-judge rule, also send a compatible `filter` and `mapping` in the same request unless the existing ones are still valid for the new target
16141
18330
  * - for `code` evaluator rules, omit `mapping`; Langfuse stores the fixed code runtime mapping automatically
16142
18331
  * - if the resulting config is enabled, Langfuse re-validates that the selected evaluator can run
16143
- * - if the update would move a non-active evaluation rule into the active state and the project already has 50 active evaluation rules, the API returns `409`
18332
+ * - if the update would move a non-active evaluation rule into the active state and the project already has 500 active evaluation rules, the API returns `409`
16144
18333
  *
16145
18334
  * Recovery guidance:
16146
18335
  * - if an LLM-as-judge update fails with `missing_variable_mapping` or `invalid_variable_mapping` after changing `evaluator` or `target`, resend the request with a complete new `mapping`
16147
18336
  * - if the update fails with `invalid_filter_value` after changing `target`, resend the request with a target-compatible `filter`
16148
18337
  *
18338
+ * @deprecated On Langfuse Cloud, this unstable endpoint is deprecated and will be removed on November 16, 2026. Use the stable `/api/public/v2/evaluation-rules` API instead. Self-hosted deployments are unaffected by this date; the endpoint becomes unavailable when they upgrade to Langfuse v4.
18339
+ *
16149
18340
  * @param {string} evaluationRuleId - Evaluation rule identifier.
16150
18341
  * @param {LangfuseAPI.unstable.UpdateEvaluationRuleRequest} request
16151
18342
  * @param {EvaluationRules.RequestOptions} requestOptions - Request-specific configuration.
@@ -16167,6 +18358,7 @@ var EvaluationRules = class {
16167
18358
  * @example
16168
18359
  * await client.unstable.evaluationRules.update("evaluationRuleId", {
16169
18360
  * name: undefined,
18361
+ * evaluators: undefined,
16170
18362
  * evaluator: undefined,
16171
18363
  * target: undefined,
16172
18364
  * enabled: undefined,
@@ -16311,6 +18503,8 @@ var EvaluationRules = class {
16311
18503
  *
16312
18504
  * This removes the live-ingestion rule only. It does not delete the referenced evaluator.
16313
18505
  *
18506
+ * @deprecated On Langfuse Cloud, this unstable endpoint is deprecated and will be removed on November 16, 2026. Use the stable `/api/public/v2/evaluation-rules` API instead. Self-hosted deployments are unaffected by this date; the endpoint becomes unavailable when they upgrade to Langfuse v4.
18507
+ *
16314
18508
  * @param {string} evaluationRuleId - Evaluation rule identifier.
16315
18509
  * @param {EvaluationRules.RequestOptions} requestOptions - Request-specific configuration.
16316
18510
  *
@@ -16467,7 +18661,7 @@ var EvaluationRules = class {
16467
18661
  };
16468
18662
 
16469
18663
  // src/api/api/resources/unstable/resources/evaluators/client/Client.ts
16470
- var Evaluators = class {
18664
+ var Evaluators2 = class {
16471
18665
  constructor(_options) {
16472
18666
  this._options = _options;
16473
18667
  }
@@ -16481,13 +18675,14 @@ var Evaluators = class {
16481
18675
  * Naming behavior:
16482
18676
  * - If this is a new evaluator name in your project, Langfuse creates version `1`.
16483
18677
  * - If the name already exists in your project, Langfuse creates the next version and returns it.
16484
- * - When a new project version is created, existing evaluation rules in that project automatically move to the newest version for that evaluator name.
18678
+ * - The evaluator `id` remains stable across versions.
18679
+ * - Existing evaluation rules automatically use the latest evaluator version; no rule update is required.
16485
18680
  *
16486
18681
  * Recommended workflow:
16487
18682
  * 1. Create the evaluator.
16488
18683
  * 2. Read the returned `variables` array.
16489
18684
  * 3. Read the returned `outputDefinition.dataType` so the client knows whether future scores will be numeric, boolean, or categorical.
16490
- * 4. Create one or more evaluation rules that reference the returned evaluator family using `name` and `scope`.
18685
+ * 4. Create one or more evaluation rules that reference the returned evaluator family using `name` and `type`.
16491
18686
  *
16492
18687
  * Code evaluator validation:
16493
18688
  * - At creation, Langfuse only validates the request shape
@@ -16502,6 +18697,8 @@ var Evaluators = class {
16502
18697
  * Unstable API note:
16503
18698
  * - This surface may evolve while the underlying evaluation data model is being redesigned.
16504
18699
  *
18700
+ * @deprecated On Langfuse Cloud, this unstable endpoint is deprecated and will be removed on November 16, 2026. Use the stable `/api/public/v2/evaluators` API instead. Self-hosted deployments are unaffected by this date; the endpoint becomes unavailable when they upgrade to Langfuse v4.
18701
+ *
16505
18702
  * @param {LangfuseAPI.unstable.CreateEvaluatorRequest} request
16506
18703
  * @param {Evaluators.RequestOptions} requestOptions - Request-specific configuration.
16507
18704
  *
@@ -16537,7 +18734,14 @@ var Evaluators = class {
16537
18734
  * modelConfig: {
16538
18735
  * provider: "openai",
16539
18736
  * model: "gpt-4.1-mini"
16540
- * }
18737
+ * },
18738
+ * mapping: [{
18739
+ * variable: "input",
18740
+ * source: "input"
18741
+ * }, {
18742
+ * variable: "output",
18743
+ * source: "output"
18744
+ * }]
16541
18745
  * })
16542
18746
  *
16543
18747
  * @example
@@ -16692,8 +18896,9 @@ var Evaluators = class {
16692
18896
  *
16693
18897
  * Important behavior:
16694
18898
  * - This endpoint returns the latest version of each available evaluator.
16695
- * - Results can include evaluators from your project and Langfuse-managed evaluators.
16696
- * - If the same evaluator name exists in both places, both are returned as separate items with different `scope` values.
18899
+ * - Every evaluator is owned by the authenticated project.
18900
+ *
18901
+ * @deprecated On Langfuse Cloud, this unstable endpoint is deprecated and will be removed on November 16, 2026. Use the stable `/api/public/v2/evaluators` API instead. Self-hosted deployments are unaffected by this date; the endpoint becomes unavailable when they upgrade to Langfuse v4.
16697
18902
  *
16698
18903
  * @param {LangfuseAPI.unstable.ListEvaluatorsRequest} request
16699
18904
  * @param {Evaluators.RequestOptions} requestOptions - Request-specific configuration.
@@ -16842,7 +19047,9 @@ var Evaluators = class {
16842
19047
  /**
16843
19048
  * Get one evaluator by `id`.
16844
19049
  *
16845
- * Use this endpoint when you want the prompt, output definition, model configuration, and derived variables for the evaluator you plan to use in an evaluation rule.
19050
+ * This endpoint always returns the evaluator's latest version. Use it when you want the current prompt, output definition, model configuration, and derived variables for the evaluator you plan to use in an evaluation rule.
19051
+ *
19052
+ * @deprecated On Langfuse Cloud, this unstable endpoint is deprecated and will be removed on November 16, 2026. Use the stable `/api/public/v2/evaluators` API instead. Self-hosted deployments are unaffected by this date; the endpoint becomes unavailable when they upgrade to Langfuse v4.
16846
19053
  *
16847
19054
  * @param {string} evaluatorId - Evaluator identifier returned by the evaluator endpoints.
16848
19055
  * @param {Evaluators.RequestOptions} requestOptions - Request-specific configuration.
@@ -16990,11 +19197,12 @@ var Evaluators = class {
16990
19197
  * Delete an evaluator.
16991
19198
  *
16992
19199
  * Important behavior:
16993
- * - This deletes the evaluator including all of its stored versions; `evaluatorId` may reference any version.
16994
- * - The API returns `409` while evaluation rules still reference the evaluator. Delete those evaluation rules first.
16995
- * - Langfuse-managed evaluators (`scope=managed`) cannot be deleted; the API returns `403`.
19200
+ * - This deletes the evaluator including all of its stored versions.
19201
+ * - Evaluation rule assignments referencing the evaluator are also deleted.
16996
19202
  * - Scores already produced by the evaluator are not deleted.
16997
19203
  *
19204
+ * @deprecated On Langfuse Cloud, this unstable endpoint is deprecated and will be removed on November 16, 2026. Use the stable `/api/public/v2/evaluators` API instead. Self-hosted deployments are unaffected by this date; the endpoint becomes unavailable when they upgrade to Langfuse v4.
19205
+ *
16998
19206
  * @param {string} evaluatorId - Evaluator identifier returned by the evaluator endpoints.
16999
19207
  * @param {Evaluators.RequestOptions} requestOptions - Request-specific configuration.
17000
19208
  *
@@ -17003,7 +19211,6 @@ var Evaluators = class {
17003
19211
  * @throws {@link LangfuseAPI.unstable.AccessDeniedError}
17004
19212
  * @throws {@link LangfuseAPI.unstable.NotFoundError}
17005
19213
  * @throws {@link LangfuseAPI.unstable.MethodNotAllowedError}
17006
- * @throws {@link LangfuseAPI.unstable.ConflictError}
17007
19214
  * @throws {@link LangfuseAPI.unstable.TooManyRequestsError}
17008
19215
  * @throws {@link LangfuseAPI.unstable.InternalServerError}
17009
19216
  * @throws {@link LangfuseAPI.Error}
@@ -17077,11 +19284,6 @@ var Evaluators = class {
17077
19284
  _response.error.body,
17078
19285
  _response.rawResponse
17079
19286
  );
17080
- case 409:
17081
- throw new unstable_exports.ConflictError(
17082
- _response.error.body,
17083
- _response.rawResponse
17084
- );
17085
19287
  case 429:
17086
19288
  throw new unstable_exports.TooManyRequestsError(
17087
19289
  _response.error.body,
@@ -17171,11 +19373,11 @@ var Unstable = class {
17171
19373
  }
17172
19374
  get evaluationRules() {
17173
19375
  var _a2;
17174
- return (_a2 = this._evaluationRules) != null ? _a2 : this._evaluationRules = new EvaluationRules(this._options);
19376
+ return (_a2 = this._evaluationRules) != null ? _a2 : this._evaluationRules = new EvaluationRules2(this._options);
17175
19377
  }
17176
19378
  get evaluators() {
17177
19379
  var _a2;
17178
- return (_a2 = this._evaluators) != null ? _a2 : this._evaluators = new Evaluators(this._options);
19380
+ return (_a2 = this._evaluators) != null ? _a2 : this._evaluators = new Evaluators2(this._options);
17179
19381
  }
17180
19382
  };
17181
19383
 
@@ -17220,6 +19422,14 @@ var LangfuseAPIClient = class {
17220
19422
  var _a2;
17221
19423
  return (_a2 = this._datasets) != null ? _a2 : this._datasets = new Datasets(this._options);
17222
19424
  }
19425
+ get evaluationRules() {
19426
+ var _a2;
19427
+ return (_a2 = this._evaluationRules) != null ? _a2 : this._evaluationRules = new EvaluationRules(this._options);
19428
+ }
19429
+ get evaluators() {
19430
+ var _a2;
19431
+ return (_a2 = this._evaluators) != null ? _a2 : this._evaluators = new Evaluators(this._options);
19432
+ }
17223
19433
  get experiments() {
17224
19434
  var _a2;
17225
19435
  return (_a2 = this._experiments) != null ? _a2 : this._experiments = new Experiments(this._options);
@@ -18207,6 +20417,7 @@ function getSpanKeyFromBaggageKey(baggageKey) {
18207
20417
  AccessDeniedError,
18208
20418
  AnnotationQueueObjectType,
18209
20419
  AnnotationQueueStatus,
20420
+ BadRequestError,
18210
20421
  BlobStorageExportFieldGroup,
18211
20422
  BlobStorageExportFrequency,
18212
20423
  BlobStorageExportMode,
@@ -18216,15 +20427,31 @@ function getSpanKeyFromBaggageKey(baggageKey) {
18216
20427
  BlobStorageIntegrationType,
18217
20428
  BlobStorageSyncStatus,
18218
20429
  ChatMessageType,
20430
+ CodeEvaluatorSourceCodeLanguage,
18219
20431
  CommentObjectType,
20432
+ ConflictError,
18220
20433
  CreateChatPromptType,
18221
20434
  CreateScoreSource,
18222
20435
  CreateTextPromptType,
18223
20436
  DatasetItemMediaReferenceField,
18224
20437
  DatasetStatus,
18225
20438
  Error,
20439
+ EvaluationAccessDeniedError,
20440
+ EvaluationMethodNotAllowedError,
20441
+ EvaluationNotFoundError,
20442
+ EvaluationRuleArrayOptionsFilterOperator,
20443
+ EvaluationRuleBooleanFilterOperator,
20444
+ EvaluationRuleNullFilterOperator,
20445
+ EvaluationRuleNumberFilterOperator,
20446
+ EvaluationRuleOptionsFilterOperator,
20447
+ EvaluationRuleStringFilterOperator,
20448
+ EvaluationUnauthorizedError,
20449
+ EvaluatorOutputScoreType,
20450
+ EvaluatorStatus,
20451
+ EvaluatorType,
18226
20452
  FeedbackNotConfiguredError,
18227
20453
  FeedbackTargetType,
20454
+ InternalServerError,
18228
20455
  LANGFUSE_SDK_EXPERIMENT_ENVIRONMENT,
18229
20456
  LANGFUSE_SDK_NAME,
18230
20457
  LANGFUSE_SDK_VERSION,
@@ -18237,23 +20464,30 @@ function getSpanKeyFromBaggageKey(baggageKey) {
18237
20464
  LangfuseMediaReference,
18238
20465
  LangfuseOtelContextKeys,
18239
20466
  LangfuseOtelSpanAttributes,
20467
+ LegacyEvaluationObject,
18240
20468
  LlmAdapter,
18241
20469
  LogLevel,
18242
20470
  Logger,
18243
20471
  MediaContentType,
18244
20472
  MembershipRole,
18245
20473
  MethodNotAllowedError,
20474
+ ModelTokenizerId,
18246
20475
  ModelUsageUnit,
18247
20476
  NotFoundError,
18248
20477
  ObservationLevel,
18249
20478
  ObservationType,
18250
20479
  PlaceholderMessageType,
20480
+ PreconditionFailedError,
20481
+ PricingTierAttributeSource,
18251
20482
  PricingTierOperator,
18252
20483
  PromptType,
20484
+ PromptVariableMappingSource,
20485
+ PublicApiErrorCode,
18253
20486
  ScoreConfigDataType,
18254
20487
  ScoreDataType,
18255
20488
  ScoreSource,
18256
20489
  ServiceUnavailableError,
20490
+ TooManyRequestsError,
18257
20491
  UnauthorizedError,
18258
20492
  annotationQueues,
18259
20493
  base64Decode,
@@ -18270,6 +20504,10 @@ function getSpanKeyFromBaggageKey(baggageKey) {
18270
20504
  datasetItems,
18271
20505
  datasetRunItems,
18272
20506
  datasets,
20507
+ evaluationCommons,
20508
+ evaluationErrors,
20509
+ evaluationRules,
20510
+ evaluators,
18273
20511
  experiments,
18274
20512
  feedback,
18275
20513
  generateUUID,