@wix/evalforge-types 0.61.0 → 0.62.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +80 -3
- package/build/index.js.map +2 -2
- package/build/index.mjs +78 -3
- package/build/index.mjs.map +2 -2
- package/build/types/assertion/assertion.d.ts +69 -1
- package/build/types/assertion/system-assertions.d.ts +1 -0
- package/build/types/scenario/test-scenario.d.ts +39 -3
- package/package.json +2 -2
package/build/index.js
CHANGED
|
@@ -33,6 +33,8 @@ __export(index_exports, {
|
|
|
33
33
|
AgentTypeSchema: () => AgentTypeSchema,
|
|
34
34
|
AllowedCommands: () => AllowedCommands,
|
|
35
35
|
AnyModelSchema: () => AnyModelSchema,
|
|
36
|
+
ApiCallAssertionSchema: () => ApiCallAssertionSchema,
|
|
37
|
+
ApiCallConfigSchema: () => ApiCallConfigSchema,
|
|
36
38
|
ApiCallSchema: () => ApiCallSchema,
|
|
37
39
|
AssertionConfigSchema: () => AssertionConfigSchema,
|
|
38
40
|
AssertionParameterSchema: () => AssertionParameterSchema,
|
|
@@ -790,7 +792,8 @@ var AssertionTypeSchema = import_zod22.z.enum([
|
|
|
790
792
|
"build_passed",
|
|
791
793
|
"time_limit",
|
|
792
794
|
"cost",
|
|
793
|
-
"llm_judge"
|
|
795
|
+
"llm_judge",
|
|
796
|
+
"api_call"
|
|
794
797
|
]);
|
|
795
798
|
var AssertionParameterTypeSchema = import_zod22.z.enum([
|
|
796
799
|
"string",
|
|
@@ -869,6 +872,20 @@ var LlmJudgeConfigSchema = import_zod22.z.object({
|
|
|
869
872
|
/** User-defined parameters for this assertion */
|
|
870
873
|
parameters: import_zod22.z.array(AssertionParameterSchema).optional()
|
|
871
874
|
});
|
|
875
|
+
var ApiCallConfigSchema = import_zod22.z.strictObject({
|
|
876
|
+
/** URL to call */
|
|
877
|
+
url: import_zod22.z.string().min(1),
|
|
878
|
+
/** HTTP method (default GET) */
|
|
879
|
+
method: import_zod22.z.enum(["GET", "POST"]).optional(),
|
|
880
|
+
/** Request body (JSON string, for POST requests) */
|
|
881
|
+
requestBody: import_zod22.z.string().optional(),
|
|
882
|
+
/** Expected JSON response to validate against (subset match — extra fields in actual are OK) */
|
|
883
|
+
expectedResponse: import_zod22.z.string().min(1),
|
|
884
|
+
/** Request headers as JSON string of key-value pairs */
|
|
885
|
+
requestHeaders: import_zod22.z.string().optional(),
|
|
886
|
+
/** Request timeout in milliseconds (default 30000) */
|
|
887
|
+
timeoutMs: import_zod22.z.number().int().positive().optional()
|
|
888
|
+
});
|
|
872
889
|
var AssertionBaseFields = {
|
|
873
890
|
/** When true, the assertion's pass/fail logic is inverted (NOT operator). */
|
|
874
891
|
negate: import_zod22.z.boolean().optional()
|
|
@@ -893,6 +910,10 @@ var LlmJudgeAssertionSchema = LlmJudgeConfigSchema.extend({
|
|
|
893
910
|
type: import_zod22.z.literal("llm_judge"),
|
|
894
911
|
...AssertionBaseFields
|
|
895
912
|
});
|
|
913
|
+
var ApiCallAssertionSchema = ApiCallConfigSchema.extend({
|
|
914
|
+
type: import_zod22.z.literal("api_call"),
|
|
915
|
+
...AssertionBaseFields
|
|
916
|
+
});
|
|
896
917
|
var TimeAssertionSchema = TimeConfigSchema.extend({
|
|
897
918
|
type: import_zod22.z.literal("time_limit"),
|
|
898
919
|
...AssertionBaseFields
|
|
@@ -903,7 +924,8 @@ var AssertionSchema = import_zod22.z.union([
|
|
|
903
924
|
BuildPassedAssertionSchema,
|
|
904
925
|
TimeAssertionSchema,
|
|
905
926
|
CostAssertionSchema,
|
|
906
|
-
LlmJudgeAssertionSchema
|
|
927
|
+
LlmJudgeAssertionSchema,
|
|
928
|
+
ApiCallAssertionSchema
|
|
907
929
|
]);
|
|
908
930
|
var AssertionConfigSchema = import_zod22.z.union([
|
|
909
931
|
LlmJudgeConfigSchema,
|
|
@@ -912,6 +934,8 @@ var AssertionConfigSchema = import_zod22.z.union([
|
|
|
912
934
|
// requires skillNames
|
|
913
935
|
ToolCalledWithParamConfigSchema,
|
|
914
936
|
// requires toolName, uses strictObject
|
|
937
|
+
ApiCallConfigSchema,
|
|
938
|
+
// requires url + expectedResponse, uses strictObject
|
|
915
939
|
TimeConfigSchema,
|
|
916
940
|
// requires maxDurationMs, uses strictObject
|
|
917
941
|
CostConfigSchema,
|
|
@@ -935,6 +959,8 @@ function validateAssertionConfig(type, config) {
|
|
|
935
959
|
return TimeConfigSchema.safeParse(config).success;
|
|
936
960
|
case "llm_judge":
|
|
937
961
|
return LlmJudgeConfigSchema.safeParse(config).success;
|
|
962
|
+
case "api_call":
|
|
963
|
+
return ApiCallConfigSchema.safeParse(config).success;
|
|
938
964
|
default:
|
|
939
965
|
return false;
|
|
940
966
|
}
|
|
@@ -1606,7 +1632,8 @@ var SYSTEM_ASSERTION_IDS = {
|
|
|
1606
1632
|
BUILD_PASSED: "system:build_passed",
|
|
1607
1633
|
TIME_LIMIT: "system:time_limit",
|
|
1608
1634
|
COST: "system:cost",
|
|
1609
|
-
LLM_JUDGE: "system:llm_judge"
|
|
1635
|
+
LLM_JUDGE: "system:llm_judge",
|
|
1636
|
+
API_CALL: "system:api_call"
|
|
1610
1637
|
};
|
|
1611
1638
|
function isSystemAssertionId(id) {
|
|
1612
1639
|
return id.startsWith("system:");
|
|
@@ -1761,6 +1788,54 @@ var SYSTEM_ASSERTIONS = {
|
|
|
1761
1788
|
required: false
|
|
1762
1789
|
}
|
|
1763
1790
|
]
|
|
1791
|
+
},
|
|
1792
|
+
[SYSTEM_ASSERTION_IDS.API_CALL]: {
|
|
1793
|
+
id: SYSTEM_ASSERTION_IDS.API_CALL,
|
|
1794
|
+
name: "API Call",
|
|
1795
|
+
description: "Call an API endpoint and verify the response contains expected data",
|
|
1796
|
+
type: "api_call",
|
|
1797
|
+
parameters: [
|
|
1798
|
+
{
|
|
1799
|
+
name: "url",
|
|
1800
|
+
label: "URL",
|
|
1801
|
+
type: "string",
|
|
1802
|
+
required: true
|
|
1803
|
+
},
|
|
1804
|
+
{
|
|
1805
|
+
name: "method",
|
|
1806
|
+
label: "HTTP Method",
|
|
1807
|
+
type: "string",
|
|
1808
|
+
required: false,
|
|
1809
|
+
defaultValue: "GET"
|
|
1810
|
+
},
|
|
1811
|
+
{
|
|
1812
|
+
name: "requestBody",
|
|
1813
|
+
label: "Request Body (JSON)",
|
|
1814
|
+
type: "string",
|
|
1815
|
+
required: false
|
|
1816
|
+
},
|
|
1817
|
+
{
|
|
1818
|
+
name: "expectedResponse",
|
|
1819
|
+
label: "Expected Response (JSON)",
|
|
1820
|
+
type: "string",
|
|
1821
|
+
required: true
|
|
1822
|
+
},
|
|
1823
|
+
{
|
|
1824
|
+
name: "requestHeaders",
|
|
1825
|
+
label: "Headers (JSON)",
|
|
1826
|
+
type: "string",
|
|
1827
|
+
required: false,
|
|
1828
|
+
advanced: true
|
|
1829
|
+
},
|
|
1830
|
+
{
|
|
1831
|
+
name: "timeoutMs",
|
|
1832
|
+
label: "Timeout (ms)",
|
|
1833
|
+
type: "number",
|
|
1834
|
+
required: false,
|
|
1835
|
+
defaultValue: 3e4,
|
|
1836
|
+
advanced: true
|
|
1837
|
+
}
|
|
1838
|
+
]
|
|
1764
1839
|
}
|
|
1765
1840
|
};
|
|
1766
1841
|
function getSystemAssertions() {
|
|
@@ -1784,6 +1859,8 @@ function getSystemAssertion(id) {
|
|
|
1784
1859
|
AgentTypeSchema,
|
|
1785
1860
|
AllowedCommands,
|
|
1786
1861
|
AnyModelSchema,
|
|
1862
|
+
ApiCallAssertionSchema,
|
|
1863
|
+
ApiCallConfigSchema,
|
|
1787
1864
|
ApiCallSchema,
|
|
1788
1865
|
AssertionConfigSchema,
|
|
1789
1866
|
AssertionParameterSchema,
|