@arizeai/phoenix-evals 0.7.0 → 0.9.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.
Files changed (107) hide show
  1. package/dist/esm/__generated__/default_templates/FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.d.ts +3 -0
  2. package/dist/esm/__generated__/default_templates/FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.d.ts.map +1 -0
  3. package/dist/esm/__generated__/default_templates/FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.js +33 -0
  4. package/dist/esm/__generated__/default_templates/FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.js.map +1 -0
  5. package/dist/esm/__generated__/default_templates/TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG.d.ts +3 -0
  6. package/dist/esm/__generated__/default_templates/TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG.d.ts.map +1 -0
  7. package/dist/esm/__generated__/default_templates/TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG.js +30 -0
  8. package/dist/esm/__generated__/default_templates/TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG.js.map +1 -0
  9. package/dist/esm/__generated__/default_templates/TOOL_RESPONSE_HANDLING_CLASSIFICATION_EVALUATOR_CONFIG.d.ts +3 -0
  10. package/dist/esm/__generated__/default_templates/TOOL_RESPONSE_HANDLING_CLASSIFICATION_EVALUATOR_CONFIG.d.ts.map +1 -0
  11. package/dist/esm/__generated__/default_templates/TOOL_RESPONSE_HANDLING_CLASSIFICATION_EVALUATOR_CONFIG.js +86 -0
  12. package/dist/esm/__generated__/default_templates/TOOL_RESPONSE_HANDLING_CLASSIFICATION_EVALUATOR_CONFIG.js.map +1 -0
  13. package/dist/esm/__generated__/default_templates/index.d.ts +3 -0
  14. package/dist/esm/__generated__/default_templates/index.d.ts.map +1 -1
  15. package/dist/esm/__generated__/default_templates/index.js +3 -0
  16. package/dist/esm/__generated__/default_templates/index.js.map +1 -1
  17. package/dist/esm/core/EvaluatorBase.d.ts.map +1 -1
  18. package/dist/esm/llm/createCorrectnessEvaluator.d.ts.map +1 -1
  19. package/dist/esm/llm/createDocumentRelevanceEvaluator.d.ts.map +1 -1
  20. package/dist/esm/llm/createDocumentRelevanceEvaluator.js.map +1 -1
  21. package/dist/esm/llm/createFaithfulnessEvaluator.d.ts +24 -0
  22. package/dist/esm/llm/createFaithfulnessEvaluator.d.ts.map +1 -0
  23. package/dist/esm/llm/createFaithfulnessEvaluator.js +19 -0
  24. package/dist/esm/llm/createFaithfulnessEvaluator.js.map +1 -0
  25. package/dist/esm/llm/createHallucinationEvaluator.d.ts +12 -0
  26. package/dist/esm/llm/createHallucinationEvaluator.d.ts.map +1 -1
  27. package/dist/esm/llm/createHallucinationEvaluator.js +17 -0
  28. package/dist/esm/llm/createHallucinationEvaluator.js.map +1 -1
  29. package/dist/esm/llm/createToolInvocationEvaluator.d.ts +74 -0
  30. package/dist/esm/llm/createToolInvocationEvaluator.d.ts.map +1 -0
  31. package/dist/esm/llm/createToolInvocationEvaluator.js +60 -0
  32. package/dist/esm/llm/createToolInvocationEvaluator.js.map +1 -0
  33. package/dist/esm/llm/createToolResponseHandlingEvaluator.d.ts +78 -0
  34. package/dist/esm/llm/createToolResponseHandlingEvaluator.d.ts.map +1 -0
  35. package/dist/esm/llm/createToolResponseHandlingEvaluator.js +59 -0
  36. package/dist/esm/llm/createToolResponseHandlingEvaluator.js.map +1 -0
  37. package/dist/esm/llm/createToolSelectionEvaluator.d.ts +64 -0
  38. package/dist/esm/llm/createToolSelectionEvaluator.d.ts.map +1 -0
  39. package/dist/esm/llm/createToolSelectionEvaluator.js +50 -0
  40. package/dist/esm/llm/createToolSelectionEvaluator.js.map +1 -0
  41. package/dist/esm/llm/index.d.ts +9 -5
  42. package/dist/esm/llm/index.d.ts.map +1 -1
  43. package/dist/esm/llm/index.js +9 -5
  44. package/dist/esm/llm/index.js.map +1 -1
  45. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  46. package/dist/esm/types/evals.d.ts.map +1 -1
  47. package/dist/src/__generated__/default_templates/FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.d.ts +3 -0
  48. package/dist/src/__generated__/default_templates/FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.d.ts.map +1 -0
  49. package/dist/src/__generated__/default_templates/FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.js +36 -0
  50. package/dist/src/__generated__/default_templates/FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.js.map +1 -0
  51. package/dist/src/__generated__/default_templates/TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG.d.ts +3 -0
  52. package/dist/src/__generated__/default_templates/TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG.d.ts.map +1 -0
  53. package/dist/src/__generated__/default_templates/TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG.js +33 -0
  54. package/dist/src/__generated__/default_templates/TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG.js.map +1 -0
  55. package/dist/src/__generated__/default_templates/TOOL_RESPONSE_HANDLING_CLASSIFICATION_EVALUATOR_CONFIG.d.ts +3 -0
  56. package/dist/src/__generated__/default_templates/TOOL_RESPONSE_HANDLING_CLASSIFICATION_EVALUATOR_CONFIG.d.ts.map +1 -0
  57. package/dist/src/__generated__/default_templates/TOOL_RESPONSE_HANDLING_CLASSIFICATION_EVALUATOR_CONFIG.js +89 -0
  58. package/dist/src/__generated__/default_templates/TOOL_RESPONSE_HANDLING_CLASSIFICATION_EVALUATOR_CONFIG.js.map +1 -0
  59. package/dist/src/__generated__/default_templates/index.d.ts +3 -0
  60. package/dist/src/__generated__/default_templates/index.d.ts.map +1 -1
  61. package/dist/src/__generated__/default_templates/index.js +7 -1
  62. package/dist/src/__generated__/default_templates/index.js.map +1 -1
  63. package/dist/src/core/EvaluatorBase.d.ts.map +1 -1
  64. package/dist/src/llm/createCorrectnessEvaluator.d.ts.map +1 -1
  65. package/dist/src/llm/createDocumentRelevanceEvaluator.d.ts.map +1 -1
  66. package/dist/src/llm/createDocumentRelevanceEvaluator.js.map +1 -1
  67. package/dist/src/llm/createFaithfulnessEvaluator.d.ts +24 -0
  68. package/dist/src/llm/createFaithfulnessEvaluator.d.ts.map +1 -0
  69. package/dist/src/llm/createFaithfulnessEvaluator.js +30 -0
  70. package/dist/src/llm/createFaithfulnessEvaluator.js.map +1 -0
  71. package/dist/src/llm/createHallucinationEvaluator.d.ts +12 -0
  72. package/dist/src/llm/createHallucinationEvaluator.d.ts.map +1 -1
  73. package/dist/src/llm/createHallucinationEvaluator.js +17 -0
  74. package/dist/src/llm/createHallucinationEvaluator.js.map +1 -1
  75. package/dist/src/llm/createToolInvocationEvaluator.d.ts +74 -0
  76. package/dist/src/llm/createToolInvocationEvaluator.d.ts.map +1 -0
  77. package/dist/src/llm/createToolInvocationEvaluator.js +71 -0
  78. package/dist/src/llm/createToolInvocationEvaluator.js.map +1 -0
  79. package/dist/src/llm/createToolResponseHandlingEvaluator.d.ts +78 -0
  80. package/dist/src/llm/createToolResponseHandlingEvaluator.d.ts.map +1 -0
  81. package/dist/src/llm/createToolResponseHandlingEvaluator.js +70 -0
  82. package/dist/src/llm/createToolResponseHandlingEvaluator.js.map +1 -0
  83. package/dist/src/llm/createToolSelectionEvaluator.d.ts +64 -0
  84. package/dist/src/llm/createToolSelectionEvaluator.d.ts.map +1 -0
  85. package/dist/src/llm/createToolSelectionEvaluator.js +61 -0
  86. package/dist/src/llm/createToolSelectionEvaluator.js.map +1 -0
  87. package/dist/src/llm/index.d.ts +9 -5
  88. package/dist/src/llm/index.d.ts.map +1 -1
  89. package/dist/src/llm/index.js +9 -5
  90. package/dist/src/llm/index.js.map +1 -1
  91. package/dist/src/types/evals.d.ts.map +1 -1
  92. package/dist/tsconfig.tsbuildinfo +1 -1
  93. package/package.json +1 -1
  94. package/src/__generated__/default_templates/FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.ts +35 -0
  95. package/src/__generated__/default_templates/TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG.ts +32 -0
  96. package/src/__generated__/default_templates/TOOL_RESPONSE_HANDLING_CLASSIFICATION_EVALUATOR_CONFIG.ts +88 -0
  97. package/src/__generated__/default_templates/index.ts +3 -0
  98. package/src/core/EvaluatorBase.ts +3 -3
  99. package/src/llm/createCorrectnessEvaluator.ts +3 -3
  100. package/src/llm/createDocumentRelevanceEvaluator.ts +7 -11
  101. package/src/llm/createFaithfulnessEvaluator.ts +52 -0
  102. package/src/llm/createHallucinationEvaluator.ts +25 -3
  103. package/src/llm/createToolInvocationEvaluator.ts +103 -0
  104. package/src/llm/createToolResponseHandlingEvaluator.ts +109 -0
  105. package/src/llm/createToolSelectionEvaluator.ts +93 -0
  106. package/src/llm/index.ts +9 -5
  107. package/src/types/evals.ts +5 -4
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ // This file is generated. Do not edit by hand.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG = void 0;
5
+ exports.FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG = {
6
+ name: "faithfulness",
7
+ description: "A specialized evaluator for detecting faithfulness in grounded LLM responses.",
8
+ optimizationDirection: "MAXIMIZE",
9
+ template: [
10
+ {
11
+ role: "user",
12
+ content: `
13
+ In this task, you will be presented with a query, some context and a response. The response is generated to the question based on the context. The response may contain false information. You must use the context to determine if the response to the question contains false information, if the response is unfaithful to the facts. Your objective is to determine whether the response text contains factual information and is faithful to the context. An 'unfaithful' response refers to a response that is not based on the context or assumes information that is not available in the context. Your response should be a single word: either 'faithful' or 'unfaithful', and it should not include any other text or characters. 'unfaithful' indicates that the response provides factually inaccurate information to the query based on the context. 'faithful' indicates that the response to the question is correct relative to the context, and does not contain made up information. Please read the query and context carefully before determining your response.
14
+
15
+ <data>
16
+ <query>
17
+ {{input}}
18
+ </query>
19
+ <context>
20
+ {{context}}
21
+ </context>
22
+ <response>
23
+ {{output}}
24
+ </response>
25
+ </data>
26
+
27
+ Is the response above faithful or unfaithful based on the query and context?
28
+ `,
29
+ },
30
+ ],
31
+ choices: {
32
+ "faithful": 1,
33
+ "unfaithful": 0
34
+ },
35
+ };
36
+ //# sourceMappingURL=FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.js","sourceRoot":"","sources":["../../../../src/__generated__/default_templates/FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.ts"],"names":[],"mappings":";AAAA,+CAA+C;;;AAIlC,QAAA,4CAA4C,GAAkC;IACzF,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,+EAA+E;IAC5F,qBAAqB,EAAE,UAAU;IACjC,QAAQ,EAAE;QACR;YACE,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE;;;;;;;;;;;;;;;;CAgBd;SACI;KACF;IACD,OAAO,EAAE;QACT,UAAU,EAAE,CAAC;QACb,YAAY,EAAE,CAAC;KAChB;CACA,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { ClassificationEvaluatorConfig } from "../types";
2
+ export declare const TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG: ClassificationEvaluatorConfig;
3
+ //# sourceMappingURL=TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG.d.ts","sourceRoot":"","sources":["../../../../src/__generated__/default_templates/TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAE9D,eAAO,MAAM,+CAA+C,EAAE,6BA2B7D,CAAC"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ // This file is generated. Do not edit by hand.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG = void 0;
5
+ exports.TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG = {
6
+ name: "tool_invocation",
7
+ description: "For determining if a tool was invoked correctly with proper arguments, formatting, and safe content. Requires conversation context, available tool schemas, and the LLM's tool invocation(s).",
8
+ optimizationDirection: "MAXIMIZE",
9
+ template: [
10
+ {
11
+ role: "user",
12
+ content: `
13
+ You are an impartial judge evaluating an LLM's tool-calling behavior, specifically whether the LLM invoked a tool (or tools) correctly with valid arguments and proper formatting.
14
+ Your task: Determine whether the LLM's tool invocation(s) were correct or incorrect based on: - The full conversation context (including all previous turns, not just the most recent message) - The available tool schemas - The LLM's tool invocation(s) with arguments
15
+ IMPORTANT - Tool Invocation vs. Tool Selection: - You are ONLY evaluating the tool invocation, not the tool selection. - If the tool selection is incorrect or not relevant to the user's query, but the tool invocation is correct, return "correct". - If the tool selection is correct but the tool invocation is incorrect, return "incorrect".
16
+ IMPORTANT - Multi-Tool Invocations: - The LLM may invoke MULTIPLE tools in a single response. This is valid and expected for complex requests. - When multiple tools are invoked, evaluate EACH tool invocation independently. - Return "correct" only if ALL tool invocations are correct. - Return "incorrect" if ANY tool invocation has an error.
17
+ IMPORTANT - Conversation Context: - Read the entire conversation history carefully, not just the final user message. - Argument values may need to be extracted from EARLIER turns in the conversation (e.g., user mentions a location, date, or quantity in a previous message). - The LLM should use context from the full conversation to populate argument values correctly.
18
+ Criteria Return "correct" only when ALL of the following are true for EVERY tool invocation: - JSON is properly structured (if applicable). - All required fields/parameters are present. - No hallucinated or nonexistent fields (all fields exist in the tool schema). - Argument values match the user's intent from the conversation context (correct types, realistic values). - No unsafe content (e.g., PII like SSNs, credit card numbers, passwords) in arguments.
19
+ Return "incorrect" if ANY of the following are true for ANY tool invocation: - The invocation contains hallucinated or nonexistent fields not in the schema. - Required fields/parameters are missing. - JSON is improperly formatted or malformed. - Argument values are incorrect, hallucinated, or do not match user intent from the conversation. - Arguments contain unsafe content (e.g., PII, sensitive data that should not be passed).
20
+ Before providing your final judgment, explain your reasoning and consider: - How many tools were invoked? Evaluate each one. - Does each tool invocation match the schema for that tool? - Are all required parameters provided with appropriate values for each invocation? - Are there any extra fields that don't exist in the schema? - Looking at the FULL conversation: do the argument values accurately reflect what the user requested across all messages? - Is there any unsafe or sensitive content in any of the arguments? - Check that you are not evaluating the tool selection, only the tool invocation.
21
+ <data> <context> {{input}} </context>
22
+ <available_tools> {{availableTools}} </available_tools>
23
+ <tool_invocation> {{toolSelection}} </tool_invocation> </data>
24
+ Given the above data, is the tool invocation correct or incorrect?
25
+ `,
26
+ },
27
+ ],
28
+ choices: {
29
+ "correct": 1,
30
+ "incorrect": 0
31
+ },
32
+ };
33
+ //# sourceMappingURL=TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG.js","sourceRoot":"","sources":["../../../../src/__generated__/default_templates/TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG.ts"],"names":[],"mappings":";AAAA,+CAA+C;;;AAIlC,QAAA,+CAA+C,GAAkC;IAC5F,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,+LAA+L;IAC5M,qBAAqB,EAAE,UAAU;IACjC,QAAQ,EAAE;QACR;YACE,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE;;;;;;;;;;;;;CAad;SACI;KACF;IACD,OAAO,EAAE;QACT,SAAS,EAAE,CAAC;QACZ,WAAW,EAAE,CAAC;KACf;CACA,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { ClassificationEvaluatorConfig } from "../types";
2
+ export declare const TOOL_RESPONSE_HANDLING_CLASSIFICATION_EVALUATOR_CONFIG: ClassificationEvaluatorConfig;
3
+ //# sourceMappingURL=TOOL_RESPONSE_HANDLING_CLASSIFICATION_EVALUATOR_CONFIG.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TOOL_RESPONSE_HANDLING_CLASSIFICATION_EVALUATOR_CONFIG.d.ts","sourceRoot":"","sources":["../../../../src/__generated__/default_templates/TOOL_RESPONSE_HANDLING_CLASSIFICATION_EVALUATOR_CONFIG.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAE9D,eAAO,MAAM,sDAAsD,EAAE,6BAmFpE,CAAC"}
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ // This file is generated. Do not edit by hand.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.TOOL_RESPONSE_HANDLING_CLASSIFICATION_EVALUATOR_CONFIG = void 0;
5
+ exports.TOOL_RESPONSE_HANDLING_CLASSIFICATION_EVALUATOR_CONFIG = {
6
+ name: "tool_response_handling",
7
+ description: "For determining if an AI agent properly handled a tool's response, including error handling, data extraction, transformation, and safe information disclosure. Requires conversation context, the tool call(s), the tool result(s), and the agent's output.",
8
+ optimizationDirection: "MAXIMIZE",
9
+ template: [
10
+ {
11
+ role: "user",
12
+ content: `
13
+ You are an impartial judge evaluating an AI agent's handling of a tool's response. Your task is to determine whether the agent correctly processed the tool result to produce an appropriate output.
14
+
15
+ IMPORTANT - Scope of Evaluation:
16
+ - You are ONLY evaluating how the agent handled the tool response, NOT whether the right tool was selected or whether the tool was invoked correctly.
17
+ - This evaluation focuses on what happens AFTER the tool returns a result.
18
+
19
+ IMPORTANT - Multi-Tool Handling:
20
+ - The agent may make MULTIPLE tool calls in a single interaction. This is valid and expected.
21
+ - When multiple tools are called, evaluate how the agent handled ALL tool results together.
22
+ - Return "correct" only if the agent properly handled ALL tool results.
23
+ - Return "incorrect" if the agent mishandled ANY tool result.
24
+
25
+ IMPORTANT - Error Response Handling:
26
+ - Tool results may contain errors (rate limits, timeouts, not found, invalid arguments, etc.).
27
+ - The agent's output may include retries, follow-up tool calls, or a final response to the user.
28
+ - Evaluate the ENTIRE handling sequence, not just the final message.
29
+ - Appropriate error handling includes:
30
+ - Retrying on transient errors (rate limits, timeouts)
31
+ - Correcting arguments after invalid argument errors
32
+ - Informing the user appropriately when errors are not recoverable
33
+ - NOT making repeated identical calls that continue to fail
34
+
35
+ Criteria for CORRECT handling:
36
+ - Data is extracted accurately from the tool result (no hallucination of data that wasn't returned)
37
+ - Dates, numbers, and structured fields are properly transformed and formatted
38
+ - Results are accurately summarized to address the user's original query
39
+ - Error responses are handled appropriately (retries for transient errors, corrections for invalid arguments)
40
+ - No repeated identical calls after non-retryable errors
41
+ - No disclosure of sensitive/internal information (database credentials, internal URLs, PII, API keys, etc.)
42
+ - The agent's response actually uses the tool result rather than ignoring it
43
+
44
+ Criteria for INCORRECT handling:
45
+ - Hallucinated data: The output includes information not present in the tool result
46
+ - Misinterpretation: The meaning of the tool result is misrepresented or reversed
47
+ - Improper transformation: Dates, numbers, or structured data are incorrectly converted
48
+ - Missing retry: Failed to retry on retryable errors (rate limits, timeouts)
49
+ - Missing correction: Failed to correct arguments after invalid argument errors
50
+ - Futile retries: Repeated identical calls that continue to fail
51
+ - Information disclosure: Leaked sensitive information (credentials, internal URLs, PII)
52
+ - Ignored results: The agent's response doesn't incorporate the tool result
53
+ - Incomplete handling: Only some tool results are used when multiple tools were called
54
+
55
+ Before providing your final judgment, explain your reasoning and consider:
56
+ - Does the output accurately reflect what the tool returned?
57
+ - Are there any fabricated details not in the tool result?
58
+ - Were errors handled appropriately?
59
+ - Is sensitive information properly protected?
60
+ - Does the output actually address the user's query using the tool data?
61
+
62
+ <data>
63
+ <input>
64
+ {{input}}
65
+ </input>
66
+
67
+ <tool_call>
68
+ {{toolCall}}
69
+ </tool_call>
70
+
71
+ <tool_result>
72
+ {{toolResult}}
73
+ </tool_result>
74
+
75
+ <output>
76
+ {{output}}
77
+ </output>
78
+ </data>
79
+
80
+ Given the above data, did the agent handle the tool response correctly or incorrectly?
81
+ `,
82
+ },
83
+ ],
84
+ choices: {
85
+ "correct": 1,
86
+ "incorrect": 0
87
+ },
88
+ };
89
+ //# sourceMappingURL=TOOL_RESPONSE_HANDLING_CLASSIFICATION_EVALUATOR_CONFIG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TOOL_RESPONSE_HANDLING_CLASSIFICATION_EVALUATOR_CONFIG.js","sourceRoot":"","sources":["../../../../src/__generated__/default_templates/TOOL_RESPONSE_HANDLING_CLASSIFICATION_EVALUATOR_CONFIG.ts"],"names":[],"mappings":";AAAA,+CAA+C;;;AAIlC,QAAA,sDAAsD,GAAkC;IACnG,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EAAE,6PAA6P;IAC1Q,qBAAqB,EAAE,UAAU;IACjC,QAAQ,EAAE;QACR;YACE,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqEd;SACI;KACF;IACD,OAAO,EAAE;QACT,SAAS,EAAE,CAAC;QACZ,WAAW,EAAE,CAAC;KACf;CACA,CAAC"}
@@ -1,5 +1,8 @@
1
1
  export { CORRECTNESS_CLASSIFICATION_EVALUATOR_CONFIG } from "./CORRECTNESS_CLASSIFICATION_EVALUATOR_CONFIG";
