@langfuse/core 5.10.1 → 5.10.2
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 +2351 -113
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2698 -470
- package/dist/index.d.ts +2698 -470
- package/dist/index.mjs +2323 -113
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -276,7 +276,7 @@ var resetGlobalLogger = () => {
|
|
|
276
276
|
// package.json
|
|
277
277
|
var package_default = {
|
|
278
278
|
name: "@langfuse/core",
|
|
279
|
-
version: "5.10.
|
|
279
|
+
version: "5.10.2",
|
|
280
280
|
description: "Core functions and utilities for Langfuse packages",
|
|
281
281
|
type: "module",
|
|
282
282
|
sideEffects: false,
|
|
@@ -485,6 +485,7 @@ __export(commons_exports, {
|
|
|
485
485
|
ModelUsageUnit: () => ModelUsageUnit,
|
|
486
486
|
NotFoundError: () => NotFoundError,
|
|
487
487
|
ObservationLevel: () => ObservationLevel,
|
|
488
|
+
PricingTierAttributeSource: () => PricingTierAttributeSource,
|
|
488
489
|
PricingTierOperator: () => PricingTierOperator,
|
|
489
490
|
ScoreConfigDataType: () => ScoreConfigDataType,
|
|
490
491
|
ScoreDataType: () => ScoreDataType,
|
|
@@ -499,6 +500,12 @@ var DatasetItemMediaReferenceField = {
|
|
|
499
500
|
Metadata: "metadata"
|
|
500
501
|
};
|
|
501
502
|
|
|
503
|
+
// src/api/api/resources/commons/types/PricingTierAttributeSource.ts
|
|
504
|
+
var PricingTierAttributeSource = {
|
|
505
|
+
ModelParameters: "model_parameters",
|
|
506
|
+
Metadata: "metadata"
|
|
507
|
+
};
|
|
508
|
+
|
|
502
509
|
// src/api/api/resources/commons/types/PricingTierOperator.ts
|
|
503
510
|
var PricingTierOperator = {
|
|
504
511
|
Gt: "gt",
|
|
@@ -688,6 +695,271 @@ var datasetRunItems_exports = {};
|
|
|
688
695
|
// src/api/api/resources/datasets/index.ts
|
|
689
696
|
var datasets_exports = {};
|
|
690
697
|
|
|
698
|
+
// src/api/api/resources/evaluationCommons/index.ts
|
|
699
|
+
var evaluationCommons_exports = {};
|
|
700
|
+
__export(evaluationCommons_exports, {
|
|
701
|
+
CodeEvaluatorSourceCodeLanguage: () => CodeEvaluatorSourceCodeLanguage,
|
|
702
|
+
EvaluationRuleArrayOptionsFilterOperator: () => EvaluationRuleArrayOptionsFilterOperator,
|
|
703
|
+
EvaluationRuleBooleanFilterOperator: () => EvaluationRuleBooleanFilterOperator,
|
|
704
|
+
EvaluationRuleNullFilterOperator: () => EvaluationRuleNullFilterOperator,
|
|
705
|
+
EvaluationRuleNumberFilterOperator: () => EvaluationRuleNumberFilterOperator,
|
|
706
|
+
EvaluationRuleOptionsFilterOperator: () => EvaluationRuleOptionsFilterOperator,
|
|
707
|
+
EvaluationRuleStringFilterOperator: () => EvaluationRuleStringFilterOperator,
|
|
708
|
+
EvaluatorOutputScoreType: () => EvaluatorOutputScoreType,
|
|
709
|
+
EvaluatorType: () => EvaluatorType,
|
|
710
|
+
LegacyEvaluationObject: () => LegacyEvaluationObject,
|
|
711
|
+
PromptVariableMappingSource: () => PromptVariableMappingSource
|
|
712
|
+
});
|
|
713
|
+
|
|
714
|
+
// src/api/api/resources/evaluationCommons/types/EvaluatorType.ts
|
|
715
|
+
var EvaluatorType = {
|
|
716
|
+
LlmAsJudge: "llm_as_judge",
|
|
717
|
+
Code: "code"
|
|
718
|
+
};
|
|
719
|
+
|
|
720
|
+
// src/api/api/resources/evaluationCommons/types/CodeEvaluatorSourceCodeLanguage.ts
|
|
721
|
+
var CodeEvaluatorSourceCodeLanguage = {
|
|
722
|
+
Python: "PYTHON",
|
|
723
|
+
Typescript: "TYPESCRIPT"
|
|
724
|
+
};
|
|
725
|
+
|
|
726
|
+
// src/api/api/resources/evaluationCommons/types/PromptVariableMappingSource.ts
|
|
727
|
+
var PromptVariableMappingSource = {
|
|
728
|
+
Input: "input",
|
|
729
|
+
Output: "output",
|
|
730
|
+
Metadata: "metadata",
|
|
731
|
+
ToolCalls: "tool_calls",
|
|
732
|
+
ExpectedOutput: "expected_output",
|
|
733
|
+
ExperimentItemMetadata: "experiment_item_metadata"
|
|
734
|
+
};
|
|
735
|
+
|
|
736
|
+
// src/api/api/resources/evaluationCommons/types/EvaluatorOutputScoreType.ts
|
|
737
|
+
var EvaluatorOutputScoreType = {
|
|
738
|
+
Numeric: "NUMERIC",
|
|
739
|
+
Boolean: "BOOLEAN",
|
|
740
|
+
Categorical: "CATEGORICAL"
|
|
741
|
+
};
|
|
742
|
+
|
|
743
|
+
// src/api/api/resources/evaluationCommons/types/EvaluationRuleStringFilterOperator.ts
|
|
744
|
+
var EvaluationRuleStringFilterOperator = {
|
|
745
|
+
Equals: "=",
|
|
746
|
+
Contains: "contains",
|
|
747
|
+
DoesNotContain: "does not contain",
|
|
748
|
+
StartsWith: "starts with",
|
|
749
|
+
EndsWith: "ends with"
|
|
750
|
+
};
|
|
751
|
+
|
|
752
|
+
// src/api/api/resources/evaluationCommons/types/EvaluationRuleNumberFilterOperator.ts
|
|
753
|
+
var EvaluationRuleNumberFilterOperator = {
|
|
754
|
+
Equals: "=",
|
|
755
|
+
GreaterThan: ">",
|
|
756
|
+
LessThan: "<",
|
|
757
|
+
GreaterThanOrEqual: ">=",
|
|
758
|
+
LessThanOrEqual: "<="
|
|
759
|
+
};
|
|
760
|
+
|
|
761
|
+
// src/api/api/resources/evaluationCommons/types/EvaluationRuleOptionsFilterOperator.ts
|
|
762
|
+
var EvaluationRuleOptionsFilterOperator = {
|
|
763
|
+
AnyOf: "any of",
|
|
764
|
+
NoneOf: "none of"
|
|
765
|
+
};
|
|
766
|
+
|
|
767
|
+
// src/api/api/resources/evaluationCommons/types/EvaluationRuleArrayOptionsFilterOperator.ts
|
|
768
|
+
var EvaluationRuleArrayOptionsFilterOperator = {
|
|
769
|
+
AnyOf: "any of",
|
|
770
|
+
NoneOf: "none of",
|
|
771
|
+
AllOf: "all of"
|
|
772
|
+
};
|
|
773
|
+
|
|
774
|
+
// src/api/api/resources/evaluationCommons/types/EvaluationRuleBooleanFilterOperator.ts
|
|
775
|
+
var EvaluationRuleBooleanFilterOperator = {
|
|
776
|
+
Equals: "=",
|
|
777
|
+
NotEquals: "<>"
|
|
778
|
+
};
|
|
779
|
+
|
|
780
|
+
// src/api/api/resources/evaluationCommons/types/EvaluationRuleNullFilterOperator.ts
|
|
781
|
+
var EvaluationRuleNullFilterOperator = {
|
|
782
|
+
IsNull: "is null",
|
|
783
|
+
IsNotNull: "is not null"
|
|
784
|
+
};
|
|
785
|
+
|
|
786
|
+
// src/api/api/resources/evaluationCommons/types/LegacyEvaluationObject.ts
|
|
787
|
+
var LegacyEvaluationObject = {
|
|
788
|
+
Trace: "trace",
|
|
789
|
+
Span: "span",
|
|
790
|
+
Generation: "generation",
|
|
791
|
+
Event: "event",
|
|
792
|
+
Agent: "agent",
|
|
793
|
+
Tool: "tool",
|
|
794
|
+
Chain: "chain",
|
|
795
|
+
Retriever: "retriever",
|
|
796
|
+
Evaluator: "evaluator",
|
|
797
|
+
Embedding: "embedding",
|
|
798
|
+
Guardrail: "guardrail",
|
|
799
|
+
DatasetItem: "dataset_item"
|
|
800
|
+
};
|
|
801
|
+
|
|
802
|
+
// src/api/api/resources/evaluationErrors/index.ts
|
|
803
|
+
var evaluationErrors_exports = {};
|
|
804
|
+
__export(evaluationErrors_exports, {
|
|
805
|
+
BadRequestError: () => BadRequestError,
|
|
806
|
+
ConflictError: () => ConflictError,
|
|
807
|
+
EvaluationAccessDeniedError: () => EvaluationAccessDeniedError,
|
|
808
|
+
EvaluationMethodNotAllowedError: () => EvaluationMethodNotAllowedError,
|
|
809
|
+
EvaluationNotFoundError: () => EvaluationNotFoundError,
|
|
810
|
+
EvaluationUnauthorizedError: () => EvaluationUnauthorizedError,
|
|
811
|
+
InternalServerError: () => InternalServerError,
|
|
812
|
+
PreconditionFailedError: () => PreconditionFailedError,
|
|
813
|
+
PublicApiErrorCode: () => PublicApiErrorCode,
|
|
814
|
+
TooManyRequestsError: () => TooManyRequestsError
|
|
815
|
+
});
|
|
816
|
+
|
|
817
|
+
// src/api/api/resources/evaluationErrors/types/PublicApiErrorCode.ts
|
|
818
|
+
var PublicApiErrorCode = {
|
|
819
|
+
AuthenticationFailed: "authentication_failed",
|
|
820
|
+
AccessDenied: "access_denied",
|
|
821
|
+
InvalidRequest: "invalid_request",
|
|
822
|
+
InvalidQuery: "invalid_query",
|
|
823
|
+
InvalidBody: "invalid_body",
|
|
824
|
+
ResourceNotFound: "resource_not_found",
|
|
825
|
+
Conflict: "conflict",
|
|
826
|
+
RateLimited: "rate_limited",
|
|
827
|
+
MethodNotAllowed: "method_not_allowed",
|
|
828
|
+
InternalError: "internal_error"
|
|
829
|
+
};
|
|
830
|
+
|
|
831
|
+
// src/api/api/resources/evaluationErrors/errors/BadRequestError.ts
|
|
832
|
+
var BadRequestError = class _BadRequestError extends LangfuseAPIError {
|
|
833
|
+
constructor(body, rawResponse) {
|
|
834
|
+
super({
|
|
835
|
+
message: "BadRequestError",
|
|
836
|
+
statusCode: 400,
|
|
837
|
+
body,
|
|
838
|
+
rawResponse
|
|
839
|
+
});
|
|
840
|
+
Object.setPrototypeOf(this, _BadRequestError.prototype);
|
|
841
|
+
}
|
|
842
|
+
};
|
|
843
|
+
|
|
844
|
+
// src/api/api/resources/evaluationErrors/errors/EvaluationUnauthorizedError.ts
|
|
845
|
+
var EvaluationUnauthorizedError = class _EvaluationUnauthorizedError extends LangfuseAPIError {
|
|
846
|
+
constructor(body, rawResponse) {
|
|
847
|
+
super({
|
|
848
|
+
message: "EvaluationUnauthorizedError",
|
|
849
|
+
statusCode: 401,
|
|
850
|
+
body,
|
|
851
|
+
rawResponse
|
|
852
|
+
});
|
|
853
|
+
Object.setPrototypeOf(this, _EvaluationUnauthorizedError.prototype);
|
|
854
|
+
}
|
|
855
|
+
};
|
|
856
|
+
|
|
857
|
+
// src/api/api/resources/evaluationErrors/errors/EvaluationAccessDeniedError.ts
|
|
858
|
+
var EvaluationAccessDeniedError = class _EvaluationAccessDeniedError extends LangfuseAPIError {
|
|
859
|
+
constructor(body, rawResponse) {
|
|
860
|
+
super({
|
|
861
|
+
message: "EvaluationAccessDeniedError",
|
|
862
|
+
statusCode: 403,
|
|
863
|
+
body,
|
|
864
|
+
rawResponse
|
|
865
|
+
});
|
|
866
|
+
Object.setPrototypeOf(this, _EvaluationAccessDeniedError.prototype);
|
|
867
|
+
}
|
|
868
|
+
};
|
|
869
|
+
|
|
870
|
+
// src/api/api/resources/evaluationErrors/errors/EvaluationNotFoundError.ts
|
|
871
|
+
var EvaluationNotFoundError = class _EvaluationNotFoundError extends LangfuseAPIError {
|
|
872
|
+
constructor(body, rawResponse) {
|
|
873
|
+
super({
|
|
874
|
+
message: "EvaluationNotFoundError",
|
|
875
|
+
statusCode: 404,
|
|
876
|
+
body,
|
|
877
|
+
rawResponse
|
|
878
|
+
});
|
|
879
|
+
Object.setPrototypeOf(this, _EvaluationNotFoundError.prototype);
|
|
880
|
+
}
|
|
881
|
+
};
|
|
882
|
+
|
|
883
|
+
// src/api/api/resources/evaluationErrors/errors/EvaluationMethodNotAllowedError.ts
|
|
884
|
+
var EvaluationMethodNotAllowedError = class _EvaluationMethodNotAllowedError extends LangfuseAPIError {
|
|
885
|
+
constructor(body, rawResponse) {
|
|
886
|
+
super({
|
|
887
|
+
message: "EvaluationMethodNotAllowedError",
|
|
888
|
+
statusCode: 405,
|
|
889
|
+
body,
|
|
890
|
+
rawResponse
|
|
891
|
+
});
|
|
892
|
+
Object.setPrototypeOf(this, _EvaluationMethodNotAllowedError.prototype);
|
|
893
|
+
}
|
|
894
|
+
};
|
|
895
|
+
|
|
896
|
+
// src/api/api/resources/evaluationErrors/errors/ConflictError.ts
|
|
897
|
+
var ConflictError = class _ConflictError extends LangfuseAPIError {
|
|
898
|
+
constructor(body, rawResponse) {
|
|
899
|
+
super({
|
|
900
|
+
message: "ConflictError",
|
|
901
|
+
statusCode: 409,
|
|
902
|
+
body,
|
|
903
|
+
rawResponse
|
|
904
|
+
});
|
|
905
|
+
Object.setPrototypeOf(this, _ConflictError.prototype);
|
|
906
|
+
}
|
|
907
|
+
};
|
|
908
|
+
|
|
909
|
+
// src/api/api/resources/evaluationErrors/errors/PreconditionFailedError.ts
|
|
910
|
+
var PreconditionFailedError = class _PreconditionFailedError extends LangfuseAPIError {
|
|
911
|
+
constructor(body, rawResponse) {
|
|
912
|
+
super({
|
|
913
|
+
message: "PreconditionFailedError",
|
|
914
|
+
statusCode: 412,
|
|
915
|
+
body,
|
|
916
|
+
rawResponse
|
|
917
|
+
});
|
|
918
|
+
Object.setPrototypeOf(this, _PreconditionFailedError.prototype);
|
|
919
|
+
}
|
|
920
|
+
};
|
|
921
|
+
|
|
922
|
+
// src/api/api/resources/evaluationErrors/errors/TooManyRequestsError.ts
|
|
923
|
+
var TooManyRequestsError = class _TooManyRequestsError extends LangfuseAPIError {
|
|
924
|
+
constructor(body, rawResponse) {
|
|
925
|
+
super({
|
|
926
|
+
message: "TooManyRequestsError",
|
|
927
|
+
statusCode: 429,
|
|
928
|
+
body,
|
|
929
|
+
rawResponse
|
|
930
|
+
});
|
|
931
|
+
Object.setPrototypeOf(this, _TooManyRequestsError.prototype);
|
|
932
|
+
}
|
|
933
|
+
};
|
|
934
|
+
|
|
935
|
+
// src/api/api/resources/evaluationErrors/errors/InternalServerError.ts
|
|
936
|
+
var InternalServerError = class _InternalServerError extends LangfuseAPIError {
|
|
937
|
+
constructor(body, rawResponse) {
|
|
938
|
+
super({
|
|
939
|
+
message: "InternalServerError",
|
|
940
|
+
statusCode: 500,
|
|
941
|
+
body,
|
|
942
|
+
rawResponse
|
|
943
|
+
});
|
|
944
|
+
Object.setPrototypeOf(this, _InternalServerError.prototype);
|
|
945
|
+
}
|
|
946
|
+
};
|
|
947
|
+
|
|
948
|
+
// src/api/api/resources/evaluationRules/index.ts
|
|
949
|
+
var evaluationRules_exports = {};
|
|
950
|
+
|
|
951
|
+
// src/api/api/resources/evaluators/index.ts
|
|
952
|
+
var evaluators_exports = {};
|
|
953
|
+
__export(evaluators_exports, {
|
|
954
|
+
EvaluatorStatus: () => EvaluatorStatus
|
|
955
|
+
});
|
|
956
|
+
|
|
957
|
+
// src/api/api/resources/evaluators/types/EvaluatorStatus.ts
|
|
958
|
+
var EvaluatorStatus = {
|
|
959
|
+
Active: "active",
|
|
960
|
+
Paused: "paused"
|
|
961
|
+
};
|
|
962
|
+
|
|
691
963
|
// src/api/api/resources/experiments/index.ts
|
|
692
964
|
var experiments_exports = {};
|
|
693
965
|
|
|
@@ -868,6 +1140,15 @@ var metrics_exports = {};
|
|
|
868
1140
|
|
|
869
1141
|
// src/api/api/resources/models/index.ts
|
|
870
1142
|
var models_exports = {};
|
|
1143
|
+
__export(models_exports, {
|
|
1144
|
+
ModelTokenizerId: () => ModelTokenizerId
|
|
1145
|
+
});
|
|
1146
|
+
|
|
1147
|
+
// src/api/api/resources/models/types/ModelTokenizerId.ts
|
|
1148
|
+
var ModelTokenizerId = {
|
|
1149
|
+
Openai: "openai",
|
|
1150
|
+
Claude: "claude"
|
|
1151
|
+
};
|
|
871
1152
|
|
|
872
1153
|
// src/api/api/resources/observations/index.ts
|
|
873
1154
|
var observations_exports = {};
|
|
@@ -953,81 +1234,73 @@ var trace_exports = {};
|
|
|
953
1234
|
var unstable_exports = {};
|
|
954
1235
|
__export(unstable_exports, {
|
|
955
1236
|
AccessDeniedError: () => AccessDeniedError2,
|
|
956
|
-
BadRequestError: () =>
|
|
957
|
-
CodeEvaluatorSourceCodeLanguage: () =>
|
|
958
|
-
ConflictError: () =>
|
|
1237
|
+
BadRequestError: () => BadRequestError2,
|
|
1238
|
+
CodeEvaluatorSourceCodeLanguage: () => CodeEvaluatorSourceCodeLanguage2,
|
|
1239
|
+
ConflictError: () => ConflictError2,
|
|
959
1240
|
DashboardWidgetChartType: () => DashboardWidgetChartType,
|
|
960
1241
|
DashboardWidgetMetricAggregation: () => DashboardWidgetMetricAggregation,
|
|
961
1242
|
DashboardWidgetSortOrder: () => DashboardWidgetSortOrder,
|
|
962
1243
|
DashboardWidgetView: () => DashboardWidgetView,
|
|
963
1244
|
DashboardWidgetViewWithLegacy: () => DashboardWidgetViewWithLegacy,
|
|
964
|
-
EvaluationRuleArrayOptionsFilterOperator: () =>
|
|
965
|
-
EvaluationRuleBooleanFilterOperator: () =>
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
EvaluationRuleOptionsFilterOperator: () => EvaluationRuleOptionsFilterOperator,
|
|
1245
|
+
EvaluationRuleArrayOptionsFilterOperator: () => EvaluationRuleArrayOptionsFilterOperator2,
|
|
1246
|
+
EvaluationRuleBooleanFilterOperator: () => EvaluationRuleBooleanFilterOperator2,
|
|
1247
|
+
EvaluationRuleNullFilterOperator: () => EvaluationRuleNullFilterOperator2,
|
|
1248
|
+
EvaluationRuleNumberFilterOperator: () => EvaluationRuleNumberFilterOperator2,
|
|
1249
|
+
EvaluationRuleOptionsFilterOperator: () => EvaluationRuleOptionsFilterOperator2,
|
|
970
1250
|
EvaluationRuleStatus: () => EvaluationRuleStatus,
|
|
971
|
-
EvaluationRuleStringFilterOperator: () =>
|
|
1251
|
+
EvaluationRuleStringFilterOperator: () => EvaluationRuleStringFilterOperator2,
|
|
972
1252
|
EvaluationRuleTarget: () => EvaluationRuleTarget,
|
|
973
1253
|
EvaluationRuleTimeScope: () => EvaluationRuleTimeScope,
|
|
974
1254
|
EvaluatorOutputDataType: () => EvaluatorOutputDataType,
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
LegacyEvaluationObject: () => LegacyEvaluationObject,
|
|
1255
|
+
EvaluatorType: () => EvaluatorType2,
|
|
1256
|
+
InternalServerError: () => InternalServerError2,
|
|
1257
|
+
LegacyEvaluationObject: () => LegacyEvaluationObject2,
|
|
979
1258
|
LegacyEvaluationRuleTarget: () => LegacyEvaluationRuleTarget,
|
|
980
1259
|
LlmAsJudgeEvaluatorType: () => LlmAsJudgeEvaluatorType,
|
|
981
1260
|
MethodNotAllowedError: () => MethodNotAllowedError2,
|
|
982
1261
|
NotFoundError: () => NotFoundError2,
|
|
983
|
-
|
|
984
|
-
|
|
1262
|
+
PromptVariableMappingSource: () => PromptVariableMappingSource2,
|
|
1263
|
+
PublicApiErrorCode: () => PublicApiErrorCode2,
|
|
1264
|
+
TooManyRequestsError: () => TooManyRequestsError2,
|
|
985
1265
|
UnauthorizedError: () => UnauthorizedError2,
|
|
986
1266
|
UnprocessableContentError: () => UnprocessableContentError,
|
|
987
1267
|
commons: () => commons_exports2,
|
|
988
1268
|
dashboardWidgets: () => dashboardWidgets_exports,
|
|
989
1269
|
dashboards: () => dashboards_exports,
|
|
990
1270
|
errors: () => errors_exports2,
|
|
991
|
-
evaluationRules: () =>
|
|
992
|
-
evaluators: () =>
|
|
1271
|
+
evaluationRules: () => evaluationRules_exports2,
|
|
1272
|
+
evaluators: () => evaluators_exports2
|
|
993
1273
|
});
|
|
994
1274
|
|
|
995
1275
|
// src/api/api/resources/unstable/resources/commons/index.ts
|
|
996
1276
|
var commons_exports2 = {};
|
|
997
1277
|
__export(commons_exports2, {
|
|
998
|
-
CodeEvaluatorSourceCodeLanguage: () =>
|
|
999
|
-
EvaluationRuleArrayOptionsFilterOperator: () =>
|
|
1000
|
-
EvaluationRuleBooleanFilterOperator: () =>
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
EvaluationRuleOptionsFilterOperator: () => EvaluationRuleOptionsFilterOperator,
|
|
1278
|
+
CodeEvaluatorSourceCodeLanguage: () => CodeEvaluatorSourceCodeLanguage2,
|
|
1279
|
+
EvaluationRuleArrayOptionsFilterOperator: () => EvaluationRuleArrayOptionsFilterOperator2,
|
|
1280
|
+
EvaluationRuleBooleanFilterOperator: () => EvaluationRuleBooleanFilterOperator2,
|
|
1281
|
+
EvaluationRuleNullFilterOperator: () => EvaluationRuleNullFilterOperator2,
|
|
1282
|
+
EvaluationRuleNumberFilterOperator: () => EvaluationRuleNumberFilterOperator2,
|
|
1283
|
+
EvaluationRuleOptionsFilterOperator: () => EvaluationRuleOptionsFilterOperator2,
|
|
1005
1284
|
EvaluationRuleStatus: () => EvaluationRuleStatus,
|
|
1006
|
-
EvaluationRuleStringFilterOperator: () =>
|
|
1285
|
+
EvaluationRuleStringFilterOperator: () => EvaluationRuleStringFilterOperator2,
|
|
1007
1286
|
EvaluationRuleTarget: () => EvaluationRuleTarget,
|
|
1008
1287
|
EvaluatorOutputDataType: () => EvaluatorOutputDataType,
|
|
1009
|
-
|
|
1010
|
-
|
|
1288
|
+
EvaluatorType: () => EvaluatorType2,
|
|
1289
|
+
PromptVariableMappingSource: () => PromptVariableMappingSource2
|
|
1011
1290
|
});
|
|
1012
1291
|
|
|
1013
1292
|
// src/api/api/resources/unstable/resources/commons/types/EvaluatorType.ts
|
|
1014
|
-
var
|
|
1293
|
+
var EvaluatorType2 = {
|
|
1015
1294
|
LlmAsJudge: "llm_as_judge",
|
|
1016
1295
|
Code: "code"
|
|
1017
1296
|
};
|
|
1018
1297
|
|
|
1019
1298
|
// src/api/api/resources/unstable/resources/commons/types/CodeEvaluatorSourceCodeLanguage.ts
|
|
1020
|
-
var
|
|
1299
|
+
var CodeEvaluatorSourceCodeLanguage2 = {
|
|
1021
1300
|
Python: "PYTHON",
|
|
1022
1301
|
Typescript: "TYPESCRIPT"
|
|
1023
1302
|
};
|
|
1024
1303
|
|
|
1025
|
-
// src/api/api/resources/unstable/resources/commons/types/EvaluatorScope.ts
|
|
1026
|
-
var EvaluatorScope = {
|
|
1027
|
-
Project: "project",
|
|
1028
|
-
Managed: "managed"
|
|
1029
|
-
};
|
|
1030
|
-
|
|
1031
1304
|
// src/api/api/resources/unstable/resources/commons/types/EvaluationRuleTarget.ts
|
|
1032
1305
|
var EvaluationRuleTarget = {
|
|
1033
1306
|
Observation: "observation",
|
|
@@ -1041,8 +1314,8 @@ var EvaluationRuleStatus = {
|
|
|
1041
1314
|
Paused: "paused"
|
|
1042
1315
|
};
|
|
1043
1316
|
|
|
1044
|
-
// src/api/api/resources/unstable/resources/commons/types/
|
|
1045
|
-
var
|
|
1317
|
+
// src/api/api/resources/unstable/resources/commons/types/PromptVariableMappingSource.ts
|
|
1318
|
+
var PromptVariableMappingSource2 = {
|
|
1046
1319
|
Input: "input",
|
|
1047
1320
|
Output: "output",
|
|
1048
1321
|
Metadata: "metadata",
|
|
@@ -1059,7 +1332,7 @@ var EvaluatorOutputDataType = {
|
|
|
1059
1332
|
};
|
|
1060
1333
|
|
|
1061
1334
|
// src/api/api/resources/unstable/resources/commons/types/EvaluationRuleStringFilterOperator.ts
|
|
1062
|
-
var
|
|
1335
|
+
var EvaluationRuleStringFilterOperator2 = {
|
|
1063
1336
|
Equals: "=",
|
|
1064
1337
|
Contains: "contains",
|
|
1065
1338
|
DoesNotContain: "does not contain",
|
|
@@ -1068,7 +1341,7 @@ var EvaluationRuleStringFilterOperator = {
|
|
|
1068
1341
|
};
|
|
1069
1342
|
|
|
1070
1343
|
// src/api/api/resources/unstable/resources/commons/types/EvaluationRuleNumberFilterOperator.ts
|
|
1071
|
-
var
|
|
1344
|
+
var EvaluationRuleNumberFilterOperator2 = {
|
|
1072
1345
|
Equals: "=",
|
|
1073
1346
|
GreaterThan: ">",
|
|
1074
1347
|
LessThan: "<",
|
|
@@ -1077,26 +1350,26 @@ var EvaluationRuleNumberFilterOperator = {
|
|
|
1077
1350
|
};
|
|
1078
1351
|
|
|
1079
1352
|
// src/api/api/resources/unstable/resources/commons/types/EvaluationRuleOptionsFilterOperator.ts
|
|
1080
|
-
var
|
|
1353
|
+
var EvaluationRuleOptionsFilterOperator2 = {
|
|
1081
1354
|
AnyOf: "any of",
|
|
1082
1355
|
NoneOf: "none of"
|
|
1083
1356
|
};
|
|
1084
1357
|
|
|
1085
1358
|
// src/api/api/resources/unstable/resources/commons/types/EvaluationRuleArrayOptionsFilterOperator.ts
|
|
1086
|
-
var
|
|
1359
|
+
var EvaluationRuleArrayOptionsFilterOperator2 = {
|
|
1087
1360
|
AnyOf: "any of",
|
|
1088
1361
|
NoneOf: "none of",
|
|
1089
1362
|
AllOf: "all of"
|
|
1090
1363
|
};
|
|
1091
1364
|
|
|
1092
1365
|
// src/api/api/resources/unstable/resources/commons/types/EvaluationRuleBooleanFilterOperator.ts
|
|
1093
|
-
var
|
|
1366
|
+
var EvaluationRuleBooleanFilterOperator2 = {
|
|
1094
1367
|
Equals: "=",
|
|
1095
1368
|
NotEquals: "<>"
|
|
1096
1369
|
};
|
|
1097
1370
|
|
|
1098
1371
|
// src/api/api/resources/unstable/resources/commons/types/EvaluationRuleNullFilterOperator.ts
|
|
1099
|
-
var
|
|
1372
|
+
var EvaluationRuleNullFilterOperator2 = {
|
|
1100
1373
|
IsNull: "is null",
|
|
1101
1374
|
IsNotNull: "is not null"
|
|
1102
1375
|
};
|
|
@@ -1170,19 +1443,19 @@ var dashboards_exports = {};
|
|
|
1170
1443
|
var errors_exports2 = {};
|
|
1171
1444
|
__export(errors_exports2, {
|
|
1172
1445
|
AccessDeniedError: () => AccessDeniedError2,
|
|
1173
|
-
BadRequestError: () =>
|
|
1174
|
-
ConflictError: () =>
|
|
1175
|
-
InternalServerError: () =>
|
|
1446
|
+
BadRequestError: () => BadRequestError2,
|
|
1447
|
+
ConflictError: () => ConflictError2,
|
|
1448
|
+
InternalServerError: () => InternalServerError2,
|
|
1176
1449
|
MethodNotAllowedError: () => MethodNotAllowedError2,
|
|
1177
1450
|
NotFoundError: () => NotFoundError2,
|
|
1178
|
-
PublicApiErrorCode: () =>
|
|
1179
|
-
TooManyRequestsError: () =>
|
|
1451
|
+
PublicApiErrorCode: () => PublicApiErrorCode2,
|
|
1452
|
+
TooManyRequestsError: () => TooManyRequestsError2,
|
|
1180
1453
|
UnauthorizedError: () => UnauthorizedError2,
|
|
1181
1454
|
UnprocessableContentError: () => UnprocessableContentError
|
|
1182
1455
|
});
|
|
1183
1456
|
|
|
1184
1457
|
// src/api/api/resources/unstable/resources/errors/types/PublicApiErrorCode.ts
|
|
1185
|
-
var
|
|
1458
|
+
var PublicApiErrorCode2 = {
|
|
1186
1459
|
AuthenticationFailed: "authentication_failed",
|
|
1187
1460
|
AccessDenied: "access_denied",
|
|
1188
1461
|
InvalidRequest: "invalid_request",
|
|
@@ -1204,7 +1477,7 @@ var PublicApiErrorCode = {
|
|
|
1204
1477
|
};
|
|
1205
1478
|
|
|
1206
1479
|
// src/api/api/resources/unstable/resources/errors/errors/BadRequestError.ts
|
|
1207
|
-
var
|
|
1480
|
+
var BadRequestError2 = class _BadRequestError extends LangfuseAPIError {
|
|
1208
1481
|
constructor(body, rawResponse) {
|
|
1209
1482
|
super({
|
|
1210
1483
|
message: "BadRequestError",
|
|
@@ -1269,7 +1542,7 @@ var MethodNotAllowedError2 = class _MethodNotAllowedError extends LangfuseAPIErr
|
|
|
1269
1542
|
};
|
|
1270
1543
|
|
|
1271
1544
|
// src/api/api/resources/unstable/resources/errors/errors/ConflictError.ts
|
|
1272
|
-
var
|
|
1545
|
+
var ConflictError2 = class _ConflictError extends LangfuseAPIError {
|
|
1273
1546
|
constructor(body, rawResponse) {
|
|
1274
1547
|
super({
|
|
1275
1548
|
message: "ConflictError",
|
|
@@ -1295,7 +1568,7 @@ var UnprocessableContentError = class _UnprocessableContentError extends Langfus
|
|
|
1295
1568
|
};
|
|
1296
1569
|
|
|
1297
1570
|
// src/api/api/resources/unstable/resources/errors/errors/TooManyRequestsError.ts
|
|
1298
|
-
var
|
|
1571
|
+
var TooManyRequestsError2 = class _TooManyRequestsError extends LangfuseAPIError {
|
|
1299
1572
|
constructor(body, rawResponse) {
|
|
1300
1573
|
super({
|
|
1301
1574
|
message: "TooManyRequestsError",
|
|
@@ -1308,7 +1581,7 @@ var TooManyRequestsError = class _TooManyRequestsError extends LangfuseAPIError
|
|
|
1308
1581
|
};
|
|
1309
1582
|
|
|
1310
1583
|
// src/api/api/resources/unstable/resources/errors/errors/InternalServerError.ts
|
|
1311
|
-
var
|
|
1584
|
+
var InternalServerError2 = class _InternalServerError extends LangfuseAPIError {
|
|
1312
1585
|
constructor(body, rawResponse) {
|
|
1313
1586
|
super({
|
|
1314
1587
|
message: "InternalServerError",
|
|
@@ -1321,10 +1594,10 @@ var InternalServerError = class _InternalServerError extends LangfuseAPIError {
|
|
|
1321
1594
|
};
|
|
1322
1595
|
|
|
1323
1596
|
// src/api/api/resources/unstable/resources/evaluationRules/index.ts
|
|
1324
|
-
var
|
|
1325
|
-
__export(
|
|
1597
|
+
var evaluationRules_exports2 = {};
|
|
1598
|
+
__export(evaluationRules_exports2, {
|
|
1326
1599
|
EvaluationRuleTimeScope: () => EvaluationRuleTimeScope,
|
|
1327
|
-
LegacyEvaluationObject: () =>
|
|
1600
|
+
LegacyEvaluationObject: () => LegacyEvaluationObject2,
|
|
1328
1601
|
LegacyEvaluationRuleTarget: () => LegacyEvaluationRuleTarget,
|
|
1329
1602
|
LlmAsJudgeEvaluatorType: () => LlmAsJudgeEvaluatorType
|
|
1330
1603
|
});
|
|
@@ -1347,7 +1620,7 @@ var LegacyEvaluationRuleTarget = {
|
|
|
1347
1620
|
};
|
|
1348
1621
|
|
|
1349
1622
|
// src/api/api/resources/unstable/resources/evaluationRules/types/LegacyEvaluationObject.ts
|
|
1350
|
-
var
|
|
1623
|
+
var LegacyEvaluationObject2 = {
|
|
1351
1624
|
Trace: "trace",
|
|
1352
1625
|
Span: "span",
|
|
1353
1626
|
Generation: "generation",
|
|
@@ -1363,7 +1636,7 @@ var LegacyEvaluationObject = {
|
|
|
1363
1636
|
};
|
|
1364
1637
|
|
|
1365
1638
|
// src/api/api/resources/unstable/resources/evaluators/index.ts
|
|
1366
|
-
var
|
|
1639
|
+
var evaluators_exports2 = {};
|
|
1367
1640
|
|
|
1368
1641
|
// src/api/api/resources/utils/index.ts
|
|
1369
1642
|
var utils_exports = {};
|
|
@@ -4500,6 +4773,8 @@ var DatasetRunItems = class {
|
|
|
4500
4773
|
/**
|
|
4501
4774
|
* Create a dataset run item
|
|
4502
4775
|
*
|
|
4776
|
+
* @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.
|
|
4777
|
+
*
|
|
4503
4778
|
* @param {LangfuseAPI.CreateDatasetRunItemRequest} request
|
|
4504
4779
|
* @param {DatasetRunItems.RequestOptions} requestOptions - Request-specific configuration.
|
|
4505
4780
|
*
|
|
@@ -4615,6 +4890,8 @@ var DatasetRunItems = class {
|
|
|
4615
4890
|
/**
|
|
4616
4891
|
* List dataset run items
|
|
4617
4892
|
*
|
|
4893
|
+
* @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.
|
|
4894
|
+
*
|
|
4618
4895
|
* @param {LangfuseAPI.ListDatasetRunItemsRequest} request
|
|
4619
4896
|
* @param {DatasetRunItems.RequestOptions} requestOptions - Request-specific configuration.
|
|
4620
4897
|
*
|
|
@@ -5075,6 +5352,8 @@ var Datasets = class {
|
|
|
5075
5352
|
/**
|
|
5076
5353
|
* Get a dataset run and its items
|
|
5077
5354
|
*
|
|
5355
|
+
* @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.
|
|
5356
|
+
*
|
|
5078
5357
|
* @param {string} datasetName
|
|
5079
5358
|
* @param {string} runName
|
|
5080
5359
|
* @param {Datasets.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -5167,7 +5446,1663 @@ var Datasets = class {
|
|
|
5167
5446
|
});
|
|
5168
5447
|
case "timeout":
|
|
5169
5448
|
throw new LangfuseAPITimeoutError(
|
|
5170
|
-
"Timeout exceeded when calling GET /api/public/datasets/{datasetName}/runs/{runName}."
|
|
5449
|
+
"Timeout exceeded when calling GET /api/public/datasets/{datasetName}/runs/{runName}."
|
|
5450
|
+
);
|
|
5451
|
+
case "unknown":
|
|
5452
|
+
throw new LangfuseAPIError({
|
|
5453
|
+
message: _response.error.errorMessage,
|
|
5454
|
+
rawResponse: _response.rawResponse
|
|
5455
|
+
});
|
|
5456
|
+
}
|
|
5457
|
+
}
|
|
5458
|
+
/**
|
|
5459
|
+
* Delete a dataset run and all its run items. This action is irreversible.
|
|
5460
|
+
*
|
|
5461
|
+
* @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.
|
|
5462
|
+
*
|
|
5463
|
+
* @param {string} datasetName
|
|
5464
|
+
* @param {string} runName
|
|
5465
|
+
* @param {Datasets.RequestOptions} requestOptions - Request-specific configuration.
|
|
5466
|
+
*
|
|
5467
|
+
* @throws {@link LangfuseAPI.Error}
|
|
5468
|
+
* @throws {@link LangfuseAPI.UnauthorizedError}
|
|
5469
|
+
* @throws {@link LangfuseAPI.AccessDeniedError}
|
|
5470
|
+
* @throws {@link LangfuseAPI.MethodNotAllowedError}
|
|
5471
|
+
* @throws {@link LangfuseAPI.NotFoundError}
|
|
5472
|
+
*
|
|
5473
|
+
* @example
|
|
5474
|
+
* await client.datasets.deleteRun("datasetName", "runName")
|
|
5475
|
+
*/
|
|
5476
|
+
deleteRun(datasetName, runName, requestOptions) {
|
|
5477
|
+
return HttpResponsePromise.fromPromise(
|
|
5478
|
+
this.__deleteRun(datasetName, runName, requestOptions)
|
|
5479
|
+
);
|
|
5480
|
+
}
|
|
5481
|
+
async __deleteRun(datasetName, runName, requestOptions) {
|
|
5482
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
5483
|
+
let _headers = mergeHeaders(
|
|
5484
|
+
(_a2 = this._options) == null ? void 0 : _a2.headers,
|
|
5485
|
+
mergeOnlyDefinedHeaders({
|
|
5486
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
5487
|
+
"X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
|
|
5488
|
+
"X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
|
|
5489
|
+
"X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
|
|
5490
|
+
}),
|
|
5491
|
+
requestOptions == null ? void 0 : requestOptions.headers
|
|
5492
|
+
);
|
|
5493
|
+
const _response = await fetcher({
|
|
5494
|
+
url: url_exports.join(
|
|
5495
|
+
(_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
|
|
5496
|
+
`/api/public/datasets/${encodeURIComponent(datasetName)}/runs/${encodeURIComponent(runName)}`
|
|
5497
|
+
),
|
|
5498
|
+
method: "DELETE",
|
|
5499
|
+
headers: _headers,
|
|
5500
|
+
queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
|
|
5501
|
+
timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
5502
|
+
maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
|
|
5503
|
+
abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
|
|
5504
|
+
});
|
|
5505
|
+
if (_response.ok) {
|
|
5506
|
+
return {
|
|
5507
|
+
data: _response.body,
|
|
5508
|
+
rawResponse: _response.rawResponse
|
|
5509
|
+
};
|
|
5510
|
+
}
|
|
5511
|
+
if (_response.error.reason === "status-code") {
|
|
5512
|
+
switch (_response.error.statusCode) {
|
|
5513
|
+
case 400:
|
|
5514
|
+
throw new Error2(
|
|
5515
|
+
_response.error.body,
|
|
5516
|
+
_response.rawResponse
|
|
5517
|
+
);
|
|
5518
|
+
case 401:
|
|
5519
|
+
throw new UnauthorizedError(
|
|
5520
|
+
_response.error.body,
|
|
5521
|
+
_response.rawResponse
|
|
5522
|
+
);
|
|
5523
|
+
case 403:
|
|
5524
|
+
throw new AccessDeniedError(
|
|
5525
|
+
_response.error.body,
|
|
5526
|
+
_response.rawResponse
|
|
5527
|
+
);
|
|
5528
|
+
case 405:
|
|
5529
|
+
throw new MethodNotAllowedError(
|
|
5530
|
+
_response.error.body,
|
|
5531
|
+
_response.rawResponse
|
|
5532
|
+
);
|
|
5533
|
+
case 404:
|
|
5534
|
+
throw new NotFoundError(
|
|
5535
|
+
_response.error.body,
|
|
5536
|
+
_response.rawResponse
|
|
5537
|
+
);
|
|
5538
|
+
default:
|
|
5539
|
+
throw new LangfuseAPIError({
|
|
5540
|
+
statusCode: _response.error.statusCode,
|
|
5541
|
+
body: _response.error.body,
|
|
5542
|
+
rawResponse: _response.rawResponse
|
|
5543
|
+
});
|
|
5544
|
+
}
|
|
5545
|
+
}
|
|
5546
|
+
switch (_response.error.reason) {
|
|
5547
|
+
case "non-json":
|
|
5548
|
+
throw new LangfuseAPIError({
|
|
5549
|
+
statusCode: _response.error.statusCode,
|
|
5550
|
+
body: _response.error.rawBody,
|
|
5551
|
+
rawResponse: _response.rawResponse
|
|
5552
|
+
});
|
|
5553
|
+
case "timeout":
|
|
5554
|
+
throw new LangfuseAPITimeoutError(
|
|
5555
|
+
"Timeout exceeded when calling DELETE /api/public/datasets/{datasetName}/runs/{runName}."
|
|
5556
|
+
);
|
|
5557
|
+
case "unknown":
|
|
5558
|
+
throw new LangfuseAPIError({
|
|
5559
|
+
message: _response.error.errorMessage,
|
|
5560
|
+
rawResponse: _response.rawResponse
|
|
5561
|
+
});
|
|
5562
|
+
}
|
|
5563
|
+
}
|
|
5564
|
+
/**
|
|
5565
|
+
* Get dataset runs
|
|
5566
|
+
*
|
|
5567
|
+
* @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.
|
|
5568
|
+
*
|
|
5569
|
+
* @param {string} datasetName
|
|
5570
|
+
* @param {LangfuseAPI.GetDatasetRunsRequest} request
|
|
5571
|
+
* @param {Datasets.RequestOptions} requestOptions - Request-specific configuration.
|
|
5572
|
+
*
|
|
5573
|
+
* @throws {@link LangfuseAPI.Error}
|
|
5574
|
+
* @throws {@link LangfuseAPI.UnauthorizedError}
|
|
5575
|
+
* @throws {@link LangfuseAPI.AccessDeniedError}
|
|
5576
|
+
* @throws {@link LangfuseAPI.MethodNotAllowedError}
|
|
5577
|
+
* @throws {@link LangfuseAPI.NotFoundError}
|
|
5578
|
+
*
|
|
5579
|
+
* @example
|
|
5580
|
+
* await client.datasets.getRuns("datasetName")
|
|
5581
|
+
*/
|
|
5582
|
+
getRuns(datasetName, request = {}, requestOptions) {
|
|
5583
|
+
return HttpResponsePromise.fromPromise(
|
|
5584
|
+
this.__getRuns(datasetName, request, requestOptions)
|
|
5585
|
+
);
|
|
5586
|
+
}
|
|
5587
|
+
async __getRuns(datasetName, request = {}, requestOptions) {
|
|
5588
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
5589
|
+
const { page, limit } = request;
|
|
5590
|
+
const _queryParams = {};
|
|
5591
|
+
if (page != null) {
|
|
5592
|
+
_queryParams["page"] = page.toString();
|
|
5593
|
+
}
|
|
5594
|
+
if (limit != null) {
|
|
5595
|
+
_queryParams["limit"] = limit.toString();
|
|
5596
|
+
}
|
|
5597
|
+
let _headers = mergeHeaders(
|
|
5598
|
+
(_a2 = this._options) == null ? void 0 : _a2.headers,
|
|
5599
|
+
mergeOnlyDefinedHeaders({
|
|
5600
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
5601
|
+
"X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
|
|
5602
|
+
"X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
|
|
5603
|
+
"X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
|
|
5604
|
+
}),
|
|
5605
|
+
requestOptions == null ? void 0 : requestOptions.headers
|
|
5606
|
+
);
|
|
5607
|
+
const _response = await fetcher({
|
|
5608
|
+
url: url_exports.join(
|
|
5609
|
+
(_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
|
|
5610
|
+
`/api/public/datasets/${encodeURIComponent(datasetName)}/runs`
|
|
5611
|
+
),
|
|
5612
|
+
method: "GET",
|
|
5613
|
+
headers: _headers,
|
|
5614
|
+
queryParameters: { ..._queryParams, ...requestOptions == null ? void 0 : requestOptions.queryParams },
|
|
5615
|
+
timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
5616
|
+
maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
|
|
5617
|
+
abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
|
|
5618
|
+
});
|
|
5619
|
+
if (_response.ok) {
|
|
5620
|
+
return {
|
|
5621
|
+
data: _response.body,
|
|
5622
|
+
rawResponse: _response.rawResponse
|
|
5623
|
+
};
|
|
5624
|
+
}
|
|
5625
|
+
if (_response.error.reason === "status-code") {
|
|
5626
|
+
switch (_response.error.statusCode) {
|
|
5627
|
+
case 400:
|
|
5628
|
+
throw new Error2(
|
|
5629
|
+
_response.error.body,
|
|
5630
|
+
_response.rawResponse
|
|
5631
|
+
);
|
|
5632
|
+
case 401:
|
|
5633
|
+
throw new UnauthorizedError(
|
|
5634
|
+
_response.error.body,
|
|
5635
|
+
_response.rawResponse
|
|
5636
|
+
);
|
|
5637
|
+
case 403:
|
|
5638
|
+
throw new AccessDeniedError(
|
|
5639
|
+
_response.error.body,
|
|
5640
|
+
_response.rawResponse
|
|
5641
|
+
);
|
|
5642
|
+
case 405:
|
|
5643
|
+
throw new MethodNotAllowedError(
|
|
5644
|
+
_response.error.body,
|
|
5645
|
+
_response.rawResponse
|
|
5646
|
+
);
|
|
5647
|
+
case 404:
|
|
5648
|
+
throw new NotFoundError(
|
|
5649
|
+
_response.error.body,
|
|
5650
|
+
_response.rawResponse
|
|
5651
|
+
);
|
|
5652
|
+
default:
|
|
5653
|
+
throw new LangfuseAPIError({
|
|
5654
|
+
statusCode: _response.error.statusCode,
|
|
5655
|
+
body: _response.error.body,
|
|
5656
|
+
rawResponse: _response.rawResponse
|
|
5657
|
+
});
|
|
5658
|
+
}
|
|
5659
|
+
}
|
|
5660
|
+
switch (_response.error.reason) {
|
|
5661
|
+
case "non-json":
|
|
5662
|
+
throw new LangfuseAPIError({
|
|
5663
|
+
statusCode: _response.error.statusCode,
|
|
5664
|
+
body: _response.error.rawBody,
|
|
5665
|
+
rawResponse: _response.rawResponse
|
|
5666
|
+
});
|
|
5667
|
+
case "timeout":
|
|
5668
|
+
throw new LangfuseAPITimeoutError(
|
|
5669
|
+
"Timeout exceeded when calling GET /api/public/datasets/{datasetName}/runs."
|
|
5670
|
+
);
|
|
5671
|
+
case "unknown":
|
|
5672
|
+
throw new LangfuseAPIError({
|
|
5673
|
+
message: _response.error.errorMessage,
|
|
5674
|
+
rawResponse: _response.rawResponse
|
|
5675
|
+
});
|
|
5676
|
+
}
|
|
5677
|
+
}
|
|
5678
|
+
async _getAuthorizationHeader() {
|
|
5679
|
+
const username = await Supplier.get(this._options.username);
|
|
5680
|
+
const password = await Supplier.get(this._options.password);
|
|
5681
|
+
if (username != null && password != null) {
|
|
5682
|
+
return BasicAuth.toAuthorizationHeader({
|
|
5683
|
+
username,
|
|
5684
|
+
password
|
|
5685
|
+
});
|
|
5686
|
+
}
|
|
5687
|
+
return void 0;
|
|
5688
|
+
}
|
|
5689
|
+
};
|
|
5690
|
+
|
|
5691
|
+
// src/api/api/resources/evaluationRules/client/Client.ts
|
|
5692
|
+
var EvaluationRules = class {
|
|
5693
|
+
constructor(_options) {
|
|
5694
|
+
this._options = _options;
|
|
5695
|
+
}
|
|
5696
|
+
/**
|
|
5697
|
+
* Create an evaluation rule using stable evaluator identifiers.
|
|
5698
|
+
*
|
|
5699
|
+
* An evaluation rule defines **which** incoming observations should be evaluated and how prompt variables should be populated.
|
|
5700
|
+
*
|
|
5701
|
+
* Key behavior:
|
|
5702
|
+
* - rule names are not identifiers and do not need to be unique
|
|
5703
|
+
* - rules always use the latest version of each associated evaluator
|
|
5704
|
+
* - an enabled rule requires at least one evaluator assignment
|
|
5705
|
+
* - omit `sampling` to evaluate every matching observation
|
|
5706
|
+
* - omit `filter` to match every incoming observation
|
|
5707
|
+
* - `datasetId` is the public filter name for selecting experiment datasets
|
|
5708
|
+
*
|
|
5709
|
+
* @param {LangfuseAPI.CreateEvaluationRuleRequest} request
|
|
5710
|
+
* @param {EvaluationRules.RequestOptions} requestOptions - Request-specific configuration.
|
|
5711
|
+
*
|
|
5712
|
+
* @throws {@link LangfuseAPI.BadRequestError}
|
|
5713
|
+
* @throws {@link LangfuseAPI.EvaluationUnauthorizedError}
|
|
5714
|
+
* @throws {@link LangfuseAPI.EvaluationAccessDeniedError}
|
|
5715
|
+
* @throws {@link LangfuseAPI.EvaluationNotFoundError}
|
|
5716
|
+
* @throws {@link LangfuseAPI.EvaluationMethodNotAllowedError}
|
|
5717
|
+
* @throws {@link LangfuseAPI.ConflictError}
|
|
5718
|
+
* @throws {@link LangfuseAPI.TooManyRequestsError}
|
|
5719
|
+
* @throws {@link LangfuseAPI.InternalServerError}
|
|
5720
|
+
* @throws {@link LangfuseAPI.Error}
|
|
5721
|
+
* @throws {@link LangfuseAPI.UnauthorizedError}
|
|
5722
|
+
* @throws {@link LangfuseAPI.AccessDeniedError}
|
|
5723
|
+
* @throws {@link LangfuseAPI.MethodNotAllowedError}
|
|
5724
|
+
* @throws {@link LangfuseAPI.NotFoundError}
|
|
5725
|
+
*
|
|
5726
|
+
* @example
|
|
5727
|
+
* await client.evaluationRules.create({
|
|
5728
|
+
* name: "name",
|
|
5729
|
+
* enabled: true,
|
|
5730
|
+
* sampling: undefined,
|
|
5731
|
+
* filter: undefined,
|
|
5732
|
+
* evaluatorAssignments: [{
|
|
5733
|
+
* evaluatorId: "evaluatorId",
|
|
5734
|
+
* variableMapping: undefined
|
|
5735
|
+
* }, {
|
|
5736
|
+
* evaluatorId: "evaluatorId",
|
|
5737
|
+
* variableMapping: undefined
|
|
5738
|
+
* }]
|
|
5739
|
+
* })
|
|
5740
|
+
*/
|
|
5741
|
+
create(request, requestOptions) {
|
|
5742
|
+
return HttpResponsePromise.fromPromise(
|
|
5743
|
+
this.__create(request, requestOptions)
|
|
5744
|
+
);
|
|
5745
|
+
}
|
|
5746
|
+
async __create(request, requestOptions) {
|
|
5747
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
5748
|
+
let _headers = mergeHeaders(
|
|
5749
|
+
(_a2 = this._options) == null ? void 0 : _a2.headers,
|
|
5750
|
+
mergeOnlyDefinedHeaders({
|
|
5751
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
5752
|
+
"X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
|
|
5753
|
+
"X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
|
|
5754
|
+
"X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
|
|
5755
|
+
}),
|
|
5756
|
+
requestOptions == null ? void 0 : requestOptions.headers
|
|
5757
|
+
);
|
|
5758
|
+
const _response = await fetcher({
|
|
5759
|
+
url: url_exports.join(
|
|
5760
|
+
(_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
|
|
5761
|
+
"/api/public/v2/evaluation-rules"
|
|
5762
|
+
),
|
|
5763
|
+
method: "POST",
|
|
5764
|
+
headers: _headers,
|
|
5765
|
+
contentType: "application/json",
|
|
5766
|
+
queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
|
|
5767
|
+
requestType: "json",
|
|
5768
|
+
body: request,
|
|
5769
|
+
timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
5770
|
+
maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
|
|
5771
|
+
abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
|
|
5772
|
+
});
|
|
5773
|
+
if (_response.ok) {
|
|
5774
|
+
return {
|
|
5775
|
+
data: _response.body,
|
|
5776
|
+
rawResponse: _response.rawResponse
|
|
5777
|
+
};
|
|
5778
|
+
}
|
|
5779
|
+
if (_response.error.reason === "status-code") {
|
|
5780
|
+
switch (_response.error.statusCode) {
|
|
5781
|
+
case 400:
|
|
5782
|
+
throw new BadRequestError(
|
|
5783
|
+
_response.error.body,
|
|
5784
|
+
_response.rawResponse
|
|
5785
|
+
);
|
|
5786
|
+
case 401:
|
|
5787
|
+
throw new EvaluationUnauthorizedError(
|
|
5788
|
+
_response.error.body,
|
|
5789
|
+
_response.rawResponse
|
|
5790
|
+
);
|
|
5791
|
+
case 403:
|
|
5792
|
+
throw new EvaluationAccessDeniedError(
|
|
5793
|
+
_response.error.body,
|
|
5794
|
+
_response.rawResponse
|
|
5795
|
+
);
|
|
5796
|
+
case 404:
|
|
5797
|
+
throw new EvaluationNotFoundError(
|
|
5798
|
+
_response.error.body,
|
|
5799
|
+
_response.rawResponse
|
|
5800
|
+
);
|
|
5801
|
+
case 405:
|
|
5802
|
+
throw new EvaluationMethodNotAllowedError(
|
|
5803
|
+
_response.error.body,
|
|
5804
|
+
_response.rawResponse
|
|
5805
|
+
);
|
|
5806
|
+
case 409:
|
|
5807
|
+
throw new ConflictError(
|
|
5808
|
+
_response.error.body,
|
|
5809
|
+
_response.rawResponse
|
|
5810
|
+
);
|
|
5811
|
+
case 429:
|
|
5812
|
+
throw new TooManyRequestsError(
|
|
5813
|
+
_response.error.body,
|
|
5814
|
+
_response.rawResponse
|
|
5815
|
+
);
|
|
5816
|
+
case 500:
|
|
5817
|
+
throw new InternalServerError(
|
|
5818
|
+
_response.error.body,
|
|
5819
|
+
_response.rawResponse
|
|
5820
|
+
);
|
|
5821
|
+
case 400:
|
|
5822
|
+
throw new Error2(
|
|
5823
|
+
_response.error.body,
|
|
5824
|
+
_response.rawResponse
|
|
5825
|
+
);
|
|
5826
|
+
case 401:
|
|
5827
|
+
throw new UnauthorizedError(
|
|
5828
|
+
_response.error.body,
|
|
5829
|
+
_response.rawResponse
|
|
5830
|
+
);
|
|
5831
|
+
case 403:
|
|
5832
|
+
throw new AccessDeniedError(
|
|
5833
|
+
_response.error.body,
|
|
5834
|
+
_response.rawResponse
|
|
5835
|
+
);
|
|
5836
|
+
case 405:
|
|
5837
|
+
throw new MethodNotAllowedError(
|
|
5838
|
+
_response.error.body,
|
|
5839
|
+
_response.rawResponse
|
|
5840
|
+
);
|
|
5841
|
+
case 404:
|
|
5842
|
+
throw new NotFoundError(
|
|
5843
|
+
_response.error.body,
|
|
5844
|
+
_response.rawResponse
|
|
5845
|
+
);
|
|
5846
|
+
default:
|
|
5847
|
+
throw new LangfuseAPIError({
|
|
5848
|
+
statusCode: _response.error.statusCode,
|
|
5849
|
+
body: _response.error.body,
|
|
5850
|
+
rawResponse: _response.rawResponse
|
|
5851
|
+
});
|
|
5852
|
+
}
|
|
5853
|
+
}
|
|
5854
|
+
switch (_response.error.reason) {
|
|
5855
|
+
case "non-json":
|
|
5856
|
+
throw new LangfuseAPIError({
|
|
5857
|
+
statusCode: _response.error.statusCode,
|
|
5858
|
+
body: _response.error.rawBody,
|
|
5859
|
+
rawResponse: _response.rawResponse
|
|
5860
|
+
});
|
|
5861
|
+
case "timeout":
|
|
5862
|
+
throw new LangfuseAPITimeoutError(
|
|
5863
|
+
"Timeout exceeded when calling POST /api/public/v2/evaluation-rules."
|
|
5864
|
+
);
|
|
5865
|
+
case "unknown":
|
|
5866
|
+
throw new LangfuseAPIError({
|
|
5867
|
+
message: _response.error.errorMessage,
|
|
5868
|
+
rawResponse: _response.rawResponse
|
|
5869
|
+
});
|
|
5870
|
+
}
|
|
5871
|
+
}
|
|
5872
|
+
/**
|
|
5873
|
+
* List evaluation rules in newest-first creation order.
|
|
5874
|
+
*
|
|
5875
|
+
* This includes legacy trace and dataset rules so they can be inspected and migrated. Treat the cursor as opaque and return it unchanged.
|
|
5876
|
+
*
|
|
5877
|
+
* @param {LangfuseAPI.ListEvaluationRulesRequest} request
|
|
5878
|
+
* @param {EvaluationRules.RequestOptions} requestOptions - Request-specific configuration.
|
|
5879
|
+
*
|
|
5880
|
+
* @throws {@link LangfuseAPI.BadRequestError}
|
|
5881
|
+
* @throws {@link LangfuseAPI.EvaluationUnauthorizedError}
|
|
5882
|
+
* @throws {@link LangfuseAPI.EvaluationAccessDeniedError}
|
|
5883
|
+
* @throws {@link LangfuseAPI.EvaluationMethodNotAllowedError}
|
|
5884
|
+
* @throws {@link LangfuseAPI.TooManyRequestsError}
|
|
5885
|
+
* @throws {@link LangfuseAPI.InternalServerError}
|
|
5886
|
+
* @throws {@link LangfuseAPI.Error}
|
|
5887
|
+
* @throws {@link LangfuseAPI.UnauthorizedError}
|
|
5888
|
+
* @throws {@link LangfuseAPI.AccessDeniedError}
|
|
5889
|
+
* @throws {@link LangfuseAPI.MethodNotAllowedError}
|
|
5890
|
+
* @throws {@link LangfuseAPI.NotFoundError}
|
|
5891
|
+
*
|
|
5892
|
+
* @example
|
|
5893
|
+
* await client.evaluationRules.list()
|
|
5894
|
+
*/
|
|
5895
|
+
list(request = {}, requestOptions) {
|
|
5896
|
+
return HttpResponsePromise.fromPromise(
|
|
5897
|
+
this.__list(request, requestOptions)
|
|
5898
|
+
);
|
|
5899
|
+
}
|
|
5900
|
+
async __list(request = {}, requestOptions) {
|
|
5901
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
5902
|
+
const { limit, cursor } = request;
|
|
5903
|
+
const _queryParams = {};
|
|
5904
|
+
if (limit != null) {
|
|
5905
|
+
_queryParams["limit"] = limit.toString();
|
|
5906
|
+
}
|
|
5907
|
+
if (cursor != null) {
|
|
5908
|
+
_queryParams["cursor"] = cursor;
|
|
5909
|
+
}
|
|
5910
|
+
let _headers = mergeHeaders(
|
|
5911
|
+
(_a2 = this._options) == null ? void 0 : _a2.headers,
|
|
5912
|
+
mergeOnlyDefinedHeaders({
|
|
5913
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
5914
|
+
"X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
|
|
5915
|
+
"X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
|
|
5916
|
+
"X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
|
|
5917
|
+
}),
|
|
5918
|
+
requestOptions == null ? void 0 : requestOptions.headers
|
|
5919
|
+
);
|
|
5920
|
+
const _response = await fetcher({
|
|
5921
|
+
url: url_exports.join(
|
|
5922
|
+
(_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
|
|
5923
|
+
"/api/public/v2/evaluation-rules"
|
|
5924
|
+
),
|
|
5925
|
+
method: "GET",
|
|
5926
|
+
headers: _headers,
|
|
5927
|
+
queryParameters: { ..._queryParams, ...requestOptions == null ? void 0 : requestOptions.queryParams },
|
|
5928
|
+
timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
5929
|
+
maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
|
|
5930
|
+
abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
|
|
5931
|
+
});
|
|
5932
|
+
if (_response.ok) {
|
|
5933
|
+
return {
|
|
5934
|
+
data: _response.body,
|
|
5935
|
+
rawResponse: _response.rawResponse
|
|
5936
|
+
};
|
|
5937
|
+
}
|
|
5938
|
+
if (_response.error.reason === "status-code") {
|
|
5939
|
+
switch (_response.error.statusCode) {
|
|
5940
|
+
case 400:
|
|
5941
|
+
throw new BadRequestError(
|
|
5942
|
+
_response.error.body,
|
|
5943
|
+
_response.rawResponse
|
|
5944
|
+
);
|
|
5945
|
+
case 401:
|
|
5946
|
+
throw new EvaluationUnauthorizedError(
|
|
5947
|
+
_response.error.body,
|
|
5948
|
+
_response.rawResponse
|
|
5949
|
+
);
|
|
5950
|
+
case 403:
|
|
5951
|
+
throw new EvaluationAccessDeniedError(
|
|
5952
|
+
_response.error.body,
|
|
5953
|
+
_response.rawResponse
|
|
5954
|
+
);
|
|
5955
|
+
case 405:
|
|
5956
|
+
throw new EvaluationMethodNotAllowedError(
|
|
5957
|
+
_response.error.body,
|
|
5958
|
+
_response.rawResponse
|
|
5959
|
+
);
|
|
5960
|
+
case 429:
|
|
5961
|
+
throw new TooManyRequestsError(
|
|
5962
|
+
_response.error.body,
|
|
5963
|
+
_response.rawResponse
|
|
5964
|
+
);
|
|
5965
|
+
case 500:
|
|
5966
|
+
throw new InternalServerError(
|
|
5967
|
+
_response.error.body,
|
|
5968
|
+
_response.rawResponse
|
|
5969
|
+
);
|
|
5970
|
+
case 400:
|
|
5971
|
+
throw new Error2(
|
|
5972
|
+
_response.error.body,
|
|
5973
|
+
_response.rawResponse
|
|
5974
|
+
);
|
|
5975
|
+
case 401:
|
|
5976
|
+
throw new UnauthorizedError(
|
|
5977
|
+
_response.error.body,
|
|
5978
|
+
_response.rawResponse
|
|
5979
|
+
);
|
|
5980
|
+
case 403:
|
|
5981
|
+
throw new AccessDeniedError(
|
|
5982
|
+
_response.error.body,
|
|
5983
|
+
_response.rawResponse
|
|
5984
|
+
);
|
|
5985
|
+
case 405:
|
|
5986
|
+
throw new MethodNotAllowedError(
|
|
5987
|
+
_response.error.body,
|
|
5988
|
+
_response.rawResponse
|
|
5989
|
+
);
|
|
5990
|
+
case 404:
|
|
5991
|
+
throw new NotFoundError(
|
|
5992
|
+
_response.error.body,
|
|
5993
|
+
_response.rawResponse
|
|
5994
|
+
);
|
|
5995
|
+
default:
|
|
5996
|
+
throw new LangfuseAPIError({
|
|
5997
|
+
statusCode: _response.error.statusCode,
|
|
5998
|
+
body: _response.error.body,
|
|
5999
|
+
rawResponse: _response.rawResponse
|
|
6000
|
+
});
|
|
6001
|
+
}
|
|
6002
|
+
}
|
|
6003
|
+
switch (_response.error.reason) {
|
|
6004
|
+
case "non-json":
|
|
6005
|
+
throw new LangfuseAPIError({
|
|
6006
|
+
statusCode: _response.error.statusCode,
|
|
6007
|
+
body: _response.error.rawBody,
|
|
6008
|
+
rawResponse: _response.rawResponse
|
|
6009
|
+
});
|
|
6010
|
+
case "timeout":
|
|
6011
|
+
throw new LangfuseAPITimeoutError(
|
|
6012
|
+
"Timeout exceeded when calling GET /api/public/v2/evaluation-rules."
|
|
6013
|
+
);
|
|
6014
|
+
case "unknown":
|
|
6015
|
+
throw new LangfuseAPIError({
|
|
6016
|
+
message: _response.error.errorMessage,
|
|
6017
|
+
rawResponse: _response.rawResponse
|
|
6018
|
+
});
|
|
6019
|
+
}
|
|
6020
|
+
}
|
|
6021
|
+
/**
|
|
6022
|
+
* Get one evaluation rule, including a legacy trace or dataset rule, by its stable identifier.
|
|
6023
|
+
*
|
|
6024
|
+
* @param {string} evaluationRuleId - Stable evaluation-rule identifier returned by the evaluation-rule endpoints.
|
|
6025
|
+
* @param {EvaluationRules.RequestOptions} requestOptions - Request-specific configuration.
|
|
6026
|
+
*
|
|
6027
|
+
* @throws {@link LangfuseAPI.EvaluationUnauthorizedError}
|
|
6028
|
+
* @throws {@link LangfuseAPI.EvaluationAccessDeniedError}
|
|
6029
|
+
* @throws {@link LangfuseAPI.EvaluationNotFoundError}
|
|
6030
|
+
* @throws {@link LangfuseAPI.EvaluationMethodNotAllowedError}
|
|
6031
|
+
* @throws {@link LangfuseAPI.TooManyRequestsError}
|
|
6032
|
+
* @throws {@link LangfuseAPI.InternalServerError}
|
|
6033
|
+
* @throws {@link LangfuseAPI.Error}
|
|
6034
|
+
* @throws {@link LangfuseAPI.UnauthorizedError}
|
|
6035
|
+
* @throws {@link LangfuseAPI.AccessDeniedError}
|
|
6036
|
+
* @throws {@link LangfuseAPI.MethodNotAllowedError}
|
|
6037
|
+
* @throws {@link LangfuseAPI.NotFoundError}
|
|
6038
|
+
*
|
|
6039
|
+
* @example
|
|
6040
|
+
* await client.evaluationRules.get("evaluationRuleId")
|
|
6041
|
+
*/
|
|
6042
|
+
get(evaluationRuleId, requestOptions) {
|
|
6043
|
+
return HttpResponsePromise.fromPromise(
|
|
6044
|
+
this.__get(evaluationRuleId, requestOptions)
|
|
6045
|
+
);
|
|
6046
|
+
}
|
|
6047
|
+
async __get(evaluationRuleId, requestOptions) {
|
|
6048
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
6049
|
+
let _headers = mergeHeaders(
|
|
6050
|
+
(_a2 = this._options) == null ? void 0 : _a2.headers,
|
|
6051
|
+
mergeOnlyDefinedHeaders({
|
|
6052
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
6053
|
+
"X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
|
|
6054
|
+
"X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
|
|
6055
|
+
"X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
|
|
6056
|
+
}),
|
|
6057
|
+
requestOptions == null ? void 0 : requestOptions.headers
|
|
6058
|
+
);
|
|
6059
|
+
const _response = await fetcher({
|
|
6060
|
+
url: url_exports.join(
|
|
6061
|
+
(_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
|
|
6062
|
+
`/api/public/v2/evaluation-rules/${encodeURIComponent(evaluationRuleId)}`
|
|
6063
|
+
),
|
|
6064
|
+
method: "GET",
|
|
6065
|
+
headers: _headers,
|
|
6066
|
+
queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
|
|
6067
|
+
timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
6068
|
+
maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
|
|
6069
|
+
abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
|
|
6070
|
+
});
|
|
6071
|
+
if (_response.ok) {
|
|
6072
|
+
return {
|
|
6073
|
+
data: _response.body,
|
|
6074
|
+
rawResponse: _response.rawResponse
|
|
6075
|
+
};
|
|
6076
|
+
}
|
|
6077
|
+
if (_response.error.reason === "status-code") {
|
|
6078
|
+
switch (_response.error.statusCode) {
|
|
6079
|
+
case 401:
|
|
6080
|
+
throw new EvaluationUnauthorizedError(
|
|
6081
|
+
_response.error.body,
|
|
6082
|
+
_response.rawResponse
|
|
6083
|
+
);
|
|
6084
|
+
case 403:
|
|
6085
|
+
throw new EvaluationAccessDeniedError(
|
|
6086
|
+
_response.error.body,
|
|
6087
|
+
_response.rawResponse
|
|
6088
|
+
);
|
|
6089
|
+
case 404:
|
|
6090
|
+
throw new EvaluationNotFoundError(
|
|
6091
|
+
_response.error.body,
|
|
6092
|
+
_response.rawResponse
|
|
6093
|
+
);
|
|
6094
|
+
case 405:
|
|
6095
|
+
throw new EvaluationMethodNotAllowedError(
|
|
6096
|
+
_response.error.body,
|
|
6097
|
+
_response.rawResponse
|
|
6098
|
+
);
|
|
6099
|
+
case 429:
|
|
6100
|
+
throw new TooManyRequestsError(
|
|
6101
|
+
_response.error.body,
|
|
6102
|
+
_response.rawResponse
|
|
6103
|
+
);
|
|
6104
|
+
case 500:
|
|
6105
|
+
throw new InternalServerError(
|
|
6106
|
+
_response.error.body,
|
|
6107
|
+
_response.rawResponse
|
|
6108
|
+
);
|
|
6109
|
+
case 400:
|
|
6110
|
+
throw new Error2(
|
|
6111
|
+
_response.error.body,
|
|
6112
|
+
_response.rawResponse
|
|
6113
|
+
);
|
|
6114
|
+
case 401:
|
|
6115
|
+
throw new UnauthorizedError(
|
|
6116
|
+
_response.error.body,
|
|
6117
|
+
_response.rawResponse
|
|
6118
|
+
);
|
|
6119
|
+
case 403:
|
|
6120
|
+
throw new AccessDeniedError(
|
|
6121
|
+
_response.error.body,
|
|
6122
|
+
_response.rawResponse
|
|
6123
|
+
);
|
|
6124
|
+
case 405:
|
|
6125
|
+
throw new MethodNotAllowedError(
|
|
6126
|
+
_response.error.body,
|
|
6127
|
+
_response.rawResponse
|
|
6128
|
+
);
|
|
6129
|
+
case 404:
|
|
6130
|
+
throw new NotFoundError(
|
|
6131
|
+
_response.error.body,
|
|
6132
|
+
_response.rawResponse
|
|
6133
|
+
);
|
|
6134
|
+
default:
|
|
6135
|
+
throw new LangfuseAPIError({
|
|
6136
|
+
statusCode: _response.error.statusCode,
|
|
6137
|
+
body: _response.error.body,
|
|
6138
|
+
rawResponse: _response.rawResponse
|
|
6139
|
+
});
|
|
6140
|
+
}
|
|
6141
|
+
}
|
|
6142
|
+
switch (_response.error.reason) {
|
|
6143
|
+
case "non-json":
|
|
6144
|
+
throw new LangfuseAPIError({
|
|
6145
|
+
statusCode: _response.error.statusCode,
|
|
6146
|
+
body: _response.error.rawBody,
|
|
6147
|
+
rawResponse: _response.rawResponse
|
|
6148
|
+
});
|
|
6149
|
+
case "timeout":
|
|
6150
|
+
throw new LangfuseAPITimeoutError(
|
|
6151
|
+
"Timeout exceeded when calling GET /api/public/v2/evaluation-rules/{evaluationRuleId}."
|
|
6152
|
+
);
|
|
6153
|
+
case "unknown":
|
|
6154
|
+
throw new LangfuseAPIError({
|
|
6155
|
+
message: _response.error.errorMessage,
|
|
6156
|
+
rawResponse: _response.rawResponse
|
|
6157
|
+
});
|
|
6158
|
+
}
|
|
6159
|
+
}
|
|
6160
|
+
/**
|
|
6161
|
+
* Update an evaluation rule by its stable identifier.
|
|
6162
|
+
*
|
|
6163
|
+
* 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.
|
|
6164
|
+
*
|
|
6165
|
+
* 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.
|
|
6166
|
+
*
|
|
6167
|
+
* @param {string} evaluationRuleId - Stable evaluation-rule identifier returned by the evaluation-rule endpoints.
|
|
6168
|
+
* @param {LangfuseAPI.UpdateEvaluationRuleRequest} request
|
|
6169
|
+
* @param {EvaluationRules.RequestOptions} requestOptions - Request-specific configuration.
|
|
6170
|
+
*
|
|
6171
|
+
* @throws {@link LangfuseAPI.BadRequestError}
|
|
6172
|
+
* @throws {@link LangfuseAPI.EvaluationUnauthorizedError}
|
|
6173
|
+
* @throws {@link LangfuseAPI.EvaluationAccessDeniedError}
|
|
6174
|
+
* @throws {@link LangfuseAPI.EvaluationNotFoundError}
|
|
6175
|
+
* @throws {@link LangfuseAPI.EvaluationMethodNotAllowedError}
|
|
6176
|
+
* @throws {@link LangfuseAPI.ConflictError}
|
|
6177
|
+
* @throws {@link LangfuseAPI.TooManyRequestsError}
|
|
6178
|
+
* @throws {@link LangfuseAPI.InternalServerError}
|
|
6179
|
+
* @throws {@link LangfuseAPI.Error}
|
|
6180
|
+
* @throws {@link LangfuseAPI.UnauthorizedError}
|
|
6181
|
+
* @throws {@link LangfuseAPI.AccessDeniedError}
|
|
6182
|
+
* @throws {@link LangfuseAPI.MethodNotAllowedError}
|
|
6183
|
+
* @throws {@link LangfuseAPI.NotFoundError}
|
|
6184
|
+
*
|
|
6185
|
+
* @example
|
|
6186
|
+
* await client.evaluationRules.update("evaluationRuleId", {
|
|
6187
|
+
* name: undefined,
|
|
6188
|
+
* enabled: undefined,
|
|
6189
|
+
* sampling: undefined,
|
|
6190
|
+
* filter: undefined,
|
|
6191
|
+
* evaluatorAssignments: undefined
|
|
6192
|
+
* })
|
|
6193
|
+
*/
|
|
6194
|
+
update(evaluationRuleId, request, requestOptions) {
|
|
6195
|
+
return HttpResponsePromise.fromPromise(
|
|
6196
|
+
this.__update(evaluationRuleId, request, requestOptions)
|
|
6197
|
+
);
|
|
6198
|
+
}
|
|
6199
|
+
async __update(evaluationRuleId, request, requestOptions) {
|
|
6200
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
6201
|
+
let _headers = mergeHeaders(
|
|
6202
|
+
(_a2 = this._options) == null ? void 0 : _a2.headers,
|
|
6203
|
+
mergeOnlyDefinedHeaders({
|
|
6204
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
6205
|
+
"X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
|
|
6206
|
+
"X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
|
|
6207
|
+
"X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
|
|
6208
|
+
}),
|
|
6209
|
+
requestOptions == null ? void 0 : requestOptions.headers
|
|
6210
|
+
);
|
|
6211
|
+
const _response = await fetcher({
|
|
6212
|
+
url: url_exports.join(
|
|
6213
|
+
(_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
|
|
6214
|
+
`/api/public/v2/evaluation-rules/${encodeURIComponent(evaluationRuleId)}`
|
|
6215
|
+
),
|
|
6216
|
+
method: "PATCH",
|
|
6217
|
+
headers: _headers,
|
|
6218
|
+
contentType: "application/json",
|
|
6219
|
+
queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
|
|
6220
|
+
requestType: "json",
|
|
6221
|
+
body: request,
|
|
6222
|
+
timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
6223
|
+
maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
|
|
6224
|
+
abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
|
|
6225
|
+
});
|
|
6226
|
+
if (_response.ok) {
|
|
6227
|
+
return {
|
|
6228
|
+
data: _response.body,
|
|
6229
|
+
rawResponse: _response.rawResponse
|
|
6230
|
+
};
|
|
6231
|
+
}
|
|
6232
|
+
if (_response.error.reason === "status-code") {
|
|
6233
|
+
switch (_response.error.statusCode) {
|
|
6234
|
+
case 400:
|
|
6235
|
+
throw new BadRequestError(
|
|
6236
|
+
_response.error.body,
|
|
6237
|
+
_response.rawResponse
|
|
6238
|
+
);
|
|
6239
|
+
case 401:
|
|
6240
|
+
throw new EvaluationUnauthorizedError(
|
|
6241
|
+
_response.error.body,
|
|
6242
|
+
_response.rawResponse
|
|
6243
|
+
);
|
|
6244
|
+
case 403:
|
|
6245
|
+
throw new EvaluationAccessDeniedError(
|
|
6246
|
+
_response.error.body,
|
|
6247
|
+
_response.rawResponse
|
|
6248
|
+
);
|
|
6249
|
+
case 404:
|
|
6250
|
+
throw new EvaluationNotFoundError(
|
|
6251
|
+
_response.error.body,
|
|
6252
|
+
_response.rawResponse
|
|
6253
|
+
);
|
|
6254
|
+
case 405:
|
|
6255
|
+
throw new EvaluationMethodNotAllowedError(
|
|
6256
|
+
_response.error.body,
|
|
6257
|
+
_response.rawResponse
|
|
6258
|
+
);
|
|
6259
|
+
case 409:
|
|
6260
|
+
throw new ConflictError(
|
|
6261
|
+
_response.error.body,
|
|
6262
|
+
_response.rawResponse
|
|
6263
|
+
);
|
|
6264
|
+
case 429:
|
|
6265
|
+
throw new TooManyRequestsError(
|
|
6266
|
+
_response.error.body,
|
|
6267
|
+
_response.rawResponse
|
|
6268
|
+
);
|
|
6269
|
+
case 500:
|
|
6270
|
+
throw new InternalServerError(
|
|
6271
|
+
_response.error.body,
|
|
6272
|
+
_response.rawResponse
|
|
6273
|
+
);
|
|
6274
|
+
case 400:
|
|
6275
|
+
throw new Error2(
|
|
6276
|
+
_response.error.body,
|
|
6277
|
+
_response.rawResponse
|
|
6278
|
+
);
|
|
6279
|
+
case 401:
|
|
6280
|
+
throw new UnauthorizedError(
|
|
6281
|
+
_response.error.body,
|
|
6282
|
+
_response.rawResponse
|
|
6283
|
+
);
|
|
6284
|
+
case 403:
|
|
6285
|
+
throw new AccessDeniedError(
|
|
6286
|
+
_response.error.body,
|
|
6287
|
+
_response.rawResponse
|
|
6288
|
+
);
|
|
6289
|
+
case 405:
|
|
6290
|
+
throw new MethodNotAllowedError(
|
|
6291
|
+
_response.error.body,
|
|
6292
|
+
_response.rawResponse
|
|
6293
|
+
);
|
|
6294
|
+
case 404:
|
|
6295
|
+
throw new NotFoundError(
|
|
6296
|
+
_response.error.body,
|
|
6297
|
+
_response.rawResponse
|
|
6298
|
+
);
|
|
6299
|
+
default:
|
|
6300
|
+
throw new LangfuseAPIError({
|
|
6301
|
+
statusCode: _response.error.statusCode,
|
|
6302
|
+
body: _response.error.body,
|
|
6303
|
+
rawResponse: _response.rawResponse
|
|
6304
|
+
});
|
|
6305
|
+
}
|
|
6306
|
+
}
|
|
6307
|
+
switch (_response.error.reason) {
|
|
6308
|
+
case "non-json":
|
|
6309
|
+
throw new LangfuseAPIError({
|
|
6310
|
+
statusCode: _response.error.statusCode,
|
|
6311
|
+
body: _response.error.rawBody,
|
|
6312
|
+
rawResponse: _response.rawResponse
|
|
6313
|
+
});
|
|
6314
|
+
case "timeout":
|
|
6315
|
+
throw new LangfuseAPITimeoutError(
|
|
6316
|
+
"Timeout exceeded when calling PATCH /api/public/v2/evaluation-rules/{evaluationRuleId}."
|
|
6317
|
+
);
|
|
6318
|
+
case "unknown":
|
|
6319
|
+
throw new LangfuseAPIError({
|
|
6320
|
+
message: _response.error.errorMessage,
|
|
6321
|
+
rawResponse: _response.rawResponse
|
|
6322
|
+
});
|
|
6323
|
+
}
|
|
6324
|
+
}
|
|
6325
|
+
/**
|
|
6326
|
+
* Delete an evaluation rule.
|
|
6327
|
+
*
|
|
6328
|
+
* This removes the live-ingestion rule only. It does not delete associated evaluators or scores already produced by them.
|
|
6329
|
+
*
|
|
6330
|
+
* Legacy trace and dataset rules can also be deleted. Their evaluators and previously produced scores are preserved.
|
|
6331
|
+
*
|
|
6332
|
+
* @param {string} evaluationRuleId - Stable evaluation-rule identifier returned by the evaluation-rule endpoints.
|
|
6333
|
+
* @param {EvaluationRules.RequestOptions} requestOptions - Request-specific configuration.
|
|
6334
|
+
*
|
|
6335
|
+
* @throws {@link LangfuseAPI.EvaluationUnauthorizedError}
|
|
6336
|
+
* @throws {@link LangfuseAPI.EvaluationAccessDeniedError}
|
|
6337
|
+
* @throws {@link LangfuseAPI.EvaluationNotFoundError}
|
|
6338
|
+
* @throws {@link LangfuseAPI.EvaluationMethodNotAllowedError}
|
|
6339
|
+
* @throws {@link LangfuseAPI.TooManyRequestsError}
|
|
6340
|
+
* @throws {@link LangfuseAPI.InternalServerError}
|
|
6341
|
+
* @throws {@link LangfuseAPI.Error}
|
|
6342
|
+
* @throws {@link LangfuseAPI.UnauthorizedError}
|
|
6343
|
+
* @throws {@link LangfuseAPI.AccessDeniedError}
|
|
6344
|
+
* @throws {@link LangfuseAPI.MethodNotAllowedError}
|
|
6345
|
+
* @throws {@link LangfuseAPI.NotFoundError}
|
|
6346
|
+
*
|
|
6347
|
+
* @example
|
|
6348
|
+
* await client.evaluationRules.delete("evaluationRuleId")
|
|
6349
|
+
*/
|
|
6350
|
+
delete(evaluationRuleId, requestOptions) {
|
|
6351
|
+
return HttpResponsePromise.fromPromise(
|
|
6352
|
+
this.__delete(evaluationRuleId, requestOptions)
|
|
6353
|
+
);
|
|
6354
|
+
}
|
|
6355
|
+
async __delete(evaluationRuleId, requestOptions) {
|
|
6356
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
6357
|
+
let _headers = mergeHeaders(
|
|
6358
|
+
(_a2 = this._options) == null ? void 0 : _a2.headers,
|
|
6359
|
+
mergeOnlyDefinedHeaders({
|
|
6360
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
6361
|
+
"X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
|
|
6362
|
+
"X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
|
|
6363
|
+
"X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
|
|
6364
|
+
}),
|
|
6365
|
+
requestOptions == null ? void 0 : requestOptions.headers
|
|
6366
|
+
);
|
|
6367
|
+
const _response = await fetcher({
|
|
6368
|
+
url: url_exports.join(
|
|
6369
|
+
(_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
|
|
6370
|
+
`/api/public/v2/evaluation-rules/${encodeURIComponent(evaluationRuleId)}`
|
|
6371
|
+
),
|
|
6372
|
+
method: "DELETE",
|
|
6373
|
+
headers: _headers,
|
|
6374
|
+
queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
|
|
6375
|
+
timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
6376
|
+
maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
|
|
6377
|
+
abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
|
|
6378
|
+
});
|
|
6379
|
+
if (_response.ok) {
|
|
6380
|
+
return {
|
|
6381
|
+
data: _response.body,
|
|
6382
|
+
rawResponse: _response.rawResponse
|
|
6383
|
+
};
|
|
6384
|
+
}
|
|
6385
|
+
if (_response.error.reason === "status-code") {
|
|
6386
|
+
switch (_response.error.statusCode) {
|
|
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 429:
|
|
6408
|
+
throw new TooManyRequestsError(
|
|
6409
|
+
_response.error.body,
|
|
6410
|
+
_response.rawResponse
|
|
6411
|
+
);
|
|
6412
|
+
case 500:
|
|
6413
|
+
throw new InternalServerError(
|
|
6414
|
+
_response.error.body,
|
|
6415
|
+
_response.rawResponse
|
|
6416
|
+
);
|
|
6417
|
+
case 400:
|
|
6418
|
+
throw new Error2(
|
|
6419
|
+
_response.error.body,
|
|
6420
|
+
_response.rawResponse
|
|
6421
|
+
);
|
|
6422
|
+
case 401:
|
|
6423
|
+
throw new UnauthorizedError(
|
|
6424
|
+
_response.error.body,
|
|
6425
|
+
_response.rawResponse
|
|
6426
|
+
);
|
|
6427
|
+
case 403:
|
|
6428
|
+
throw new AccessDeniedError(
|
|
6429
|
+
_response.error.body,
|
|
6430
|
+
_response.rawResponse
|
|
6431
|
+
);
|
|
6432
|
+
case 405:
|
|
6433
|
+
throw new MethodNotAllowedError(
|
|
6434
|
+
_response.error.body,
|
|
6435
|
+
_response.rawResponse
|
|
6436
|
+
);
|
|
6437
|
+
case 404:
|
|
6438
|
+
throw new NotFoundError(
|
|
6439
|
+
_response.error.body,
|
|
6440
|
+
_response.rawResponse
|
|
6441
|
+
);
|
|
6442
|
+
default:
|
|
6443
|
+
throw new LangfuseAPIError({
|
|
6444
|
+
statusCode: _response.error.statusCode,
|
|
6445
|
+
body: _response.error.body,
|
|
6446
|
+
rawResponse: _response.rawResponse
|
|
6447
|
+
});
|
|
6448
|
+
}
|
|
6449
|
+
}
|
|
6450
|
+
switch (_response.error.reason) {
|
|
6451
|
+
case "non-json":
|
|
6452
|
+
throw new LangfuseAPIError({
|
|
6453
|
+
statusCode: _response.error.statusCode,
|
|
6454
|
+
body: _response.error.rawBody,
|
|
6455
|
+
rawResponse: _response.rawResponse
|
|
6456
|
+
});
|
|
6457
|
+
case "timeout":
|
|
6458
|
+
throw new LangfuseAPITimeoutError(
|
|
6459
|
+
"Timeout exceeded when calling DELETE /api/public/v2/evaluation-rules/{evaluationRuleId}."
|
|
6460
|
+
);
|
|
6461
|
+
case "unknown":
|
|
6462
|
+
throw new LangfuseAPIError({
|
|
6463
|
+
message: _response.error.errorMessage,
|
|
6464
|
+
rawResponse: _response.rawResponse
|
|
6465
|
+
});
|
|
6466
|
+
}
|
|
6467
|
+
}
|
|
6468
|
+
async _getAuthorizationHeader() {
|
|
6469
|
+
const username = await Supplier.get(this._options.username);
|
|
6470
|
+
const password = await Supplier.get(this._options.password);
|
|
6471
|
+
if (username != null && password != null) {
|
|
6472
|
+
return BasicAuth.toAuthorizationHeader({
|
|
6473
|
+
username,
|
|
6474
|
+
password
|
|
6475
|
+
});
|
|
6476
|
+
}
|
|
6477
|
+
return void 0;
|
|
6478
|
+
}
|
|
6479
|
+
};
|
|
6480
|
+
|
|
6481
|
+
// src/api/api/resources/evaluators/client/Client.ts
|
|
6482
|
+
var Evaluators = class {
|
|
6483
|
+
constructor(_options) {
|
|
6484
|
+
this._options = _options;
|
|
6485
|
+
}
|
|
6486
|
+
/**
|
|
6487
|
+
* Create an evaluator in the authenticated project.
|
|
6488
|
+
*
|
|
6489
|
+
* 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.
|
|
6490
|
+
*
|
|
6491
|
+
* This always creates a new evaluator with version `1`. Names are not identifiers and do not need to be unique.
|
|
6492
|
+
*
|
|
6493
|
+
* @param {LangfuseAPI.CreateEvaluatorRequest} request
|
|
6494
|
+
* @param {Evaluators.RequestOptions} requestOptions - Request-specific configuration.
|
|
6495
|
+
*
|
|
6496
|
+
* @throws {@link LangfuseAPI.BadRequestError}
|
|
6497
|
+
* @throws {@link LangfuseAPI.EvaluationUnauthorizedError}
|
|
6498
|
+
* @throws {@link LangfuseAPI.EvaluationAccessDeniedError}
|
|
6499
|
+
* @throws {@link LangfuseAPI.EvaluationMethodNotAllowedError}
|
|
6500
|
+
* @throws {@link LangfuseAPI.PreconditionFailedError}
|
|
6501
|
+
* @throws {@link LangfuseAPI.TooManyRequestsError}
|
|
6502
|
+
* @throws {@link LangfuseAPI.InternalServerError}
|
|
6503
|
+
* @throws {@link LangfuseAPI.Error}
|
|
6504
|
+
* @throws {@link LangfuseAPI.UnauthorizedError}
|
|
6505
|
+
* @throws {@link LangfuseAPI.AccessDeniedError}
|
|
6506
|
+
* @throws {@link LangfuseAPI.MethodNotAllowedError}
|
|
6507
|
+
* @throws {@link LangfuseAPI.NotFoundError}
|
|
6508
|
+
*
|
|
6509
|
+
* @example
|
|
6510
|
+
* await client.evaluators.create({
|
|
6511
|
+
* type: "llm_as_judge",
|
|
6512
|
+
* name: "name",
|
|
6513
|
+
* description: undefined,
|
|
6514
|
+
* type: "llm_as_judge",
|
|
6515
|
+
* prompt: "prompt",
|
|
6516
|
+
* modelConfig: undefined,
|
|
6517
|
+
* variableMapping: undefined,
|
|
6518
|
+
* outputDefinition: {
|
|
6519
|
+
* dataType: "NUMERIC",
|
|
6520
|
+
* dataType: "NUMERIC",
|
|
6521
|
+
* minValue: undefined,
|
|
6522
|
+
* maxValue: undefined,
|
|
6523
|
+
* scoreReasoningInstructions: undefined,
|
|
6524
|
+
* scoreValueInstructions: undefined
|
|
6525
|
+
* }
|
|
6526
|
+
* })
|
|
6527
|
+
*/
|
|
6528
|
+
create(request, requestOptions) {
|
|
6529
|
+
return HttpResponsePromise.fromPromise(
|
|
6530
|
+
this.__create(request, requestOptions)
|
|
6531
|
+
);
|
|
6532
|
+
}
|
|
6533
|
+
async __create(request, requestOptions) {
|
|
6534
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
6535
|
+
let _headers = mergeHeaders(
|
|
6536
|
+
(_a2 = this._options) == null ? void 0 : _a2.headers,
|
|
6537
|
+
mergeOnlyDefinedHeaders({
|
|
6538
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
6539
|
+
"X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
|
|
6540
|
+
"X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
|
|
6541
|
+
"X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
|
|
6542
|
+
}),
|
|
6543
|
+
requestOptions == null ? void 0 : requestOptions.headers
|
|
6544
|
+
);
|
|
6545
|
+
const _response = await fetcher({
|
|
6546
|
+
url: url_exports.join(
|
|
6547
|
+
(_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
|
|
6548
|
+
"/api/public/v2/evaluators"
|
|
6549
|
+
),
|
|
6550
|
+
method: "POST",
|
|
6551
|
+
headers: _headers,
|
|
6552
|
+
contentType: "application/json",
|
|
6553
|
+
queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
|
|
6554
|
+
requestType: "json",
|
|
6555
|
+
body: request,
|
|
6556
|
+
timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
6557
|
+
maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
|
|
6558
|
+
abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
|
|
6559
|
+
});
|
|
6560
|
+
if (_response.ok) {
|
|
6561
|
+
return {
|
|
6562
|
+
data: _response.body,
|
|
6563
|
+
rawResponse: _response.rawResponse
|
|
6564
|
+
};
|
|
6565
|
+
}
|
|
6566
|
+
if (_response.error.reason === "status-code") {
|
|
6567
|
+
switch (_response.error.statusCode) {
|
|
6568
|
+
case 400:
|
|
6569
|
+
throw new BadRequestError(
|
|
6570
|
+
_response.error.body,
|
|
6571
|
+
_response.rawResponse
|
|
6572
|
+
);
|
|
6573
|
+
case 401:
|
|
6574
|
+
throw new EvaluationUnauthorizedError(
|
|
6575
|
+
_response.error.body,
|
|
6576
|
+
_response.rawResponse
|
|
6577
|
+
);
|
|
6578
|
+
case 403:
|
|
6579
|
+
throw new EvaluationAccessDeniedError(
|
|
6580
|
+
_response.error.body,
|
|
6581
|
+
_response.rawResponse
|
|
6582
|
+
);
|
|
6583
|
+
case 405:
|
|
6584
|
+
throw new EvaluationMethodNotAllowedError(
|
|
6585
|
+
_response.error.body,
|
|
6586
|
+
_response.rawResponse
|
|
6587
|
+
);
|
|
6588
|
+
case 412:
|
|
6589
|
+
throw new PreconditionFailedError(
|
|
6590
|
+
_response.error.body,
|
|
6591
|
+
_response.rawResponse
|
|
6592
|
+
);
|
|
6593
|
+
case 429:
|
|
6594
|
+
throw new TooManyRequestsError(
|
|
6595
|
+
_response.error.body,
|
|
6596
|
+
_response.rawResponse
|
|
6597
|
+
);
|
|
6598
|
+
case 500:
|
|
6599
|
+
throw new InternalServerError(
|
|
6600
|
+
_response.error.body,
|
|
6601
|
+
_response.rawResponse
|
|
6602
|
+
);
|
|
6603
|
+
case 400:
|
|
6604
|
+
throw new Error2(
|
|
6605
|
+
_response.error.body,
|
|
6606
|
+
_response.rawResponse
|
|
6607
|
+
);
|
|
6608
|
+
case 401:
|
|
6609
|
+
throw new UnauthorizedError(
|
|
6610
|
+
_response.error.body,
|
|
6611
|
+
_response.rawResponse
|
|
6612
|
+
);
|
|
6613
|
+
case 403:
|
|
6614
|
+
throw new AccessDeniedError(
|
|
6615
|
+
_response.error.body,
|
|
6616
|
+
_response.rawResponse
|
|
6617
|
+
);
|
|
6618
|
+
case 405:
|
|
6619
|
+
throw new MethodNotAllowedError(
|
|
6620
|
+
_response.error.body,
|
|
6621
|
+
_response.rawResponse
|
|
6622
|
+
);
|
|
6623
|
+
case 404:
|
|
6624
|
+
throw new NotFoundError(
|
|
6625
|
+
_response.error.body,
|
|
6626
|
+
_response.rawResponse
|
|
6627
|
+
);
|
|
6628
|
+
default:
|
|
6629
|
+
throw new LangfuseAPIError({
|
|
6630
|
+
statusCode: _response.error.statusCode,
|
|
6631
|
+
body: _response.error.body,
|
|
6632
|
+
rawResponse: _response.rawResponse
|
|
6633
|
+
});
|
|
6634
|
+
}
|
|
6635
|
+
}
|
|
6636
|
+
switch (_response.error.reason) {
|
|
6637
|
+
case "non-json":
|
|
6638
|
+
throw new LangfuseAPIError({
|
|
6639
|
+
statusCode: _response.error.statusCode,
|
|
6640
|
+
body: _response.error.rawBody,
|
|
6641
|
+
rawResponse: _response.rawResponse
|
|
6642
|
+
});
|
|
6643
|
+
case "timeout":
|
|
6644
|
+
throw new LangfuseAPITimeoutError(
|
|
6645
|
+
"Timeout exceeded when calling POST /api/public/v2/evaluators."
|
|
6646
|
+
);
|
|
6647
|
+
case "unknown":
|
|
6648
|
+
throw new LangfuseAPIError({
|
|
6649
|
+
message: _response.error.errorMessage,
|
|
6650
|
+
rawResponse: _response.rawResponse
|
|
6651
|
+
});
|
|
6652
|
+
}
|
|
6653
|
+
}
|
|
6654
|
+
/**
|
|
6655
|
+
* List evaluators in newest-first creation order.
|
|
6656
|
+
*
|
|
6657
|
+
* 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.
|
|
6658
|
+
*
|
|
6659
|
+
* @param {LangfuseAPI.ListEvaluatorsRequest} request
|
|
6660
|
+
* @param {Evaluators.RequestOptions} requestOptions - Request-specific configuration.
|
|
6661
|
+
*
|
|
6662
|
+
* @throws {@link LangfuseAPI.BadRequestError}
|
|
6663
|
+
* @throws {@link LangfuseAPI.EvaluationUnauthorizedError}
|
|
6664
|
+
* @throws {@link LangfuseAPI.EvaluationAccessDeniedError}
|
|
6665
|
+
* @throws {@link LangfuseAPI.EvaluationMethodNotAllowedError}
|
|
6666
|
+
* @throws {@link LangfuseAPI.TooManyRequestsError}
|
|
6667
|
+
* @throws {@link LangfuseAPI.InternalServerError}
|
|
6668
|
+
* @throws {@link LangfuseAPI.Error}
|
|
6669
|
+
* @throws {@link LangfuseAPI.UnauthorizedError}
|
|
6670
|
+
* @throws {@link LangfuseAPI.AccessDeniedError}
|
|
6671
|
+
* @throws {@link LangfuseAPI.MethodNotAllowedError}
|
|
6672
|
+
* @throws {@link LangfuseAPI.NotFoundError}
|
|
6673
|
+
*
|
|
6674
|
+
* @example
|
|
6675
|
+
* await client.evaluators.list()
|
|
6676
|
+
*/
|
|
6677
|
+
list(request = {}, requestOptions) {
|
|
6678
|
+
return HttpResponsePromise.fromPromise(
|
|
6679
|
+
this.__list(request, requestOptions)
|
|
6680
|
+
);
|
|
6681
|
+
}
|
|
6682
|
+
async __list(request = {}, requestOptions) {
|
|
6683
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
6684
|
+
const { limit, cursor } = request;
|
|
6685
|
+
const _queryParams = {};
|
|
6686
|
+
if (limit != null) {
|
|
6687
|
+
_queryParams["limit"] = limit.toString();
|
|
6688
|
+
}
|
|
6689
|
+
if (cursor != null) {
|
|
6690
|
+
_queryParams["cursor"] = cursor;
|
|
6691
|
+
}
|
|
6692
|
+
let _headers = mergeHeaders(
|
|
6693
|
+
(_a2 = this._options) == null ? void 0 : _a2.headers,
|
|
6694
|
+
mergeOnlyDefinedHeaders({
|
|
6695
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
6696
|
+
"X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
|
|
6697
|
+
"X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
|
|
6698
|
+
"X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
|
|
6699
|
+
}),
|
|
6700
|
+
requestOptions == null ? void 0 : requestOptions.headers
|
|
6701
|
+
);
|
|
6702
|
+
const _response = await fetcher({
|
|
6703
|
+
url: url_exports.join(
|
|
6704
|
+
(_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
|
|
6705
|
+
"/api/public/v2/evaluators"
|
|
6706
|
+
),
|
|
6707
|
+
method: "GET",
|
|
6708
|
+
headers: _headers,
|
|
6709
|
+
queryParameters: { ..._queryParams, ...requestOptions == null ? void 0 : requestOptions.queryParams },
|
|
6710
|
+
timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
6711
|
+
maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
|
|
6712
|
+
abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
|
|
6713
|
+
});
|
|
6714
|
+
if (_response.ok) {
|
|
6715
|
+
return {
|
|
6716
|
+
data: _response.body,
|
|
6717
|
+
rawResponse: _response.rawResponse
|
|
6718
|
+
};
|
|
6719
|
+
}
|
|
6720
|
+
if (_response.error.reason === "status-code") {
|
|
6721
|
+
switch (_response.error.statusCode) {
|
|
6722
|
+
case 400:
|
|
6723
|
+
throw new BadRequestError(
|
|
6724
|
+
_response.error.body,
|
|
6725
|
+
_response.rawResponse
|
|
6726
|
+
);
|
|
6727
|
+
case 401:
|
|
6728
|
+
throw new EvaluationUnauthorizedError(
|
|
6729
|
+
_response.error.body,
|
|
6730
|
+
_response.rawResponse
|
|
6731
|
+
);
|
|
6732
|
+
case 403:
|
|
6733
|
+
throw new EvaluationAccessDeniedError(
|
|
6734
|
+
_response.error.body,
|
|
6735
|
+
_response.rawResponse
|
|
6736
|
+
);
|
|
6737
|
+
case 405:
|
|
6738
|
+
throw new EvaluationMethodNotAllowedError(
|
|
6739
|
+
_response.error.body,
|
|
6740
|
+
_response.rawResponse
|
|
6741
|
+
);
|
|
6742
|
+
case 429:
|
|
6743
|
+
throw new TooManyRequestsError(
|
|
6744
|
+
_response.error.body,
|
|
6745
|
+
_response.rawResponse
|
|
6746
|
+
);
|
|
6747
|
+
case 500:
|
|
6748
|
+
throw new InternalServerError(
|
|
6749
|
+
_response.error.body,
|
|
6750
|
+
_response.rawResponse
|
|
6751
|
+
);
|
|
6752
|
+
case 400:
|
|
6753
|
+
throw new Error2(
|
|
6754
|
+
_response.error.body,
|
|
6755
|
+
_response.rawResponse
|
|
6756
|
+
);
|
|
6757
|
+
case 401:
|
|
6758
|
+
throw new UnauthorizedError(
|
|
6759
|
+
_response.error.body,
|
|
6760
|
+
_response.rawResponse
|
|
6761
|
+
);
|
|
6762
|
+
case 403:
|
|
6763
|
+
throw new AccessDeniedError(
|
|
6764
|
+
_response.error.body,
|
|
6765
|
+
_response.rawResponse
|
|
6766
|
+
);
|
|
6767
|
+
case 405:
|
|
6768
|
+
throw new MethodNotAllowedError(
|
|
6769
|
+
_response.error.body,
|
|
6770
|
+
_response.rawResponse
|
|
6771
|
+
);
|
|
6772
|
+
case 404:
|
|
6773
|
+
throw new NotFoundError(
|
|
6774
|
+
_response.error.body,
|
|
6775
|
+
_response.rawResponse
|
|
6776
|
+
);
|
|
6777
|
+
default:
|
|
6778
|
+
throw new LangfuseAPIError({
|
|
6779
|
+
statusCode: _response.error.statusCode,
|
|
6780
|
+
body: _response.error.body,
|
|
6781
|
+
rawResponse: _response.rawResponse
|
|
6782
|
+
});
|
|
6783
|
+
}
|
|
6784
|
+
}
|
|
6785
|
+
switch (_response.error.reason) {
|
|
6786
|
+
case "non-json":
|
|
6787
|
+
throw new LangfuseAPIError({
|
|
6788
|
+
statusCode: _response.error.statusCode,
|
|
6789
|
+
body: _response.error.rawBody,
|
|
6790
|
+
rawResponse: _response.rawResponse
|
|
6791
|
+
});
|
|
6792
|
+
case "timeout":
|
|
6793
|
+
throw new LangfuseAPITimeoutError(
|
|
6794
|
+
"Timeout exceeded when calling GET /api/public/v2/evaluators."
|
|
6795
|
+
);
|
|
6796
|
+
case "unknown":
|
|
6797
|
+
throw new LangfuseAPIError({
|
|
6798
|
+
message: _response.error.errorMessage,
|
|
6799
|
+
rawResponse: _response.rawResponse
|
|
6800
|
+
});
|
|
6801
|
+
}
|
|
6802
|
+
}
|
|
6803
|
+
/**
|
|
6804
|
+
* Get one evaluator by its stable identifier.
|
|
6805
|
+
*
|
|
6806
|
+
* 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.
|
|
6807
|
+
*
|
|
6808
|
+
* @param {string} evaluatorId - Stable evaluator identifier returned by the evaluator endpoints.
|
|
6809
|
+
* @param {Evaluators.RequestOptions} requestOptions - Request-specific configuration.
|
|
6810
|
+
*
|
|
6811
|
+
* @throws {@link LangfuseAPI.EvaluationUnauthorizedError}
|
|
6812
|
+
* @throws {@link LangfuseAPI.EvaluationAccessDeniedError}
|
|
6813
|
+
* @throws {@link LangfuseAPI.EvaluationNotFoundError}
|
|
6814
|
+
* @throws {@link LangfuseAPI.EvaluationMethodNotAllowedError}
|
|
6815
|
+
* @throws {@link LangfuseAPI.TooManyRequestsError}
|
|
6816
|
+
* @throws {@link LangfuseAPI.InternalServerError}
|
|
6817
|
+
* @throws {@link LangfuseAPI.Error}
|
|
6818
|
+
* @throws {@link LangfuseAPI.UnauthorizedError}
|
|
6819
|
+
* @throws {@link LangfuseAPI.AccessDeniedError}
|
|
6820
|
+
* @throws {@link LangfuseAPI.MethodNotAllowedError}
|
|
6821
|
+
* @throws {@link LangfuseAPI.NotFoundError}
|
|
6822
|
+
*
|
|
6823
|
+
* @example
|
|
6824
|
+
* await client.evaluators.get("evaluatorId")
|
|
6825
|
+
*/
|
|
6826
|
+
get(evaluatorId, requestOptions) {
|
|
6827
|
+
return HttpResponsePromise.fromPromise(
|
|
6828
|
+
this.__get(evaluatorId, requestOptions)
|
|
6829
|
+
);
|
|
6830
|
+
}
|
|
6831
|
+
async __get(evaluatorId, requestOptions) {
|
|
6832
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
6833
|
+
let _headers = mergeHeaders(
|
|
6834
|
+
(_a2 = this._options) == null ? void 0 : _a2.headers,
|
|
6835
|
+
mergeOnlyDefinedHeaders({
|
|
6836
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
6837
|
+
"X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
|
|
6838
|
+
"X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
|
|
6839
|
+
"X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
|
|
6840
|
+
}),
|
|
6841
|
+
requestOptions == null ? void 0 : requestOptions.headers
|
|
6842
|
+
);
|
|
6843
|
+
const _response = await fetcher({
|
|
6844
|
+
url: url_exports.join(
|
|
6845
|
+
(_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
|
|
6846
|
+
`/api/public/v2/evaluators/${encodeURIComponent(evaluatorId)}`
|
|
6847
|
+
),
|
|
6848
|
+
method: "GET",
|
|
6849
|
+
headers: _headers,
|
|
6850
|
+
queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
|
|
6851
|
+
timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
6852
|
+
maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
|
|
6853
|
+
abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
|
|
6854
|
+
});
|
|
6855
|
+
if (_response.ok) {
|
|
6856
|
+
return {
|
|
6857
|
+
data: _response.body,
|
|
6858
|
+
rawResponse: _response.rawResponse
|
|
6859
|
+
};
|
|
6860
|
+
}
|
|
6861
|
+
if (_response.error.reason === "status-code") {
|
|
6862
|
+
switch (_response.error.statusCode) {
|
|
6863
|
+
case 401:
|
|
6864
|
+
throw new EvaluationUnauthorizedError(
|
|
6865
|
+
_response.error.body,
|
|
6866
|
+
_response.rawResponse
|
|
6867
|
+
);
|
|
6868
|
+
case 403:
|
|
6869
|
+
throw new EvaluationAccessDeniedError(
|
|
6870
|
+
_response.error.body,
|
|
6871
|
+
_response.rawResponse
|
|
6872
|
+
);
|
|
6873
|
+
case 404:
|
|
6874
|
+
throw new EvaluationNotFoundError(
|
|
6875
|
+
_response.error.body,
|
|
6876
|
+
_response.rawResponse
|
|
6877
|
+
);
|
|
6878
|
+
case 405:
|
|
6879
|
+
throw new EvaluationMethodNotAllowedError(
|
|
6880
|
+
_response.error.body,
|
|
6881
|
+
_response.rawResponse
|
|
6882
|
+
);
|
|
6883
|
+
case 429:
|
|
6884
|
+
throw new TooManyRequestsError(
|
|
6885
|
+
_response.error.body,
|
|
6886
|
+
_response.rawResponse
|
|
6887
|
+
);
|
|
6888
|
+
case 500:
|
|
6889
|
+
throw new InternalServerError(
|
|
6890
|
+
_response.error.body,
|
|
6891
|
+
_response.rawResponse
|
|
6892
|
+
);
|
|
6893
|
+
case 400:
|
|
6894
|
+
throw new Error2(
|
|
6895
|
+
_response.error.body,
|
|
6896
|
+
_response.rawResponse
|
|
6897
|
+
);
|
|
6898
|
+
case 401:
|
|
6899
|
+
throw new UnauthorizedError(
|
|
6900
|
+
_response.error.body,
|
|
6901
|
+
_response.rawResponse
|
|
6902
|
+
);
|
|
6903
|
+
case 403:
|
|
6904
|
+
throw new AccessDeniedError(
|
|
6905
|
+
_response.error.body,
|
|
6906
|
+
_response.rawResponse
|
|
6907
|
+
);
|
|
6908
|
+
case 405:
|
|
6909
|
+
throw new MethodNotAllowedError(
|
|
6910
|
+
_response.error.body,
|
|
6911
|
+
_response.rawResponse
|
|
6912
|
+
);
|
|
6913
|
+
case 404:
|
|
6914
|
+
throw new NotFoundError(
|
|
6915
|
+
_response.error.body,
|
|
6916
|
+
_response.rawResponse
|
|
6917
|
+
);
|
|
6918
|
+
default:
|
|
6919
|
+
throw new LangfuseAPIError({
|
|
6920
|
+
statusCode: _response.error.statusCode,
|
|
6921
|
+
body: _response.error.body,
|
|
6922
|
+
rawResponse: _response.rawResponse
|
|
6923
|
+
});
|
|
6924
|
+
}
|
|
6925
|
+
}
|
|
6926
|
+
switch (_response.error.reason) {
|
|
6927
|
+
case "non-json":
|
|
6928
|
+
throw new LangfuseAPIError({
|
|
6929
|
+
statusCode: _response.error.statusCode,
|
|
6930
|
+
body: _response.error.rawBody,
|
|
6931
|
+
rawResponse: _response.rawResponse
|
|
6932
|
+
});
|
|
6933
|
+
case "timeout":
|
|
6934
|
+
throw new LangfuseAPITimeoutError(
|
|
6935
|
+
"Timeout exceeded when calling GET /api/public/v2/evaluators/{evaluatorId}."
|
|
6936
|
+
);
|
|
6937
|
+
case "unknown":
|
|
6938
|
+
throw new LangfuseAPIError({
|
|
6939
|
+
message: _response.error.errorMessage,
|
|
6940
|
+
rawResponse: _response.rawResponse
|
|
6941
|
+
});
|
|
6942
|
+
}
|
|
6943
|
+
}
|
|
6944
|
+
/**
|
|
6945
|
+
* Update an evaluator by its stable identifier.
|
|
6946
|
+
*
|
|
6947
|
+
* Provide only the top-level fields to change. Metadata-only changes do not create a version. Evaluator type cannot change.
|
|
6948
|
+
*
|
|
6949
|
+
* 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.
|
|
6950
|
+
*
|
|
6951
|
+
* 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.
|
|
6952
|
+
*
|
|
6953
|
+
* @param {string} evaluatorId - Stable evaluator identifier returned by the evaluator endpoints.
|
|
6954
|
+
* @param {LangfuseAPI.UpdateEvaluatorRequest} request
|
|
6955
|
+
* @param {Evaluators.RequestOptions} requestOptions - Request-specific configuration.
|
|
6956
|
+
*
|
|
6957
|
+
* @throws {@link LangfuseAPI.BadRequestError}
|
|
6958
|
+
* @throws {@link LangfuseAPI.EvaluationUnauthorizedError}
|
|
6959
|
+
* @throws {@link LangfuseAPI.EvaluationAccessDeniedError}
|
|
6960
|
+
* @throws {@link LangfuseAPI.EvaluationNotFoundError}
|
|
6961
|
+
* @throws {@link LangfuseAPI.EvaluationMethodNotAllowedError}
|
|
6962
|
+
* @throws {@link LangfuseAPI.ConflictError}
|
|
6963
|
+
* @throws {@link LangfuseAPI.PreconditionFailedError}
|
|
6964
|
+
* @throws {@link LangfuseAPI.TooManyRequestsError}
|
|
6965
|
+
* @throws {@link LangfuseAPI.InternalServerError}
|
|
6966
|
+
* @throws {@link LangfuseAPI.Error}
|
|
6967
|
+
* @throws {@link LangfuseAPI.UnauthorizedError}
|
|
6968
|
+
* @throws {@link LangfuseAPI.AccessDeniedError}
|
|
6969
|
+
* @throws {@link LangfuseAPI.MethodNotAllowedError}
|
|
6970
|
+
* @throws {@link LangfuseAPI.NotFoundError}
|
|
6971
|
+
*
|
|
6972
|
+
* @example
|
|
6973
|
+
* await client.evaluators.update("evaluatorId", {
|
|
6974
|
+
* name: undefined,
|
|
6975
|
+
* description: undefined
|
|
6976
|
+
* })
|
|
6977
|
+
*/
|
|
6978
|
+
update(evaluatorId, request, requestOptions) {
|
|
6979
|
+
return HttpResponsePromise.fromPromise(
|
|
6980
|
+
this.__update(evaluatorId, request, requestOptions)
|
|
6981
|
+
);
|
|
6982
|
+
}
|
|
6983
|
+
async __update(evaluatorId, request, requestOptions) {
|
|
6984
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
6985
|
+
let _headers = mergeHeaders(
|
|
6986
|
+
(_a2 = this._options) == null ? void 0 : _a2.headers,
|
|
6987
|
+
mergeOnlyDefinedHeaders({
|
|
6988
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
6989
|
+
"X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
|
|
6990
|
+
"X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
|
|
6991
|
+
"X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
|
|
6992
|
+
}),
|
|
6993
|
+
requestOptions == null ? void 0 : requestOptions.headers
|
|
6994
|
+
);
|
|
6995
|
+
const _response = await fetcher({
|
|
6996
|
+
url: url_exports.join(
|
|
6997
|
+
(_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
|
|
6998
|
+
`/api/public/v2/evaluators/${encodeURIComponent(evaluatorId)}`
|
|
6999
|
+
),
|
|
7000
|
+
method: "PATCH",
|
|
7001
|
+
headers: _headers,
|
|
7002
|
+
contentType: "application/json",
|
|
7003
|
+
queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
|
|
7004
|
+
requestType: "json",
|
|
7005
|
+
body: request,
|
|
7006
|
+
timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
7007
|
+
maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
|
|
7008
|
+
abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
|
|
7009
|
+
});
|
|
7010
|
+
if (_response.ok) {
|
|
7011
|
+
return {
|
|
7012
|
+
data: _response.body,
|
|
7013
|
+
rawResponse: _response.rawResponse
|
|
7014
|
+
};
|
|
7015
|
+
}
|
|
7016
|
+
if (_response.error.reason === "status-code") {
|
|
7017
|
+
switch (_response.error.statusCode) {
|
|
7018
|
+
case 400:
|
|
7019
|
+
throw new BadRequestError(
|
|
7020
|
+
_response.error.body,
|
|
7021
|
+
_response.rawResponse
|
|
7022
|
+
);
|
|
7023
|
+
case 401:
|
|
7024
|
+
throw new EvaluationUnauthorizedError(
|
|
7025
|
+
_response.error.body,
|
|
7026
|
+
_response.rawResponse
|
|
7027
|
+
);
|
|
7028
|
+
case 403:
|
|
7029
|
+
throw new EvaluationAccessDeniedError(
|
|
7030
|
+
_response.error.body,
|
|
7031
|
+
_response.rawResponse
|
|
7032
|
+
);
|
|
7033
|
+
case 404:
|
|
7034
|
+
throw new EvaluationNotFoundError(
|
|
7035
|
+
_response.error.body,
|
|
7036
|
+
_response.rawResponse
|
|
7037
|
+
);
|
|
7038
|
+
case 405:
|
|
7039
|
+
throw new EvaluationMethodNotAllowedError(
|
|
7040
|
+
_response.error.body,
|
|
7041
|
+
_response.rawResponse
|
|
7042
|
+
);
|
|
7043
|
+
case 409:
|
|
7044
|
+
throw new ConflictError(
|
|
7045
|
+
_response.error.body,
|
|
7046
|
+
_response.rawResponse
|
|
7047
|
+
);
|
|
7048
|
+
case 412:
|
|
7049
|
+
throw new PreconditionFailedError(
|
|
7050
|
+
_response.error.body,
|
|
7051
|
+
_response.rawResponse
|
|
7052
|
+
);
|
|
7053
|
+
case 429:
|
|
7054
|
+
throw new TooManyRequestsError(
|
|
7055
|
+
_response.error.body,
|
|
7056
|
+
_response.rawResponse
|
|
7057
|
+
);
|
|
7058
|
+
case 500:
|
|
7059
|
+
throw new InternalServerError(
|
|
7060
|
+
_response.error.body,
|
|
7061
|
+
_response.rawResponse
|
|
7062
|
+
);
|
|
7063
|
+
case 400:
|
|
7064
|
+
throw new Error2(
|
|
7065
|
+
_response.error.body,
|
|
7066
|
+
_response.rawResponse
|
|
7067
|
+
);
|
|
7068
|
+
case 401:
|
|
7069
|
+
throw new UnauthorizedError(
|
|
7070
|
+
_response.error.body,
|
|
7071
|
+
_response.rawResponse
|
|
7072
|
+
);
|
|
7073
|
+
case 403:
|
|
7074
|
+
throw new AccessDeniedError(
|
|
7075
|
+
_response.error.body,
|
|
7076
|
+
_response.rawResponse
|
|
7077
|
+
);
|
|
7078
|
+
case 405:
|
|
7079
|
+
throw new MethodNotAllowedError(
|
|
7080
|
+
_response.error.body,
|
|
7081
|
+
_response.rawResponse
|
|
7082
|
+
);
|
|
7083
|
+
case 404:
|
|
7084
|
+
throw new NotFoundError(
|
|
7085
|
+
_response.error.body,
|
|
7086
|
+
_response.rawResponse
|
|
7087
|
+
);
|
|
7088
|
+
default:
|
|
7089
|
+
throw new LangfuseAPIError({
|
|
7090
|
+
statusCode: _response.error.statusCode,
|
|
7091
|
+
body: _response.error.body,
|
|
7092
|
+
rawResponse: _response.rawResponse
|
|
7093
|
+
});
|
|
7094
|
+
}
|
|
7095
|
+
}
|
|
7096
|
+
switch (_response.error.reason) {
|
|
7097
|
+
case "non-json":
|
|
7098
|
+
throw new LangfuseAPIError({
|
|
7099
|
+
statusCode: _response.error.statusCode,
|
|
7100
|
+
body: _response.error.rawBody,
|
|
7101
|
+
rawResponse: _response.rawResponse
|
|
7102
|
+
});
|
|
7103
|
+
case "timeout":
|
|
7104
|
+
throw new LangfuseAPITimeoutError(
|
|
7105
|
+
"Timeout exceeded when calling PATCH /api/public/v2/evaluators/{evaluatorId}."
|
|
5171
7106
|
);
|
|
5172
7107
|
case "unknown":
|
|
5173
7108
|
throw new LangfuseAPIError({
|
|
@@ -5177,12 +7112,19 @@ var Datasets = class {
|
|
|
5177
7112
|
}
|
|
5178
7113
|
}
|
|
5179
7114
|
/**
|
|
5180
|
-
* Delete
|
|
7115
|
+
* Delete an evaluator and all of its stored versions.
|
|
5181
7116
|
*
|
|
5182
|
-
*
|
|
5183
|
-
* @param {string} runName
|
|
5184
|
-
* @param {Datasets.RequestOptions} requestOptions - Request-specific configuration.
|
|
7117
|
+
* Associated evaluation-rule assignments are also removed. Scores already produced by the evaluator are preserved.
|
|
5185
7118
|
*
|
|
7119
|
+
* @param {string} evaluatorId - Stable evaluator identifier returned by the evaluator endpoints.
|
|
7120
|
+
* @param {Evaluators.RequestOptions} requestOptions - Request-specific configuration.
|
|
7121
|
+
*
|
|
7122
|
+
* @throws {@link LangfuseAPI.EvaluationUnauthorizedError}
|
|
7123
|
+
* @throws {@link LangfuseAPI.EvaluationAccessDeniedError}
|
|
7124
|
+
* @throws {@link LangfuseAPI.EvaluationNotFoundError}
|
|
7125
|
+
* @throws {@link LangfuseAPI.EvaluationMethodNotAllowedError}
|
|
7126
|
+
* @throws {@link LangfuseAPI.TooManyRequestsError}
|
|
7127
|
+
* @throws {@link LangfuseAPI.InternalServerError}
|
|
5186
7128
|
* @throws {@link LangfuseAPI.Error}
|
|
5187
7129
|
* @throws {@link LangfuseAPI.UnauthorizedError}
|
|
5188
7130
|
* @throws {@link LangfuseAPI.AccessDeniedError}
|
|
@@ -5190,14 +7132,14 @@ var Datasets = class {
|
|
|
5190
7132
|
* @throws {@link LangfuseAPI.NotFoundError}
|
|
5191
7133
|
*
|
|
5192
7134
|
* @example
|
|
5193
|
-
* await client.
|
|
7135
|
+
* await client.evaluators.delete("evaluatorId")
|
|
5194
7136
|
*/
|
|
5195
|
-
|
|
7137
|
+
delete(evaluatorId, requestOptions) {
|
|
5196
7138
|
return HttpResponsePromise.fromPromise(
|
|
5197
|
-
this.
|
|
7139
|
+
this.__delete(evaluatorId, requestOptions)
|
|
5198
7140
|
);
|
|
5199
7141
|
}
|
|
5200
|
-
async
|
|
7142
|
+
async __delete(evaluatorId, requestOptions) {
|
|
5201
7143
|
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
5202
7144
|
let _headers = mergeHeaders(
|
|
5203
7145
|
(_a2 = this._options) == null ? void 0 : _a2.headers,
|
|
@@ -5212,7 +7154,7 @@ var Datasets = class {
|
|
|
5212
7154
|
const _response = await fetcher({
|
|
5213
7155
|
url: url_exports.join(
|
|
5214
7156
|
(_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
|
|
5215
|
-
`/api/public/
|
|
7157
|
+
`/api/public/v2/evaluators/${encodeURIComponent(evaluatorId)}`
|
|
5216
7158
|
),
|
|
5217
7159
|
method: "DELETE",
|
|
5218
7160
|
headers: _headers,
|
|
@@ -5229,6 +7171,36 @@ var Datasets = class {
|
|
|
5229
7171
|
}
|
|
5230
7172
|
if (_response.error.reason === "status-code") {
|
|
5231
7173
|
switch (_response.error.statusCode) {
|
|
7174
|
+
case 401:
|
|
7175
|
+
throw new EvaluationUnauthorizedError(
|
|
7176
|
+
_response.error.body,
|
|
7177
|
+
_response.rawResponse
|
|
7178
|
+
);
|
|
7179
|
+
case 403:
|
|
7180
|
+
throw new EvaluationAccessDeniedError(
|
|
7181
|
+
_response.error.body,
|
|
7182
|
+
_response.rawResponse
|
|
7183
|
+
);
|
|
7184
|
+
case 404:
|
|
7185
|
+
throw new EvaluationNotFoundError(
|
|
7186
|
+
_response.error.body,
|
|
7187
|
+
_response.rawResponse
|
|
7188
|
+
);
|
|
7189
|
+
case 405:
|
|
7190
|
+
throw new EvaluationMethodNotAllowedError(
|
|
7191
|
+
_response.error.body,
|
|
7192
|
+
_response.rawResponse
|
|
7193
|
+
);
|
|
7194
|
+
case 429:
|
|
7195
|
+
throw new TooManyRequestsError(
|
|
7196
|
+
_response.error.body,
|
|
7197
|
+
_response.rawResponse
|
|
7198
|
+
);
|
|
7199
|
+
case 500:
|
|
7200
|
+
throw new InternalServerError(
|
|
7201
|
+
_response.error.body,
|
|
7202
|
+
_response.rawResponse
|
|
7203
|
+
);
|
|
5232
7204
|
case 400:
|
|
5233
7205
|
throw new Error2(
|
|
5234
7206
|
_response.error.body,
|
|
@@ -5271,7 +7243,7 @@ var Datasets = class {
|
|
|
5271
7243
|
});
|
|
5272
7244
|
case "timeout":
|
|
5273
7245
|
throw new LangfuseAPITimeoutError(
|
|
5274
|
-
"Timeout exceeded when calling DELETE /api/public/
|
|
7246
|
+
"Timeout exceeded when calling DELETE /api/public/v2/evaluators/{evaluatorId}."
|
|
5275
7247
|
);
|
|
5276
7248
|
case "unknown":
|
|
5277
7249
|
throw new LangfuseAPIError({
|
|
@@ -5281,12 +7253,21 @@ var Datasets = class {
|
|
|
5281
7253
|
}
|
|
5282
7254
|
}
|
|
5283
7255
|
/**
|
|
5284
|
-
*
|
|
7256
|
+
* List an evaluator's version history in newest-first order.
|
|
5285
7257
|
*
|
|
5286
|
-
*
|
|
5287
|
-
*
|
|
5288
|
-
* @param {
|
|
7258
|
+
* This endpoint is intended for history and audit use cases. Ordinary clients can use the flattened `version` and definition fields on the evaluator response.
|
|
7259
|
+
*
|
|
7260
|
+
* @param {string} evaluatorId - Stable evaluator identifier returned by the evaluator endpoints.
|
|
7261
|
+
* @param {LangfuseAPI.ListEvaluatorVersionsRequest} request
|
|
7262
|
+
* @param {Evaluators.RequestOptions} requestOptions - Request-specific configuration.
|
|
5289
7263
|
*
|
|
7264
|
+
* @throws {@link LangfuseAPI.BadRequestError}
|
|
7265
|
+
* @throws {@link LangfuseAPI.EvaluationUnauthorizedError}
|
|
7266
|
+
* @throws {@link LangfuseAPI.EvaluationAccessDeniedError}
|
|
7267
|
+
* @throws {@link LangfuseAPI.EvaluationNotFoundError}
|
|
7268
|
+
* @throws {@link LangfuseAPI.EvaluationMethodNotAllowedError}
|
|
7269
|
+
* @throws {@link LangfuseAPI.TooManyRequestsError}
|
|
7270
|
+
* @throws {@link LangfuseAPI.InternalServerError}
|
|
5290
7271
|
* @throws {@link LangfuseAPI.Error}
|
|
5291
7272
|
* @throws {@link LangfuseAPI.UnauthorizedError}
|
|
5292
7273
|
* @throws {@link LangfuseAPI.AccessDeniedError}
|
|
@@ -5294,23 +7275,23 @@ var Datasets = class {
|
|
|
5294
7275
|
* @throws {@link LangfuseAPI.NotFoundError}
|
|
5295
7276
|
*
|
|
5296
7277
|
* @example
|
|
5297
|
-
* await client.
|
|
7278
|
+
* await client.evaluators.listVersions("evaluatorId")
|
|
5298
7279
|
*/
|
|
5299
|
-
|
|
7280
|
+
listVersions(evaluatorId, request = {}, requestOptions) {
|
|
5300
7281
|
return HttpResponsePromise.fromPromise(
|
|
5301
|
-
this.
|
|
7282
|
+
this.__listVersions(evaluatorId, request, requestOptions)
|
|
5302
7283
|
);
|
|
5303
7284
|
}
|
|
5304
|
-
async
|
|
7285
|
+
async __listVersions(evaluatorId, request = {}, requestOptions) {
|
|
5305
7286
|
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
5306
|
-
const {
|
|
7287
|
+
const { limit, cursor } = request;
|
|
5307
7288
|
const _queryParams = {};
|
|
5308
|
-
if (page != null) {
|
|
5309
|
-
_queryParams["page"] = page.toString();
|
|
5310
|
-
}
|
|
5311
7289
|
if (limit != null) {
|
|
5312
7290
|
_queryParams["limit"] = limit.toString();
|
|
5313
7291
|
}
|
|
7292
|
+
if (cursor != null) {
|
|
7293
|
+
_queryParams["cursor"] = cursor;
|
|
7294
|
+
}
|
|
5314
7295
|
let _headers = mergeHeaders(
|
|
5315
7296
|
(_a2 = this._options) == null ? void 0 : _a2.headers,
|
|
5316
7297
|
mergeOnlyDefinedHeaders({
|
|
@@ -5324,7 +7305,7 @@ var Datasets = class {
|
|
|
5324
7305
|
const _response = await fetcher({
|
|
5325
7306
|
url: url_exports.join(
|
|
5326
7307
|
(_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
|
|
5327
|
-
`/api/public/
|
|
7308
|
+
`/api/public/v2/evaluators/${encodeURIComponent(evaluatorId)}/versions`
|
|
5328
7309
|
),
|
|
5329
7310
|
method: "GET",
|
|
5330
7311
|
headers: _headers,
|
|
@@ -5341,6 +7322,41 @@ var Datasets = class {
|
|
|
5341
7322
|
}
|
|
5342
7323
|
if (_response.error.reason === "status-code") {
|
|
5343
7324
|
switch (_response.error.statusCode) {
|
|
7325
|
+
case 400:
|
|
7326
|
+
throw new BadRequestError(
|
|
7327
|
+
_response.error.body,
|
|
7328
|
+
_response.rawResponse
|
|
7329
|
+
);
|
|
7330
|
+
case 401:
|
|
7331
|
+
throw new EvaluationUnauthorizedError(
|
|
7332
|
+
_response.error.body,
|
|
7333
|
+
_response.rawResponse
|
|
7334
|
+
);
|
|
7335
|
+
case 403:
|
|
7336
|
+
throw new EvaluationAccessDeniedError(
|
|
7337
|
+
_response.error.body,
|
|
7338
|
+
_response.rawResponse
|
|
7339
|
+
);
|
|
7340
|
+
case 404:
|
|
7341
|
+
throw new EvaluationNotFoundError(
|
|
7342
|
+
_response.error.body,
|
|
7343
|
+
_response.rawResponse
|
|
7344
|
+
);
|
|
7345
|
+
case 405:
|
|
7346
|
+
throw new EvaluationMethodNotAllowedError(
|
|
7347
|
+
_response.error.body,
|
|
7348
|
+
_response.rawResponse
|
|
7349
|
+
);
|
|
7350
|
+
case 429:
|
|
7351
|
+
throw new TooManyRequestsError(
|
|
7352
|
+
_response.error.body,
|
|
7353
|
+
_response.rawResponse
|
|
7354
|
+
);
|
|
7355
|
+
case 500:
|
|
7356
|
+
throw new InternalServerError(
|
|
7357
|
+
_response.error.body,
|
|
7358
|
+
_response.rawResponse
|
|
7359
|
+
);
|
|
5344
7360
|
case 400:
|
|
5345
7361
|
throw new Error2(
|
|
5346
7362
|
_response.error.body,
|
|
@@ -5383,7 +7399,7 @@ var Datasets = class {
|
|
|
5383
7399
|
});
|
|
5384
7400
|
case "timeout":
|
|
5385
7401
|
throw new LangfuseAPITimeoutError(
|
|
5386
|
-
"Timeout exceeded when calling GET /api/public/
|
|
7402
|
+
"Timeout exceeded when calling GET /api/public/v2/evaluators/{evaluatorId}/versions."
|
|
5387
7403
|
);
|
|
5388
7404
|
case "unknown":
|
|
5389
7405
|
throw new LangfuseAPIError({
|
|
@@ -5731,6 +7747,8 @@ var Feedback = class {
|
|
|
5731
7747
|
/**
|
|
5732
7748
|
* 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.
|
|
5733
7749
|
*
|
|
7750
|
+
* Not available in the HIPAA cloud region.
|
|
7751
|
+
*
|
|
5734
7752
|
* @param {LangfuseAPI.SubmitFeedbackRequest} request
|
|
5735
7753
|
* @param {Feedback.RequestOptions} requestOptions - Request-specific configuration.
|
|
5736
7754
|
*
|
|
@@ -6001,6 +8019,8 @@ var Ingestion = class {
|
|
|
6001
8019
|
* - Batch sizes are limited to 3.5 MB in total. You need to adjust the number of events per batch accordingly.
|
|
6002
8020
|
* - 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.
|
|
6003
8021
|
*
|
|
8022
|
+
* @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.
|
|
8023
|
+
*
|
|
6004
8024
|
* @param {LangfuseAPI.IngestionRequest} request
|
|
6005
8025
|
* @param {Ingestion.RequestOptions} requestOptions - Request-specific configuration.
|
|
6006
8026
|
*
|
|
@@ -6181,6 +8201,8 @@ var MetricsV1 = class {
|
|
|
6181
8201
|
*
|
|
6182
8202
|
* For more details, see the [Metrics API documentation](https://langfuse.com/docs/metrics/features/metrics-api).
|
|
6183
8203
|
*
|
|
8204
|
+
* @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.
|
|
8205
|
+
*
|
|
6184
8206
|
* @param {LangfuseAPI.legacy.GetMetricsRequest} request
|
|
6185
8207
|
* @param {MetricsV1.RequestOptions} requestOptions - Request-specific configuration.
|
|
6186
8208
|
*
|
|
@@ -6307,6 +8329,8 @@ var ObservationsV1 = class {
|
|
|
6307
8329
|
/**
|
|
6308
8330
|
* Get a observation
|
|
6309
8331
|
*
|
|
8332
|
+
* @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.
|
|
8333
|
+
*
|
|
6310
8334
|
* @param {string} observationId - The unique langfuse identifier of an observation, can be an event, span or generation
|
|
6311
8335
|
* @param {ObservationsV1.RequestOptions} requestOptions - Request-specific configuration.
|
|
6312
8336
|
*
|
|
@@ -6412,6 +8436,8 @@ var ObservationsV1 = class {
|
|
|
6412
8436
|
*
|
|
6413
8437
|
* Consider using the [v2 observations endpoint](/api-reference#tag/observationsv2/GET/api/public/v2/observations) for cursor-based pagination and field selection.
|
|
6414
8438
|
*
|
|
8439
|
+
* @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.
|
|
8440
|
+
*
|
|
6415
8441
|
* @param {LangfuseAPI.legacy.GetObservationsRequest} request
|
|
6416
8442
|
* @param {ObservationsV1.RequestOptions} requestOptions - Request-specific configuration.
|
|
6417
8443
|
*
|
|
@@ -6713,6 +8739,8 @@ var Scores = class {
|
|
|
6713
8739
|
/**
|
|
6714
8740
|
* Get a list of scores (supports both trace and session scores)
|
|
6715
8741
|
*
|
|
8742
|
+
* @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.
|
|
8743
|
+
*
|
|
6716
8744
|
* @param {LangfuseAPI.GetScoresRequest} request
|
|
6717
8745
|
* @param {Scores.RequestOptions} requestOptions - Request-specific configuration.
|
|
6718
8746
|
*
|
|
@@ -6911,6 +8939,8 @@ var Scores = class {
|
|
|
6911
8939
|
/**
|
|
6912
8940
|
* Get a score (supports both trace and session scores)
|
|
6913
8941
|
*
|
|
8942
|
+
* @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.
|
|
8943
|
+
*
|
|
6914
8944
|
* @param {string} scoreId - The unique langfuse identifier of a score
|
|
6915
8945
|
* @param {Scores.RequestOptions} requestOptions - Request-specific configuration.
|
|
6916
8946
|
*
|
|
@@ -8122,7 +10152,7 @@ var Models = class {
|
|
|
8122
10152
|
* modelName: "modelName",
|
|
8123
10153
|
* matchPattern: "matchPattern",
|
|
8124
10154
|
* startDate: undefined,
|
|
8125
|
-
* unit:
|
|
10155
|
+
* unit: "CHARACTERS",
|
|
8126
10156
|
* inputPrice: undefined,
|
|
8127
10157
|
* outputPrice: undefined,
|
|
8128
10158
|
* totalPrice: undefined,
|
|
@@ -8222,6 +10252,124 @@ var Models = class {
|
|
|
8222
10252
|
});
|
|
8223
10253
|
}
|
|
8224
10254
|
}
|
|
10255
|
+
/**
|
|
10256
|
+
* Create or replace a project-owned model using its id. Built-in models cannot be modified.
|
|
10257
|
+
*
|
|
10258
|
+
* @param {string} id
|
|
10259
|
+
* @param {LangfuseAPI.CreateModelRequest} request
|
|
10260
|
+
* @param {Models.RequestOptions} requestOptions - Request-specific configuration.
|
|
10261
|
+
*
|
|
10262
|
+
* @throws {@link LangfuseAPI.Error}
|
|
10263
|
+
* @throws {@link LangfuseAPI.UnauthorizedError}
|
|
10264
|
+
* @throws {@link LangfuseAPI.AccessDeniedError}
|
|
10265
|
+
* @throws {@link LangfuseAPI.MethodNotAllowedError}
|
|
10266
|
+
* @throws {@link LangfuseAPI.NotFoundError}
|
|
10267
|
+
*
|
|
10268
|
+
* @example
|
|
10269
|
+
* await client.models.upsert("id", {
|
|
10270
|
+
* modelName: "modelName",
|
|
10271
|
+
* matchPattern: "matchPattern",
|
|
10272
|
+
* startDate: undefined,
|
|
10273
|
+
* unit: "CHARACTERS",
|
|
10274
|
+
* inputPrice: undefined,
|
|
10275
|
+
* outputPrice: undefined,
|
|
10276
|
+
* totalPrice: undefined,
|
|
10277
|
+
* pricingTiers: undefined,
|
|
10278
|
+
* tokenizerId: undefined,
|
|
10279
|
+
* tokenizerConfig: undefined
|
|
10280
|
+
* })
|
|
10281
|
+
*/
|
|
10282
|
+
upsert(id, request, requestOptions) {
|
|
10283
|
+
return HttpResponsePromise.fromPromise(
|
|
10284
|
+
this.__upsert(id, request, requestOptions)
|
|
10285
|
+
);
|
|
10286
|
+
}
|
|
10287
|
+
async __upsert(id, request, requestOptions) {
|
|
10288
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
10289
|
+
let _headers = mergeHeaders(
|
|
10290
|
+
(_a2 = this._options) == null ? void 0 : _a2.headers,
|
|
10291
|
+
mergeOnlyDefinedHeaders({
|
|
10292
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
10293
|
+
"X-Langfuse-Sdk-Name": (_c = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkName) != null ? _c : (_b = this._options) == null ? void 0 : _b.xLangfuseSdkName,
|
|
10294
|
+
"X-Langfuse-Sdk-Version": (_e = requestOptions == null ? void 0 : requestOptions.xLangfuseSdkVersion) != null ? _e : (_d = this._options) == null ? void 0 : _d.xLangfuseSdkVersion,
|
|
10295
|
+
"X-Langfuse-Public-Key": (_g = requestOptions == null ? void 0 : requestOptions.xLangfusePublicKey) != null ? _g : (_f = this._options) == null ? void 0 : _f.xLangfusePublicKey
|
|
10296
|
+
}),
|
|
10297
|
+
requestOptions == null ? void 0 : requestOptions.headers
|
|
10298
|
+
);
|
|
10299
|
+
const _response = await fetcher({
|
|
10300
|
+
url: url_exports.join(
|
|
10301
|
+
(_h = await Supplier.get(this._options.baseUrl)) != null ? _h : await Supplier.get(this._options.environment),
|
|
10302
|
+
`/api/public/models/${encodeURIComponent(id)}`
|
|
10303
|
+
),
|
|
10304
|
+
method: "PUT",
|
|
10305
|
+
headers: _headers,
|
|
10306
|
+
contentType: "application/json",
|
|
10307
|
+
queryParameters: requestOptions == null ? void 0 : requestOptions.queryParams,
|
|
10308
|
+
requestType: "json",
|
|
10309
|
+
body: request,
|
|
10310
|
+
timeoutMs: (requestOptions == null ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
10311
|
+
maxRetries: requestOptions == null ? void 0 : requestOptions.maxRetries,
|
|
10312
|
+
abortSignal: requestOptions == null ? void 0 : requestOptions.abortSignal
|
|
10313
|
+
});
|
|
10314
|
+
if (_response.ok) {
|
|
10315
|
+
return {
|
|
10316
|
+
data: _response.body,
|
|
10317
|
+
rawResponse: _response.rawResponse
|
|
10318
|
+
};
|
|
10319
|
+
}
|
|
10320
|
+
if (_response.error.reason === "status-code") {
|
|
10321
|
+
switch (_response.error.statusCode) {
|
|
10322
|
+
case 400:
|
|
10323
|
+
throw new Error2(
|
|
10324
|
+
_response.error.body,
|
|
10325
|
+
_response.rawResponse
|
|
10326
|
+
);
|
|
10327
|
+
case 401:
|
|
10328
|
+
throw new UnauthorizedError(
|
|
10329
|
+
_response.error.body,
|
|
10330
|
+
_response.rawResponse
|
|
10331
|
+
);
|
|
10332
|
+
case 403:
|
|
10333
|
+
throw new AccessDeniedError(
|
|
10334
|
+
_response.error.body,
|
|
10335
|
+
_response.rawResponse
|
|
10336
|
+
);
|
|
10337
|
+
case 405:
|
|
10338
|
+
throw new MethodNotAllowedError(
|
|
10339
|
+
_response.error.body,
|
|
10340
|
+
_response.rawResponse
|
|
10341
|
+
);
|
|
10342
|
+
case 404:
|
|
10343
|
+
throw new NotFoundError(
|
|
10344
|
+
_response.error.body,
|
|
10345
|
+
_response.rawResponse
|
|
10346
|
+
);
|
|
10347
|
+
default:
|
|
10348
|
+
throw new LangfuseAPIError({
|
|
10349
|
+
statusCode: _response.error.statusCode,
|
|
10350
|
+
body: _response.error.body,
|
|
10351
|
+
rawResponse: _response.rawResponse
|
|
10352
|
+
});
|
|
10353
|
+
}
|
|
10354
|
+
}
|
|
10355
|
+
switch (_response.error.reason) {
|
|
10356
|
+
case "non-json":
|
|
10357
|
+
throw new LangfuseAPIError({
|
|
10358
|
+
statusCode: _response.error.statusCode,
|
|
10359
|
+
body: _response.error.rawBody,
|
|
10360
|
+
rawResponse: _response.rawResponse
|
|
10361
|
+
});
|
|
10362
|
+
case "timeout":
|
|
10363
|
+
throw new LangfuseAPITimeoutError(
|
|
10364
|
+
"Timeout exceeded when calling PUT /api/public/models/{id}."
|
|
10365
|
+
);
|
|
10366
|
+
case "unknown":
|
|
10367
|
+
throw new LangfuseAPIError({
|
|
10368
|
+
message: _response.error.errorMessage,
|
|
10369
|
+
rawResponse: _response.rawResponse
|
|
10370
|
+
});
|
|
10371
|
+
}
|
|
10372
|
+
}
|
|
8225
10373
|
/**
|
|
8226
10374
|
* Get all models
|
|
8227
10375
|
*
|
|
@@ -12641,6 +14789,8 @@ var Sessions = class {
|
|
|
12641
14789
|
* `sessionId` instead:
|
|
12642
14790
|
* `GET /api/public/v2/observations?fromStartTime=<from>&toStartTime=<to>`.
|
|
12643
14791
|
*
|
|
14792
|
+
* @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.
|
|
14793
|
+
*
|
|
12644
14794
|
* @param {LangfuseAPI.GetSessionsRequest} request
|
|
12645
14795
|
* @param {Sessions.RequestOptions} requestOptions - Request-specific configuration.
|
|
12646
14796
|
*
|
|
@@ -12770,6 +14920,8 @@ var Sessions = class {
|
|
|
12770
14920
|
* with a URL-encoded `sessionId` filter and a bounded time range:
|
|
12771
14921
|
* `GET /api/public/v2/observations?filter=<sessionId filter>&fromStartTime=<from>&toStartTime=<to>`.
|
|
12772
14922
|
*
|
|
14923
|
+
* @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.
|
|
14924
|
+
*
|
|
12773
14925
|
* @param {string} sessionId - The unique id of a session
|
|
12774
14926
|
* @param {Sessions.RequestOptions} requestOptions - Request-specific configuration.
|
|
12775
14927
|
*
|
|
@@ -12891,6 +15043,8 @@ var Trace = class {
|
|
|
12891
15043
|
/**
|
|
12892
15044
|
* Get a specific trace
|
|
12893
15045
|
*
|
|
15046
|
+
* @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.
|
|
15047
|
+
*
|
|
12894
15048
|
* @param {string} traceId - The unique langfuse identifier of a trace
|
|
12895
15049
|
* @param {LangfuseAPI.GetTraceRequest} request
|
|
12896
15050
|
* @param {Trace.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -13103,6 +15257,8 @@ var Trace = class {
|
|
|
13103
15257
|
/**
|
|
13104
15258
|
* Get list of traces
|
|
13105
15259
|
*
|
|
15260
|
+
* @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.
|
|
15261
|
+
*
|
|
13106
15262
|
* @param {LangfuseAPI.GetTracesRequest} request
|
|
13107
15263
|
* @param {Trace.RequestOptions} requestOptions - Request-specific configuration.
|
|
13108
15264
|
*
|
|
@@ -15440,7 +17596,7 @@ var Dashboards = class {
|
|
|
15440
17596
|
};
|
|
15441
17597
|
|
|
15442
17598
|
// src/api/api/resources/unstable/resources/evaluationRules/client/Client.ts
|
|
15443
|
-
var
|
|
17599
|
+
var EvaluationRules2 = class {
|
|
15444
17600
|
constructor(_options) {
|
|
15445
17601
|
this._options = _options;
|
|
15446
17602
|
}
|
|
@@ -15454,19 +17610,21 @@ var EvaluationRules = class {
|
|
|
15454
17610
|
* Key rules:
|
|
15455
17611
|
* - `name` must be unique within the project for public evaluation rules
|
|
15456
17612
|
* - `target` must be `observation` or `experiment`
|
|
15457
|
-
* -
|
|
17613
|
+
* - provide either the compatibility `evaluator` field or the new `evaluators` array, never both
|
|
17614
|
+
* - each evaluator `name` + `type` must identify an existing evaluator family returned by the evaluator endpoints
|
|
15458
17615
|
* - Langfuse resolves that family to its latest version before saving the evaluation rule
|
|
15459
17616
|
* - for `target=experiment`, use dataset `id` values from `GET /api/public/v2/datasets` when filtering by `datasetId`
|
|
15460
|
-
* -
|
|
17617
|
+
* - an omitted LLM-as-judge assignment mapping inherits the evaluator version's default mapping
|
|
17618
|
+
* - the effective mapping must map every evaluator prompt variable exactly once
|
|
15461
17619
|
* - for `code` evaluators, Langfuse uses the fixed code runtime mapping; omit `mapping` in create and update requests
|
|
15462
17620
|
* - for user-provided `llm_as_judge` mappings, `expected_output` and `experiment_item_metadata` are only valid for `target=experiment`
|
|
15463
17621
|
* - if `enabled=true`, Langfuse validates that the referenced evaluator can currently run
|
|
15464
|
-
* - at most
|
|
17622
|
+
* - 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)
|
|
15465
17623
|
*
|
|
15466
17624
|
* If an evaluation rule with the same `name` already exists in the project, the API returns `409`.
|
|
15467
17625
|
* In that case, update the existing resource with `PATCH /api/public/unstable/evaluation-rules/{evaluationRuleId}` instead of creating a second one.
|
|
15468
17626
|
*
|
|
15469
|
-
* If enabling this resource would exceed the
|
|
17627
|
+
* If enabling this resource would exceed the 500-active limit, the API also returns `409`.
|
|
15470
17628
|
* In that case, disable or pause another active evaluation rule before enabling a new one.
|
|
15471
17629
|
*
|
|
15472
17630
|
* Current scope:
|
|
@@ -15482,6 +17640,8 @@ var EvaluationRules = class {
|
|
|
15482
17640
|
* - `400 invalid_json_path`: remove or correct the `jsonPath`
|
|
15483
17641
|
* - `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.
|
|
15484
17642
|
*
|
|
17643
|
+
* @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.
|
|
17644
|
+
*
|
|
15485
17645
|
* @param {LangfuseAPI.unstable.CreateEvaluationRuleRequest} request
|
|
15486
17646
|
* @param {EvaluationRules.RequestOptions} requestOptions - Request-specific configuration.
|
|
15487
17647
|
*
|
|
@@ -15505,7 +17665,6 @@ var EvaluationRules = class {
|
|
|
15505
17665
|
* name: "answer-correctness-live",
|
|
15506
17666
|
* evaluator: {
|
|
15507
17667
|
* name: "answer-correctness",
|
|
15508
|
-
* scope: "project",
|
|
15509
17668
|
* type: "llm_as_judge"
|
|
15510
17669
|
* },
|
|
15511
17670
|
* target: "observation",
|
|
@@ -15531,7 +17690,6 @@ var EvaluationRules = class {
|
|
|
15531
17690
|
* name: "toxicity-code-live",
|
|
15532
17691
|
* evaluator: {
|
|
15533
17692
|
* name: "toxicity-detector",
|
|
15534
|
-
* scope: "project",
|
|
15535
17693
|
* type: "code"
|
|
15536
17694
|
* },
|
|
15537
17695
|
* target: "observation",
|
|
@@ -15550,7 +17708,6 @@ var EvaluationRules = class {
|
|
|
15550
17708
|
* name: "experiment-expected-output-match",
|
|
15551
17709
|
* evaluator: {
|
|
15552
17710
|
* name: "expected-output-match",
|
|
15553
|
-
* scope: "project",
|
|
15554
17711
|
* type: "llm_as_judge"
|
|
15555
17712
|
* },
|
|
15556
17713
|
* target: "experiment",
|
|
@@ -15712,6 +17869,8 @@ var EvaluationRules = class {
|
|
|
15712
17869
|
*
|
|
15713
17870
|
* 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.
|
|
15714
17871
|
*
|
|
17872
|
+
* @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.
|
|
17873
|
+
*
|
|
15715
17874
|
* @param {LangfuseAPI.unstable.ListEvaluationRulesRequest} request
|
|
15716
17875
|
* @param {EvaluationRules.RequestOptions} requestOptions - Request-specific configuration.
|
|
15717
17876
|
*
|
|
@@ -15861,6 +18020,8 @@ var EvaluationRules = class {
|
|
|
15861
18020
|
*
|
|
15862
18021
|
* 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.
|
|
15863
18022
|
*
|
|
18023
|
+
* @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.
|
|
18024
|
+
*
|
|
15864
18025
|
* @param {string} evaluationRuleId - Evaluation rule identifier returned by the evaluation rule endpoints.
|
|
15865
18026
|
* @param {EvaluationRules.RequestOptions} requestOptions - Request-specific configuration.
|
|
15866
18027
|
*
|
|
@@ -16020,12 +18181,14 @@ var EvaluationRules = class {
|
|
|
16020
18181
|
* - 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
|
|
16021
18182
|
* - for `code` evaluator rules, omit `mapping`; Langfuse stores the fixed code runtime mapping automatically
|
|
16022
18183
|
* - if the resulting config is enabled, Langfuse re-validates that the selected evaluator can run
|
|
16023
|
-
* - if the update would move a non-active evaluation rule into the active state and the project already has
|
|
18184
|
+
* - 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`
|
|
16024
18185
|
*
|
|
16025
18186
|
* Recovery guidance:
|
|
16026
18187
|
* - 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`
|
|
16027
18188
|
* - if the update fails with `invalid_filter_value` after changing `target`, resend the request with a target-compatible `filter`
|
|
16028
18189
|
*
|
|
18190
|
+
* @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.
|
|
18191
|
+
*
|
|
16029
18192
|
* @param {string} evaluationRuleId - Evaluation rule identifier.
|
|
16030
18193
|
* @param {LangfuseAPI.unstable.UpdateEvaluationRuleRequest} request
|
|
16031
18194
|
* @param {EvaluationRules.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -16047,6 +18210,7 @@ var EvaluationRules = class {
|
|
|
16047
18210
|
* @example
|
|
16048
18211
|
* await client.unstable.evaluationRules.update("evaluationRuleId", {
|
|
16049
18212
|
* name: undefined,
|
|
18213
|
+
* evaluators: undefined,
|
|
16050
18214
|
* evaluator: undefined,
|
|
16051
18215
|
* target: undefined,
|
|
16052
18216
|
* enabled: undefined,
|
|
@@ -16191,6 +18355,8 @@ var EvaluationRules = class {
|
|
|
16191
18355
|
*
|
|
16192
18356
|
* This removes the live-ingestion rule only. It does not delete the referenced evaluator.
|
|
16193
18357
|
*
|
|
18358
|
+
* @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.
|
|
18359
|
+
*
|
|
16194
18360
|
* @param {string} evaluationRuleId - Evaluation rule identifier.
|
|
16195
18361
|
* @param {EvaluationRules.RequestOptions} requestOptions - Request-specific configuration.
|
|
16196
18362
|
*
|
|
@@ -16347,7 +18513,7 @@ var EvaluationRules = class {
|
|
|
16347
18513
|
};
|
|
16348
18514
|
|
|
16349
18515
|
// src/api/api/resources/unstable/resources/evaluators/client/Client.ts
|
|
16350
|
-
var
|
|
18516
|
+
var Evaluators2 = class {
|
|
16351
18517
|
constructor(_options) {
|
|
16352
18518
|
this._options = _options;
|
|
16353
18519
|
}
|
|
@@ -16361,13 +18527,14 @@ var Evaluators = class {
|
|
|
16361
18527
|
* Naming behavior:
|
|
16362
18528
|
* - If this is a new evaluator name in your project, Langfuse creates version `1`.
|
|
16363
18529
|
* - If the name already exists in your project, Langfuse creates the next version and returns it.
|
|
16364
|
-
* -
|
|
18530
|
+
* - The evaluator `id` remains stable across versions.
|
|
18531
|
+
* - Existing evaluation rules automatically use the latest evaluator version; no rule update is required.
|
|
16365
18532
|
*
|
|
16366
18533
|
* Recommended workflow:
|
|
16367
18534
|
* 1. Create the evaluator.
|
|
16368
18535
|
* 2. Read the returned `variables` array.
|
|
16369
18536
|
* 3. Read the returned `outputDefinition.dataType` so the client knows whether future scores will be numeric, boolean, or categorical.
|
|
16370
|
-
* 4. Create one or more evaluation rules that reference the returned evaluator family using `name` and `
|
|
18537
|
+
* 4. Create one or more evaluation rules that reference the returned evaluator family using `name` and `type`.
|
|
16371
18538
|
*
|
|
16372
18539
|
* Code evaluator validation:
|
|
16373
18540
|
* - At creation, Langfuse only validates the request shape
|
|
@@ -16382,6 +18549,8 @@ var Evaluators = class {
|
|
|
16382
18549
|
* Unstable API note:
|
|
16383
18550
|
* - This surface may evolve while the underlying evaluation data model is being redesigned.
|
|
16384
18551
|
*
|
|
18552
|
+
* @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.
|
|
18553
|
+
*
|
|
16385
18554
|
* @param {LangfuseAPI.unstable.CreateEvaluatorRequest} request
|
|
16386
18555
|
* @param {Evaluators.RequestOptions} requestOptions - Request-specific configuration.
|
|
16387
18556
|
*
|
|
@@ -16417,7 +18586,14 @@ var Evaluators = class {
|
|
|
16417
18586
|
* modelConfig: {
|
|
16418
18587
|
* provider: "openai",
|
|
16419
18588
|
* model: "gpt-4.1-mini"
|
|
16420
|
-
* }
|
|
18589
|
+
* },
|
|
18590
|
+
* mapping: [{
|
|
18591
|
+
* variable: "input",
|
|
18592
|
+
* source: "input"
|
|
18593
|
+
* }, {
|
|
18594
|
+
* variable: "output",
|
|
18595
|
+
* source: "output"
|
|
18596
|
+
* }]
|
|
16421
18597
|
* })
|
|
16422
18598
|
*
|
|
16423
18599
|
* @example
|
|
@@ -16572,8 +18748,9 @@ var Evaluators = class {
|
|
|
16572
18748
|
*
|
|
16573
18749
|
* Important behavior:
|
|
16574
18750
|
* - This endpoint returns the latest version of each available evaluator.
|
|
16575
|
-
* -
|
|
16576
|
-
*
|
|
18751
|
+
* - Every evaluator is owned by the authenticated project.
|
|
18752
|
+
*
|
|
18753
|
+
* @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.
|
|
16577
18754
|
*
|
|
16578
18755
|
* @param {LangfuseAPI.unstable.ListEvaluatorsRequest} request
|
|
16579
18756
|
* @param {Evaluators.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -16722,7 +18899,9 @@ var Evaluators = class {
|
|
|
16722
18899
|
/**
|
|
16723
18900
|
* Get one evaluator by `id`.
|
|
16724
18901
|
*
|
|
16725
|
-
* Use
|
|
18902
|
+
* 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.
|
|
18903
|
+
*
|
|
18904
|
+
* @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.
|
|
16726
18905
|
*
|
|
16727
18906
|
* @param {string} evaluatorId - Evaluator identifier returned by the evaluator endpoints.
|
|
16728
18907
|
* @param {Evaluators.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -16870,11 +19049,12 @@ var Evaluators = class {
|
|
|
16870
19049
|
* Delete an evaluator.
|
|
16871
19050
|
*
|
|
16872
19051
|
* Important behavior:
|
|
16873
|
-
* - This deletes the evaluator including all of its stored versions
|
|
16874
|
-
* -
|
|
16875
|
-
* - Langfuse-managed evaluators (`scope=managed`) cannot be deleted; the API returns `403`.
|
|
19052
|
+
* - This deletes the evaluator including all of its stored versions.
|
|
19053
|
+
* - Evaluation rule assignments referencing the evaluator are also deleted.
|
|
16876
19054
|
* - Scores already produced by the evaluator are not deleted.
|
|
16877
19055
|
*
|
|
19056
|
+
* @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.
|
|
19057
|
+
*
|
|
16878
19058
|
* @param {string} evaluatorId - Evaluator identifier returned by the evaluator endpoints.
|
|
16879
19059
|
* @param {Evaluators.RequestOptions} requestOptions - Request-specific configuration.
|
|
16880
19060
|
*
|
|
@@ -16883,7 +19063,6 @@ var Evaluators = class {
|
|
|
16883
19063
|
* @throws {@link LangfuseAPI.unstable.AccessDeniedError}
|
|
16884
19064
|
* @throws {@link LangfuseAPI.unstable.NotFoundError}
|
|
16885
19065
|
* @throws {@link LangfuseAPI.unstable.MethodNotAllowedError}
|
|
16886
|
-
* @throws {@link LangfuseAPI.unstable.ConflictError}
|
|
16887
19066
|
* @throws {@link LangfuseAPI.unstable.TooManyRequestsError}
|
|
16888
19067
|
* @throws {@link LangfuseAPI.unstable.InternalServerError}
|
|
16889
19068
|
* @throws {@link LangfuseAPI.Error}
|
|
@@ -16957,11 +19136,6 @@ var Evaluators = class {
|
|
|
16957
19136
|
_response.error.body,
|
|
16958
19137
|
_response.rawResponse
|
|
16959
19138
|
);
|
|
16960
|
-
case 409:
|
|
16961
|
-
throw new unstable_exports.ConflictError(
|
|
16962
|
-
_response.error.body,
|
|
16963
|
-
_response.rawResponse
|
|
16964
|
-
);
|
|
16965
19139
|
case 429:
|
|
16966
19140
|
throw new unstable_exports.TooManyRequestsError(
|
|
16967
19141
|
_response.error.body,
|
|
@@ -17051,11 +19225,11 @@ var Unstable = class {
|
|
|
17051
19225
|
}
|
|
17052
19226
|
get evaluationRules() {
|
|
17053
19227
|
var _a2;
|
|
17054
|
-
return (_a2 = this._evaluationRules) != null ? _a2 : this._evaluationRules = new
|
|
19228
|
+
return (_a2 = this._evaluationRules) != null ? _a2 : this._evaluationRules = new EvaluationRules2(this._options);
|
|
17055
19229
|
}
|
|
17056
19230
|
get evaluators() {
|
|
17057
19231
|
var _a2;
|
|
17058
|
-
return (_a2 = this._evaluators) != null ? _a2 : this._evaluators = new
|
|
19232
|
+
return (_a2 = this._evaluators) != null ? _a2 : this._evaluators = new Evaluators2(this._options);
|
|
17059
19233
|
}
|
|
17060
19234
|
};
|
|
17061
19235
|
|
|
@@ -17100,6 +19274,14 @@ var LangfuseAPIClient = class {
|
|
|
17100
19274
|
var _a2;
|
|
17101
19275
|
return (_a2 = this._datasets) != null ? _a2 : this._datasets = new Datasets(this._options);
|
|
17102
19276
|
}
|
|
19277
|
+
get evaluationRules() {
|
|
19278
|
+
var _a2;
|
|
19279
|
+
return (_a2 = this._evaluationRules) != null ? _a2 : this._evaluationRules = new EvaluationRules(this._options);
|
|
19280
|
+
}
|
|
19281
|
+
get evaluators() {
|
|
19282
|
+
var _a2;
|
|
19283
|
+
return (_a2 = this._evaluators) != null ? _a2 : this._evaluators = new Evaluators(this._options);
|
|
19284
|
+
}
|
|
17103
19285
|
get experiments() {
|
|
17104
19286
|
var _a2;
|
|
17105
19287
|
return (_a2 = this._experiments) != null ? _a2 : this._experiments = new Experiments(this._options);
|
|
@@ -18091,6 +20273,7 @@ export {
|
|
|
18091
20273
|
AccessDeniedError,
|
|
18092
20274
|
AnnotationQueueObjectType,
|
|
18093
20275
|
AnnotationQueueStatus,
|
|
20276
|
+
BadRequestError,
|
|
18094
20277
|
BlobStorageExportFieldGroup,
|
|
18095
20278
|
BlobStorageExportFrequency,
|
|
18096
20279
|
BlobStorageExportMode,
|
|
@@ -18100,15 +20283,31 @@ export {
|
|
|
18100
20283
|
BlobStorageIntegrationType,
|
|
18101
20284
|
BlobStorageSyncStatus,
|
|
18102
20285
|
ChatMessageType,
|
|
20286
|
+
CodeEvaluatorSourceCodeLanguage,
|
|
18103
20287
|
CommentObjectType,
|
|
20288
|
+
ConflictError,
|
|
18104
20289
|
CreateChatPromptType,
|
|
18105
20290
|
CreateScoreSource,
|
|
18106
20291
|
CreateTextPromptType,
|
|
18107
20292
|
DatasetItemMediaReferenceField,
|
|
18108
20293
|
DatasetStatus,
|
|
18109
20294
|
Error2 as Error,
|
|
20295
|
+
EvaluationAccessDeniedError,
|
|
20296
|
+
EvaluationMethodNotAllowedError,
|
|
20297
|
+
EvaluationNotFoundError,
|
|
20298
|
+
EvaluationRuleArrayOptionsFilterOperator,
|
|
20299
|
+
EvaluationRuleBooleanFilterOperator,
|
|
20300
|
+
EvaluationRuleNullFilterOperator,
|
|
20301
|
+
EvaluationRuleNumberFilterOperator,
|
|
20302
|
+
EvaluationRuleOptionsFilterOperator,
|
|
20303
|
+
EvaluationRuleStringFilterOperator,
|
|
20304
|
+
EvaluationUnauthorizedError,
|
|
20305
|
+
EvaluatorOutputScoreType,
|
|
20306
|
+
EvaluatorStatus,
|
|
20307
|
+
EvaluatorType,
|
|
18110
20308
|
FeedbackNotConfiguredError,
|
|
18111
20309
|
FeedbackTargetType,
|
|
20310
|
+
InternalServerError,
|
|
18112
20311
|
LANGFUSE_SDK_EXPERIMENT_ENVIRONMENT,
|
|
18113
20312
|
LANGFUSE_SDK_NAME,
|
|
18114
20313
|
LANGFUSE_SDK_VERSION,
|
|
@@ -18121,23 +20320,30 @@ export {
|
|
|
18121
20320
|
LangfuseMediaReference,
|
|
18122
20321
|
LangfuseOtelContextKeys,
|
|
18123
20322
|
LangfuseOtelSpanAttributes,
|
|
20323
|
+
LegacyEvaluationObject,
|
|
18124
20324
|
LlmAdapter,
|
|
18125
20325
|
LogLevel,
|
|
18126
20326
|
Logger,
|
|
18127
20327
|
MediaContentType,
|
|
18128
20328
|
MembershipRole,
|
|
18129
20329
|
MethodNotAllowedError,
|
|
20330
|
+
ModelTokenizerId,
|
|
18130
20331
|
ModelUsageUnit,
|
|
18131
20332
|
NotFoundError,
|
|
18132
20333
|
ObservationLevel,
|
|
18133
20334
|
ObservationType,
|
|
18134
20335
|
PlaceholderMessageType,
|
|
20336
|
+
PreconditionFailedError,
|
|
20337
|
+
PricingTierAttributeSource,
|
|
18135
20338
|
PricingTierOperator,
|
|
18136
20339
|
PromptType,
|
|
20340
|
+
PromptVariableMappingSource,
|
|
20341
|
+
PublicApiErrorCode,
|
|
18137
20342
|
ScoreConfigDataType,
|
|
18138
20343
|
ScoreDataType,
|
|
18139
20344
|
ScoreSource,
|
|
18140
20345
|
ServiceUnavailableError,
|
|
20346
|
+
TooManyRequestsError,
|
|
18141
20347
|
UnauthorizedError,
|
|
18142
20348
|
annotationQueues_exports as annotationQueues,
|
|
18143
20349
|
base64Decode,
|
|
@@ -18154,6 +20360,10 @@ export {
|
|
|
18154
20360
|
datasetItems_exports as datasetItems,
|
|
18155
20361
|
datasetRunItems_exports as datasetRunItems,
|
|
18156
20362
|
datasets_exports as datasets,
|
|
20363
|
+
evaluationCommons_exports as evaluationCommons,
|
|
20364
|
+
evaluationErrors_exports as evaluationErrors,
|
|
20365
|
+
evaluationRules_exports as evaluationRules,
|
|
20366
|
+
evaluators_exports as evaluators,
|
|
18157
20367
|
experiments_exports as experiments,
|
|
18158
20368
|
feedback_exports as feedback,
|
|
18159
20369
|
generateUUID,
|