2
2
  export { DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG } from "./DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG";
3
+ export { FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG } from "./FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG";
3
4
  export { HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG } from "./HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG";
5
+ export { TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG } from "./TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG";
6
+ export { TOOL_RESPONSE_HANDLING_CLASSIFICATION_EVALUATOR_CONFIG } from "./TOOL_RESPONSE_HANDLING_CLASSIFICATION_EVALUATOR_CONFIG";
4
7
  export { TOOL_SELECTION_CLASSIFICATION_EVALUATOR_CONFIG } from "./TOOL_SELECTION_CLASSIFICATION_EVALUATOR_CONFIG";
5
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/__generated__/default_templates/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,2CAA2C,EAAE,MAAM,+CAA+C,CAAC;AAC5G,OAAO,EAAE,kDAAkD,EAAE,MAAM,sDAAsD,CAAC;AAC1H,OAAO,EAAE,6CAA6C,EAAE,MAAM,iDAAiD,CAAC;AAChH,OAAO,EAAE,8CAA8C,EAAE,MAAM,kDAAkD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/__generated__/default_templates/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,2CAA2C,EAAE,MAAM,+CAA+C,CAAC;AAC5G,OAAO,EAAE,kDAAkD,EAAE,MAAM,sDAAsD,CAAC;AAC1H,OAAO,EAAE,4CAA4C,EAAE,MAAM,gDAAgD,CAAC;AAC9G,OAAO,EAAE,6CAA6C,EAAE,MAAM,iDAAiD,CAAC;AAChH,OAAO,EAAE,+CAA+C,EAAE,MAAM,mDAAmD,CAAC;AACpH,OAAO,EAAE,sDAAsD,EAAE,MAAM,0DAA0D,CAAC;AAClI,OAAO,EAAE,8CAA8C,EAAE,MAAM,kDAAkD,CAAC"}
@@ -1,13 +1,19 @@
1
1
  "use strict";
2
2
  // This file is generated. Do not edit by hand.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.TOOL_SELECTION_CLASSIFICATION_EVALUATOR_CONFIG = exports.HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG = exports.DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG = exports.CORRECTNESS_CLASSIFICATION_EVALUATOR_CONFIG = void 0;
4
+ exports.TOOL_SELECTION_CLASSIFICATION_EVALUATOR_CONFIG = exports.TOOL_RESPONSE_HANDLING_CLASSIFICATION_EVALUATOR_CONFIG = exports.TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG = exports.HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG = exports.FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG = exports.DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG = exports.CORRECTNESS_CLASSIFICATION_EVALUATOR_CONFIG = void 0;
5
5
  var CORRECTNESS_CLASSIFICATION_EVALUATOR_CONFIG_1 = require("./CORRECTNESS_CLASSIFICATION_EVALUATOR_CONFIG");
6
6
  Object.defineProperty(exports, "CORRECTNESS_CLASSIFICATION_EVALUATOR_CONFIG", { enumerable: true, get: function () { return CORRECTNESS_CLASSIFICATION_EVALUATOR_CONFIG_1.CORRECTNESS_CLASSIFICATION_EVALUATOR_CONFIG; } });
7
7
  var DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG_1 = require("./DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG");
8
8
  Object.defineProperty(exports, "DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG", { enumerable: true, get: function () { return DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG_1.DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG; } });
9
+ var FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG_1 = require("./FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG");
10
+ Object.defineProperty(exports, "FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG", { enumerable: true, get: function () { return FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG_1.FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG; } });
9
11
  var HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG_1 = require("./HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG");
10
12
  Object.defineProperty(exports, "HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG", { enumerable: true, get: function () { return HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG_1.HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG; } });
13
+ var TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG_1 = require("./TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG");
14
+ Object.defineProperty(exports, "TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG", { enumerable: true, get: function () { return TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG_1.TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG; } });
15
+ var TOOL_RESPONSE_HANDLING_CLASSIFICATION_EVALUATOR_CONFIG_1 = require("./TOOL_RESPONSE_HANDLING_CLASSIFICATION_EVALUATOR_CONFIG");
16
+ Object.defineProperty(exports, "TOOL_RESPONSE_HANDLING_CLASSIFICATION_EVALUATOR_CONFIG", { enumerable: true, get: function () { return TOOL_RESPONSE_HANDLING_CLASSIFICATION_EVALUATOR_CONFIG_1.TOOL_RESPONSE_HANDLING_CLASSIFICATION_EVALUATOR_CONFIG; } });
11
17
  var TOOL_SELECTION_CLASSIFICATION_EVALUATOR_CONFIG_1 = require("./TOOL_SELECTION_CLASSIFICATION_EVALUATOR_CONFIG");
12
18
  Object.defineProperty(exports, "TOOL_SELECTION_CLASSIFICATION_EVALUATOR_CONFIG", { enumerable: true, get: function () { return TOOL_SELECTION_CLASSIFICATION_EVALUATOR_CONFIG_1.TOOL_SELECTION_CLASSIFICATION_EVALUATOR_CONFIG; } });
13
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/__generated__/default_templates/index.ts"],"names":[],"mappings":";AAAA,+CAA+C;;;AAE/C,6GAA4G;AAAnG,0KAAA,2CAA2C,OAAA;AACpD,2HAA0H;AAAjH,wLAAA,kDAAkD,OAAA;AAC3D,iHAAgH;AAAvG,8KAAA,6CAA6C,OAAA;AACtD,mHAAkH;AAAzG,gLAAA,8CAA8C,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/__generated__/default_templates/index.ts"],"names":[],"mappings":";AAAA,+CAA+C;;;AAE/C,6GAA4G;AAAnG,0KAAA,2CAA2C,OAAA;AACpD,2HAA0H;AAAjH,wLAAA,kDAAkD,OAAA;AAC3D,+GAA8G;AAArG,4KAAA,4CAA4C,OAAA;AACrD,iHAAgH;AAAvG,8KAAA,6CAA6C,OAAA;AACtD,qHAAoH;AAA3G,kLAAA,+CAA+C,OAAA;AACxD,mIAAkI;AAAzH,gMAAA,sDAAsD,OAAA;AAC/D,mHAAkH;AAAzG,gLAAA,8CAA8C,OAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"EvaluatorBase.d.ts","sourceRoot":"","sources":["../../../src/core/EvaluatorBase.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACrB,eAAe,EAChB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C;;GAEG;AACH,8BAAsB,aAAa,CAAC,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAC5E,YAAW,kBAAkB,CAAC,UAAU,CAAC;IAEzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,qBAAqB,CAAC,EAAE,qBAAqB,CAAC;IACvD,QAAQ,CAAC,YAAY,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IAClD,QAAQ,CAAC,SAAS,CAAC,EAAE,eAAe,CAAC;gBACzB,EACV,IAAI,EACJ,IAAI,EACJ,qBAAqB,EACrB,YAAY,EACZ,SAAS,GACV,EAAE,mBAAmB,CAAC,UAAU,CAAC;IAOlC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAElE;;OAEG;IACH,QAAQ,CAAC,gBAAgB,CACvB,YAAY,EAAE,aAAa,CAAC,UAAU,CAAC,GACtC,aAAa,CAAC,UAAU,CAAC;CAC7B"}
1
+ {"version":3,"file":"EvaluatorBase.d.ts","sourceRoot":"","sources":["../../../src/core/EvaluatorBase.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACrB,eAAe,EAChB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C;;GAEG;AACH,8BAAsB,aAAa,CACjC,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAC1C,YAAW,kBAAkB,CAAC,UAAU,CAAC;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,qBAAqB,CAAC,EAAE,qBAAqB,CAAC;IACvD,QAAQ,CAAC,YAAY,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IAClD,QAAQ,CAAC,SAAS,CAAC,EAAE,eAAe,CAAC;gBACzB,EACV,IAAI,EACJ,IAAI,EACJ,qBAAqB,EACrB,YAAY,EACZ,SAAS,GACV,EAAE,mBAAmB,CAAC,UAAU,CAAC;IAOlC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAElE;;OAEG;IACH,QAAQ,CAAC,gBAAgB,CACvB,YAAY,EAAE,aAAa,CAAC,UAAU,CAAC,GACtC,aAAa,CAAC,UAAU,CAAC;CAC7B"}
@@ -1 +1 @@
1
- {"version":3,"file":"createCorrectnessEvaluator.d.ts","sourceRoot":"","sources":["../../../src/llm/createCorrectnessEvaluator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iCAAiC,EAAE,MAAM,gBAAgB,CAAC;AAEnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAGpE,MAAM,WAAW,wBAAwB,CACvC,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,2BAA2B,CACxE,SAAQ,IAAI,CACV,iCAAiC,CAAC,UAAU,CAAC,EAC7C,gBAAgB,GAAG,SAAS,GAAG,uBAAuB,GAAG,MAAM,CAChE;IACD,qBAAqB,CAAC,EAAE,iCAAiC,CAAC,UAAU,CAAC,CAAC,uBAAuB,CAAC,CAAC;IAC/F,IAAI,CAAC,EAAE,iCAAiC,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;IAC7D,OAAO,CAAC,EAAE,iCAAiC,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,CAAC;IACnE,cAAc,CAAC,EAAE,iCAAiC,CAAC,UAAU,CAAC,CAAC,gBAAgB,CAAC,CAAC;CAClF;AAED;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,0BAA0B,CACxC,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,2BAA2B,EAExE,IAAI,EAAE,wBAAwB,CAAC,UAAU,CAAC,GACzC,uBAAuB,CAAC,UAAU,CAAC,CAerC"}
1
+ {"version":3,"file":"createCorrectnessEvaluator.d.ts","sourceRoot":"","sources":["../../../src/llm/createCorrectnessEvaluator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iCAAiC,EAAE,MAAM,gBAAgB,CAAC;AAEnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAGpE,MAAM,WAAW,wBAAwB,CACvC,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,2BAA2B,CACxE,SAAQ,IAAI,CACZ,iCAAiC,CAAC,UAAU,CAAC,EAC7C,gBAAgB,GAAG,SAAS,GAAG,uBAAuB,GAAG,MAAM,CAChE;IACC,qBAAqB,CAAC,EAAE,iCAAiC,CAAC,UAAU,CAAC,CAAC,uBAAuB,CAAC,CAAC;IAC/F,IAAI,CAAC,EAAE,iCAAiC,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;IAC7D,OAAO,CAAC,EAAE,iCAAiC,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,CAAC;IACnE,cAAc,CAAC,EAAE,iCAAiC,CAAC,UAAU,CAAC,CAAC,gBAAgB,CAAC,CAAC;CAClF;AAED;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,0BAA0B,CACxC,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,2BAA2B,EAExE,IAAI,EAAE,wBAAwB,CAAC,UAAU,CAAC,GACzC,uBAAuB,CAAC,UAAU,CAAC,CAerC"}
@@ -1 +1 @@
1
- {"version":3,"file":"createDocumentRelevanceEvaluator.d.ts","sourceRoot":"","sources":["../../../src/llm/createDocumentRelevanceEvaluator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iCAAiC,EAAE,MAAM,gBAAgB,CAAC;AAEnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAGpE,MAAM,WAAW,8BAA8B,CAC7C,UAAU,SAAS,MAAM,CACvB,MAAM,EACN,OAAO,CACR,GAAG,iCAAiC,CACrC,SAAQ,IAAI,CACV,iCAAiC,CAAC,UAAU,CAAC,EAC7C,gBAAgB,GAAG,SAAS,GAAG,uBAAuB,GAAG,MAAM,CAChE;IACD,qBAAqB,CAAC,EAAE,iCAAiC,CAAC,UAAU,CAAC,CAAC,uBAAuB,CAAC,CAAC;IAC/F,IAAI,CAAC,EAAE,iCAAiC,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;IAC7D,OAAO,CAAC,EAAE,iCAAiC,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,CAAC;IACnE,cAAc,CAAC,EAAE,iCAAiC,CAAC,UAAU,CAAC,CAAC,gBAAgB,CAAC,CAAC;CAClF;AAED;;GAEG;AACH,MAAM,WAAW,iCAAiC;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,gCAAgC,CAC9C,UAAU,SAAS,MAAM,CACvB,MAAM,EACN,OAAO,CACR,GAAG,iCAAiC,EAErC,IAAI,EAAE,8BAA8B,CAAC,UAAU,CAAC,GAC/C,uBAAuB,CAAC,UAAU,CAAC,CAerC"}
1
+ {"version":3,"file":"createDocumentRelevanceEvaluator.d.ts","sourceRoot":"","sources":["../../../src/llm/createDocumentRelevanceEvaluator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iCAAiC,EAAE,MAAM,gBAAgB,CAAC;AAEnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAGpE,MAAM,WAAW,8BAA8B,CAC7C,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACxC,iCAAiC,CACnC,SAAQ,IAAI,CACZ,iCAAiC,CAAC,UAAU,CAAC,EAC7C,gBAAgB,GAAG,SAAS,GAAG,uBAAuB,GAAG,MAAM,CAChE;IACC,qBAAqB,CAAC,EAAE,iCAAiC,CAAC,UAAU,CAAC,CAAC,uBAAuB,CAAC,CAAC;IAC/F,IAAI,CAAC,EAAE,iCAAiC,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;IAC7D,OAAO,CAAC,EAAE,iCAAiC,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,CAAC;IACnE,cAAc,CAAC,EAAE,iCAAiC,CAAC,UAAU,CAAC,CAAC,gBAAgB,CAAC,CAAC;CAClF;AAED;;GAEG;AACH,MAAM,WAAW,iCAAiC;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,gCAAgC,CAC9C,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACxC,iCAAiC,EAEnC,IAAI,EAAE,8BAA8B,CAAC,UAAU,CAAC,GAC/C,uBAAuB,CAAC,UAAU,CAAC,CAerC"}
@@ -1 +1 @@
1
- {"version":3,"file":"createDocumentRelevanceEvaluator.js","sourceRoot":"","sources":["../../../src/llm/createDocumentRelevanceEvaluator.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAwDA,4EAsBC;AA9ED,0EAAwG;AAIxG,mFAAgF;AA0BhF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,SAAgB,gCAAgC,CAM9C,IAAgD;IAEhD,MAAM,EACJ,OAAO,GAAG,sEAAkD,CAAC,OAAO,EACpE,cAAc,GAAG,sEAAkD,CAAC,QAAQ,EAC5E,qBAAqB,GAAG,sEAAkD,CAAC,qBAAqB,EAChG,IAAI,GAAG,sEAAkD,CAAC,IAAI,KAE5D,IAAI,EADH,IAAI,UACL,IAAI,EANF,8DAML,CAAO,CAAC;IACT,OAAO,IAAA,6DAA6B,kCAC/B,IAAI,KACP,cAAc;QACd,OAAO;QACP,qBAAqB;QACrB,IAAI,IACJ,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"createDocumentRelevanceEvaluator.js","sourceRoot":"","sources":["../../../src/llm/createDocumentRelevanceEvaluator.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAsDA,4EAoBC;AA1ED,0EAAwG;AAIxG,mFAAgF;AAwBhF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,SAAgB,gCAAgC,CAI9C,IAAgD;IAEhD,MAAM,EACJ,OAAO,GAAG,sEAAkD,CAAC,OAAO,EACpE,cAAc,GAAG,sEAAkD,CAAC,QAAQ,EAC5E,qBAAqB,GAAG,sEAAkD,CAAC,qBAAqB,EAChG,IAAI,GAAG,sEAAkD,CAAC,IAAI,KAE5D,IAAI,EADH,IAAI,UACL,IAAI,EANF,8DAML,CAAO,CAAC;IACT,OAAO,IAAA,6DAA6B,kCAC/B,IAAI,KACP,cAAc;QACd,OAAO;QACP,qBAAqB;QACrB,IAAI,IACJ,CAAC;AACL,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { CreateClassificationEvaluatorArgs } from "../types/evals";
2
+ import { ClassificationEvaluator } from "./ClassificationEvaluator";
3
+ export interface FaithfulnessEvaluatorArgs<RecordType extends Record<string, unknown> = FaithfulnessEvaluationRecord> extends Omit<CreateClassificationEvaluatorArgs<RecordType>, "promptTemplate" | "choices" | "optimizationDirection" | "name"> {
4
+ optimizationDirection?: CreateClassificationEvaluatorArgs<RecordType>["optimizationDirection"];
5
+ name?: CreateClassificationEvaluatorArgs<RecordType>["name"];
6
+ choices?: CreateClassificationEvaluatorArgs<RecordType>["choices"];
7
+ promptTemplate?: CreateClassificationEvaluatorArgs<RecordType>["promptTemplate"];
8
+ }
9
+ /**
10
+ * A record to be evaluated by the faithfulness evaluator.
11
+ */
12
+ export type FaithfulnessEvaluationRecord = {
13
+ input: string;
14
+ output: string;
15
+ context?: string;
16
+ };
17
+ /**
18
+ * Creates a function that evaluates whether an answer is faithful or unfaithful based on a query and reference text.
19
+ *
20
+ * @param args - The arguments for creating the faithfulness evaluator.
21
+ * @returns A function that evaluates whether an answer is faithful or unfaithful based on a query and reference text.
22
+ */
23
+ export declare function createFaithfulnessEvaluator<RecordType extends Record<string, unknown> = FaithfulnessEvaluationRecord>(args: FaithfulnessEvaluatorArgs<RecordType>): ClassificationEvaluator<RecordType>;
24
+ //# sourceMappingURL=createFaithfulnessEvaluator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createFaithfulnessEvaluator.d.ts","sourceRoot":"","sources":["../../../src/llm/createFaithfulnessEvaluator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iCAAiC,EAAE,MAAM,gBAAgB,CAAC;AAEnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAGpE,MAAM,WAAW,yBAAyB,CACxC,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,4BAA4B,CACzE,SAAQ,IAAI,CACZ,iCAAiC,CAAC,UAAU,CAAC,EAC7C,gBAAgB,GAAG,SAAS,GAAG,uBAAuB,GAAG,MAAM,CAChE;IACC,qBAAqB,CAAC,EAAE,iCAAiC,CAAC,UAAU,CAAC,CAAC,uBAAuB,CAAC,CAAC;IAC/F,IAAI,CAAC,EAAE,iCAAiC,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;IAC7D,OAAO,CAAC,EAAE,iCAAiC,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,CAAC;IACnE,cAAc,CAAC,EAAE,iCAAiC,CAAC,UAAU,CAAC,CAAC,gBAAgB,CAAC,CAAC;CAClF;AAED;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AACF;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,4BAA4B,EAEzE,IAAI,EAAE,yBAAyB,CAAC,UAAU,CAAC,GAC1C,uBAAuB,CAAC,UAAU,CAAC,CAerC"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.createFaithfulnessEvaluator = createFaithfulnessEvaluator;
15
+ const default_templates_1 = require("../__generated__/default_templates");
16
+ const createClassificationEvaluator_1 = require("./createClassificationEvaluator");
17
+ /**
18
+ * Creates a function that evaluates whether an answer is faithful or unfaithful based on a query and reference text.
19
+ *
20
+ * @param args - The arguments for creating the faithfulness evaluator.
21
+ * @returns A function that evaluates whether an answer is faithful or unfaithful based on a query and reference text.
22
+ */
23
+ function createFaithfulnessEvaluator(args) {
24
+ const { choices = default_templates_1.FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.choices, promptTemplate = default_templates_1.FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.template, optimizationDirection = default_templates_1.FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.optimizationDirection, name = default_templates_1.FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.name } = args, rest = __rest(args, ["choices", "promptTemplate", "optimizationDirection", "name"]);
25
+ return (0, createClassificationEvaluator_1.createClassificationEvaluator)(Object.assign(Object.assign({}, rest), { promptTemplate,
26
+ choices,
27
+ optimizationDirection,
28
+ name }));
29
+ }
30
+ //# sourceMappingURL=createFaithfulnessEvaluator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createFaithfulnessEvaluator.js","sourceRoot":"","sources":["../../../src/llm/createFaithfulnessEvaluator.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAgCA,kEAmBC;AAnDD,0EAAkG;AAIlG,mFAAgF;AAsBhF;;;;;GAKG;AACH,SAAgB,2BAA2B,CAGzC,IAA2C;IAE3C,MAAM,EACJ,OAAO,GAAG,gEAA4C,CAAC,OAAO,EAC9D,cAAc,GAAG,gEAA4C,CAAC,QAAQ,EACtE,qBAAqB,GAAG,gEAA4C,CAAC,qBAAqB,EAC1F,IAAI,GAAG,gEAA4C,CAAC,IAAI,KAEtD,IAAI,EADH,IAAI,UACL,IAAI,EANF,8DAML,CAAO,CAAC;IACT,OAAO,IAAA,6DAA6B,kCAC/B,IAAI,KACP,cAAc;QACd,OAAO;QACP,qBAAqB;QACrB,IAAI,IACJ,CAAC;AACL,CAAC"}
@@ -1,3 +1,9 @@
1
+ /**
2
+ * @deprecated This evaluator is maintained for backwards compatibility.
3
+ * Please use createFaithfulnessEvaluator instead, which uses updated terminology:
4
+ * - 'faithful'/'unfaithful' labels instead of 'factual'/'hallucinated'
5
+ * - Maximizes score (1.0=faithful) instead of minimizing it
6
+ */
1
7
  import { CreateClassificationEvaluatorArgs } from "../types/evals";
2
8
  import { ClassificationEvaluator } from "./ClassificationEvaluator";
3
9
  export interface HallucinationEvaluatorArgs<RecordType extends Record<string, unknown> = HallucinationEvaluationRecord> extends Omit<CreateClassificationEvaluatorArgs<RecordType>, "promptTemplate" | "choices" | "optimizationDirection" | "name"> {
@@ -15,8 +21,14 @@ export type HallucinationEvaluationRecord = {
15
21
  context?: string;
16
22
  };
17
23
  /**
24
+ * @deprecated Use createFaithfulnessEvaluator instead.
25
+ *
18
26
  * Creates a function that evaluates whether an answer is factual or hallucinated based on a query and reference text.
19
27
  *
28
+ * Note: This is deprecated. Please use createFaithfulnessEvaluator which:
29
+ * - Uses 'faithful'/'unfaithful' labels instead of 'factual'/'hallucinated'
30
+ * - Maximizes the score (1.0 for faithful, 0.0 for unfaithful)
31
+ *
20
32
  * @param args - The arguments for creating the hallucination evaluator.
21
33
  * @returns A function that evaluates whether an answer is factual or hallucinated based on a query and reference text.
22
34
  */
@@ -1 +1 @@
1
- {"version":3,"file":"createHallucinationEvaluator.d.ts","sourceRoot":"","sources":["../../../src/llm/createHallucinationEvaluator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iCAAiC,EAAE,MAAM,gBAAgB,CAAC;AAEnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAGpE,MAAM,WAAW,0BAA0B,CACzC,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,6BAA6B,CAC1E,SAAQ,IAAI,CACV,iCAAiC,CAAC,UAAU,CAAC,EAC7C,gBAAgB,GAAG,SAAS,GAAG,uBAAuB,GAAG,MAAM,CAChE;IACD,qBAAqB,CAAC,EAAE,iCAAiC,CAAC,UAAU,CAAC,CAAC,uBAAuB,CAAC,CAAC;IAC/F,IAAI,CAAC,EAAE,iCAAiC,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;IAC7D,OAAO,CAAC,EAAE,iCAAiC,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,CAAC;IACnE,cAAc,CAAC,EAAE,iCAAiC,CAAC,UAAU,CAAC,CAAC,gBAAgB,CAAC,CAAC;CAClF;AAED;;GAEG;AACH,MAAM,MAAM,6BAA6B,GAAG;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AACF;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC1C,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,6BAA6B,EAE1E,IAAI,EAAE,0BAA0B,CAAC,UAAU,CAAC,GAC3C,uBAAuB,CAAC,UAAU,CAAC,CAerC"}
1
+ {"version":3,"file":"createHallucinationEvaluator.d.ts","sourceRoot":"","sources":["../../../src/llm/createHallucinationEvaluator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,iCAAiC,EAAE,MAAM,gBAAgB,CAAC;AAEnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAGpE,MAAM,WAAW,0BAA0B,CACzC,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,6BAA6B,CAC1E,SAAQ,IAAI,CACZ,iCAAiC,CAAC,UAAU,CAAC,EAC7C,gBAAgB,GAAG,SAAS,GAAG,uBAAuB,GAAG,MAAM,CAChE;IACC,qBAAqB,CAAC,EAAE,iCAAiC,CAAC,UAAU,CAAC,CAAC,uBAAuB,CAAC,CAAC;IAC/F,IAAI,CAAC,EAAE,iCAAiC,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;IAC7D,OAAO,CAAC,EAAE,iCAAiC,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,CAAC;IACnE,cAAc,CAAC,EAAE,iCAAiC,CAAC,UAAU,CAAC,CAAC,gBAAgB,CAAC,CAAC;CAClF;AAED;;GAEG;AACH,MAAM,MAAM,6BAA6B,GAAG;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,4BAA4B,CAC1C,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,6BAA6B,EAE1E,IAAI,EAAE,0BAA0B,CAAC,UAAU,CAAC,GAC3C,uBAAuB,CAAC,UAAU,CAAC,CAuBrC"}
@@ -1,4 +1,10 @@
1
1
  "use strict";
2
+ /**
3
+ * @deprecated This evaluator is maintained for backwards compatibility.
4
+ * Please use createFaithfulnessEvaluator instead, which uses updated terminology:
5
+ * - 'faithful'/'unfaithful' labels instead of 'factual'/'hallucinated'
6
+ * - Maximizes score (1.0=faithful) instead of minimizing it
7
+ */
2
8
  var __rest = (this && this.__rest) || function (s, e) {
3
9
  var t = {};
4
10
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -15,12 +21,23 @@ exports.createHallucinationEvaluator = createHallucinationEvaluator;
15
21
  const default_templates_1 = require("../__generated__/default_templates");
16
22
  const createClassificationEvaluator_1 = require("./createClassificationEvaluator");
17
23
  /**
24
+ * @deprecated Use createFaithfulnessEvaluator instead.
25
+ *
18
26
  * Creates a function that evaluates whether an answer is factual or hallucinated based on a query and reference text.
19
27
  *
28
+ * Note: This is deprecated. Please use createFaithfulnessEvaluator which:
29
+ * - Uses 'faithful'/'unfaithful' labels instead of 'factual'/'hallucinated'
30
+ * - Maximizes the score (1.0 for faithful, 0.0 for unfaithful)
31
+ *
20
32
  * @param args - The arguments for creating the hallucination evaluator.
21
33
  * @returns A function that evaluates whether an answer is factual or hallucinated based on a query and reference text.
22
34
  */
23
35
  function createHallucinationEvaluator(args) {
36
+ // eslint-disable-next-line no-console
37
+ console.warn("createHallucinationEvaluator is deprecated and will be removed in a future version. " +
38
+ "Please use createFaithfulnessEvaluator instead. The new evaluator uses " +
39
+ "'faithful'/'unfaithful' labels and maximizes score (1.0=faithful) instead of " +
40
+ "minimizing it (0.0=factual).");
24
41
  const { choices = default_templates_1.HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.choices, promptTemplate = default_templates_1.HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.template, optimizationDirection = default_templates_1.HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.optimizationDirection, name = default_templates_1.HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.name } = args, rest = __rest(args, ["choices", "promptTemplate", "optimizationDirection", "name"]);
25
42
  return (0, createClassificationEvaluator_1.createClassificationEvaluator)(Object.assign(Object.assign({}, rest), { promptTemplate,
26
43
  choices,
@@ -1 +1 @@
1
- {"version":3,"file":"createHallucinationEvaluator.js","sourceRoot":"","sources":["../../../src/llm/createHallucinationEvaluator.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAgCA,oEAmBC;AAnDD,0EAAmG;AAInG,mFAAgF;AAsBhF;;;;;GAKG;AACH,SAAgB,4BAA4B,CAG1C,IAA4C;IAE5C,MAAM,EACJ,OAAO,GAAG,iEAA6C,CAAC,OAAO,EAC/D,cAAc,GAAG,iEAA6C,CAAC,QAAQ,EACvE,qBAAqB,GAAG,iEAA6C,CAAC,qBAAqB,EAC3F,IAAI,GAAG,iEAA6C,CAAC,IAAI,KAEvD,IAAI,EADH,IAAI,UACL,IAAI,EANF,8DAML,CAAO,CAAC;IACT,OAAO,IAAA,6DAA6B,kCAC/B,IAAI,KACP,cAAc;QACd,OAAO;QACP,qBAAqB;QACrB,IAAI,IACJ,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"createHallucinationEvaluator.js","sourceRoot":"","sources":["../../../src/llm/createHallucinationEvaluator.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;AAyCH,oEA2BC;AAlED,0EAAmG;AAInG,mFAAgF;AAuBhF;;;;;;;;;;;GAWG;AACH,SAAgB,4BAA4B,CAG1C,IAA4C;IAE5C,sCAAsC;IACtC,OAAO,CAAC,IAAI,CACV,sFAAsF;QACpF,yEAAyE;QACzE,+EAA+E;QAC/E,8BAA8B,CACjC,CAAC;IAEF,MAAM,EACJ,OAAO,GAAG,iEAA6C,CAAC,OAAO,EAC/D,cAAc,GAAG,iEAA6C,CAAC,QAAQ,EACvE,qBAAqB,GAAG,iEAA6C,CAAC,qBAAqB,EAC3F,IAAI,GAAG,iEAA6C,CAAC,IAAI,KAEvD,IAAI,EADH,IAAI,UACL,IAAI,EANF,8DAML,CAAO,CAAC;IACT,OAAO,IAAA,6DAA6B,kCAC/B,IAAI,KACP,cAAc;QACd,OAAO;QACP,qBAAqB;QACrB,IAAI,IACJ,CAAC;AACL,CAAC"}
@@ -0,0 +1,74 @@
1
+ import { CreateClassificationEvaluatorArgs } from "../types/evals";
2
+ import { ClassificationEvaluator } from "./ClassificationEvaluator";
3
+ export interface ToolInvocationEvaluatorArgs<RecordType extends Record<string, unknown> = ToolInvocationEvaluationRecord> extends Omit<CreateClassificationEvaluatorArgs<RecordType>, "promptTemplate" | "choices" | "optimizationDirection" | "name"> {
4
+ optimizationDirection?: CreateClassificationEvaluatorArgs<RecordType>["optimizationDirection"];
5
+ name?: CreateClassificationEvaluatorArgs<RecordType>["name"];
6
+ choices?: CreateClassificationEvaluatorArgs<RecordType>["choices"];
7
+ promptTemplate?: CreateClassificationEvaluatorArgs<RecordType>["promptTemplate"];
8
+ }
9
+ /**
10
+ * A record to be evaluated by the tool invocation evaluator.
11
+ */
12
+ export type ToolInvocationEvaluationRecord = {
13
+ /**
14
+ * The input query or conversation context.
15
+ */
16
+ input: string;
17
+ /**
18
+ * The available tool schemas, either as JSON schema or human-readable format.
19
+ */
20
+ availableTools: string;
21
+ /**
22
+ * The tool invocation(s) made by the LLM, including arguments.
23
+ */
24
+ toolSelection: string;
25
+ };
26
+ /**
27
+ * Creates a tool invocation evaluator function.
28
+ *
29
+ * This function returns an evaluator that determines whether a tool was invoked
30
+ * correctly with proper arguments, formatting, and safe content.
31
+ *
32
+ * The evaluator checks for:
33
+ * - Properly structured JSON (if applicable)
34
+ * - All required fields/parameters present
35
+ * - No hallucinated or nonexistent fields
36
+ * - Argument values matching user query and schema expectations
37
+ * - No unsafe content (e.g., PII) in arguments
38
+ *
39
+ * @param args - The arguments for creating the tool invocation evaluator.
40
+ * @param args.model - The model to use for classification.
41
+ * @param args.choices - The possible classification choices (defaults to correct/incorrect).
42
+ * @param args.promptTemplate - The prompt template to use (defaults to TOOL_INVOCATION_TEMPLATE).
43
+ * @param args.telemetry - The telemetry to use for the evaluator.
44
+ *
45
+ * @returns An evaluator function that takes a {@link ToolInvocationEvaluationRecord} and returns
46
+ * a classification result indicating whether the tool invocation is correct or incorrect.
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * const evaluator = createToolInvocationEvaluator({ model: openai("gpt-4o-mini") });
51
+ *
52
+ * // Example with JSON schema format for available tools
53
+ * const result = await evaluator.evaluate({
54
+ * input: "User: Book a flight from NYC to LA for tomorrow",
55
+ * availableTools: JSON.stringify({
56
+ * name: "book_flight",
57
+ * description: "Book a flight between two cities",
58
+ * parameters: {
59
+ * type: "object",
60
+ * properties: {
61
+ * origin: { type: "string", description: "Departure city code" },
62
+ * destination: { type: "string", description: "Arrival city code" },
63
+ * date: { type: "string", description: "Flight date in YYYY-MM-DD" }
64
+ * },
65
+ * required: ["origin", "destination", "date"]
66
+ * }
67
+ * }),
68
+ * toolSelection: 'book_flight(origin="NYC", destination="LA", date="2024-01-15")'
69
+ * });
70
+ * console.log(result.label); // "correct" or "incorrect"
71
+ * ```
72
+ */
73
+ export declare function createToolInvocationEvaluator<RecordType extends Record<string, unknown> = ToolInvocationEvaluationRecord>(args: ToolInvocationEvaluatorArgs<RecordType>): ClassificationEvaluator<RecordType>;
74
+ //# sourceMappingURL=createToolInvocationEvaluator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createToolInvocationEvaluator.d.ts","sourceRoot":"","sources":["../../../src/llm/createToolInvocationEvaluator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iCAAiC,EAAE,MAAM,gBAAgB,CAAC;AAEnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAGpE,MAAM,WAAW,2BAA2B,CAC1C,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,8BAA8B,CAC3E,SAAQ,IAAI,CACZ,iCAAiC,CAAC,UAAU,CAAC,EAC7C,gBAAgB,GAAG,SAAS,GAAG,uBAAuB,GAAG,MAAM,CAChE;IACC,qBAAqB,CAAC,EAAE,iCAAiC,CAAC,UAAU,CAAC,CAAC,uBAAuB,CAAC,CAAC;IAC/F,IAAI,CAAC,EAAE,iCAAiC,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;IAC7D,OAAO,CAAC,EAAE,iCAAiC,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,CAAC;IACnE,cAAc,CAAC,EAAE,iCAAiC,CAAC,UAAU,CAAC,CAAC,gBAAgB,CAAC,CAAC;CAClF;AAED;;GAEG;AACH,MAAM,MAAM,8BAA8B,GAAG;IAC3C;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,wBAAgB,6BAA6B,CAC3C,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,8BAA8B,EAE3E,IAAI,EAAE,2BAA2B,CAAC,UAAU,CAAC,GAC5C,uBAAuB,CAAC,UAAU,CAAC,CAerC"}
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.createToolInvocationEvaluator = createToolInvocationEvaluator;
15
+ const default_templates_1 = require("../__generated__/default_templates");
16
+ const createClassificationEvaluator_1 = require("./createClassificationEvaluator");
17
+ /**
18
+ * Creates a tool invocation evaluator function.
19
+ *
20
+ * This function returns an evaluator that determines whether a tool was invoked
21
+ * correctly with proper arguments, formatting, and safe content.
22
+ *
23
+ * The evaluator checks for:
24
+ * - Properly structured JSON (if applicable)
25
+ * - All required fields/parameters present
26
+ * - No hallucinated or nonexistent fields
27
+ * - Argument values matching user query and schema expectations
28
+ * - No unsafe content (e.g., PII) in arguments
29
+ *
30
+ * @param args - The arguments for creating the tool invocation evaluator.
31
+ * @param args.model - The model to use for classification.
32
+ * @param args.choices - The possible classification choices (defaults to correct/incorrect).
33
+ * @param args.promptTemplate - The prompt template to use (defaults to TOOL_INVOCATION_TEMPLATE).
34
+ * @param args.telemetry - The telemetry to use for the evaluator.
35
+ *
36
+ * @returns An evaluator function that takes a {@link ToolInvocationEvaluationRecord} and returns
37
+ * a classification result indicating whether the tool invocation is correct or incorrect.
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * const evaluator = createToolInvocationEvaluator({ model: openai("gpt-4o-mini") });
42
+ *
43
+ * // Example with JSON schema format for available tools
44
+ * const result = await evaluator.evaluate({
45
+ * input: "User: Book a flight from NYC to LA for tomorrow",
46
+ * availableTools: JSON.stringify({
47
+ * name: "book_flight",
48
+ * description: "Book a flight between two cities",
49
+ * parameters: {
50
+ * type: "object",
51
+ * properties: {
52
+ * origin: { type: "string", description: "Departure city code" },
53
+ * destination: { type: "string", description: "Arrival city code" },
54
+ * date: { type: "string", description: "Flight date in YYYY-MM-DD" }
55
+ * },
56
+ * required: ["origin", "destination", "date"]
57
+ * }
58
+ * }),
59
+ * toolSelection: 'book_flight(origin="NYC", destination="LA", date="2024-01-15")'
60
+ * });
61
+ * console.log(result.label); // "correct" or "incorrect"
62
+ * ```
63
+ */
64
+ function createToolInvocationEvaluator(args) {
65
+ const { choices = default_templates_1.TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG.choices, promptTemplate = default_templates_1.TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG.template, optimizationDirection = default_templates_1.TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG.optimizationDirection, name = default_templates_1.TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG.name } = args, rest = __rest(args, ["choices", "promptTemplate", "optimizationDirection", "name"]);
66
+ return (0, createClassificationEvaluator_1.createClassificationEvaluator)(Object.assign(Object.assign({}, rest), { promptTemplate,
67
+ choices,
68
+ optimizationDirection,
69
+ name }));
70
+ }
71
+ //# sourceMappingURL=createToolInvocationEvaluator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createToolInvocationEvaluator.js","sourceRoot":"","sources":["../../../src/llm/createToolInvocationEvaluator.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAmFA,sEAmBC;AAtGD,0EAAqG;AAIrG,mFAAgF;AAgChF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,SAAgB,6BAA6B,CAG3C,IAA6C;IAE7C,MAAM,EACJ,OAAO,GAAG,mEAA+C,CAAC,OAAO,EACjE,cAAc,GAAG,mEAA+C,CAAC,QAAQ,EACzE,qBAAqB,GAAG,mEAA+C,CAAC,qBAAqB,EAC7F,IAAI,GAAG,mEAA+C,CAAC,IAAI,KAEzD,IAAI,EADH,IAAI,UACL,IAAI,EANF,8DAML,CAAO,CAAC;IACT,OAAO,IAAA,6DAA6B,kCAC/B,IAAI,KACP,cAAc;QACd,OAAO;QACP,qBAAqB;QACrB,IAAI,IACJ,CAAC;AACL,CAAC"}