@arizeai/phoenix-evals 0.6.5 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/__generated__/default_templates/CORRECTNESS_CLASSIFICATION_EVALUATOR_CONFIG.d.ts +3 -0
- package/dist/esm/__generated__/default_templates/CORRECTNESS_CLASSIFICATION_EVALUATOR_CONFIG.d.ts.map +1 -0
- package/dist/esm/__generated__/default_templates/CORRECTNESS_CLASSIFICATION_EVALUATOR_CONFIG.js +49 -0
- package/dist/esm/__generated__/default_templates/CORRECTNESS_CLASSIFICATION_EVALUATOR_CONFIG.js.map +1 -0
- package/dist/esm/__generated__/default_templates/DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG.d.ts.map +1 -1
- package/dist/esm/__generated__/default_templates/DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG.js +10 -17
- package/dist/esm/__generated__/default_templates/DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG.js.map +1 -1
- package/dist/esm/__generated__/default_templates/FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.d.ts +3 -0
- package/dist/esm/__generated__/default_templates/FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.d.ts.map +1 -0
- package/dist/esm/__generated__/default_templates/FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.js +33 -0
- package/dist/esm/__generated__/default_templates/FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.js.map +1 -0
- package/dist/esm/__generated__/default_templates/HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.d.ts.map +1 -1
- package/dist/esm/__generated__/default_templates/HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.js +12 -22
- package/dist/esm/__generated__/default_templates/HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.js.map +1 -1
- package/dist/esm/__generated__/default_templates/TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG.d.ts +3 -0
- package/dist/esm/__generated__/default_templates/TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG.d.ts.map +1 -0
- package/dist/esm/__generated__/default_templates/TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG.js +30 -0
- package/dist/esm/__generated__/default_templates/TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG.js.map +1 -0
- package/dist/esm/__generated__/default_templates/TOOL_SELECTION_CLASSIFICATION_EVALUATOR_CONFIG.d.ts +3 -0
- package/dist/esm/__generated__/default_templates/TOOL_SELECTION_CLASSIFICATION_EVALUATOR_CONFIG.d.ts.map +1 -0
- package/dist/esm/__generated__/default_templates/TOOL_SELECTION_CLASSIFICATION_EVALUATOR_CONFIG.js +27 -0
- package/dist/esm/__generated__/default_templates/TOOL_SELECTION_CLASSIFICATION_EVALUATOR_CONFIG.js.map +1 -0
- package/dist/esm/__generated__/default_templates/index.d.ts +4 -0
- package/dist/esm/__generated__/default_templates/index.d.ts.map +1 -1
- package/dist/esm/__generated__/default_templates/index.js +4 -0
- package/dist/esm/__generated__/default_templates/index.js.map +1 -1
- package/dist/esm/core/EvaluatorBase.d.ts.map +1 -1
- package/dist/esm/llm/createCorrectnessEvaluator.d.ts +42 -0
- package/dist/esm/llm/createCorrectnessEvaluator.d.ts.map +1 -0
- package/dist/esm/llm/createCorrectnessEvaluator.js +38 -0
- package/dist/esm/llm/createCorrectnessEvaluator.js.map +1 -0
- package/dist/esm/llm/createDocumentRelevanceEvaluator.d.ts.map +1 -1
- package/dist/esm/llm/createDocumentRelevanceEvaluator.js.map +1 -1
- package/dist/esm/llm/createFaithfulnessEvaluator.d.ts +24 -0
- package/dist/esm/llm/createFaithfulnessEvaluator.d.ts.map +1 -0
- package/dist/esm/llm/createFaithfulnessEvaluator.js +19 -0
- package/dist/esm/llm/createFaithfulnessEvaluator.js.map +1 -0
- package/dist/esm/llm/createHallucinationEvaluator.d.ts +12 -0
- package/dist/esm/llm/createHallucinationEvaluator.d.ts.map +1 -1
- package/dist/esm/llm/createHallucinationEvaluator.js +17 -0
- package/dist/esm/llm/createHallucinationEvaluator.js.map +1 -1
- package/dist/esm/llm/createToolInvocationEvaluator.d.ts +74 -0
- package/dist/esm/llm/createToolInvocationEvaluator.d.ts.map +1 -0
- package/dist/esm/llm/createToolInvocationEvaluator.js +60 -0
- package/dist/esm/llm/createToolInvocationEvaluator.js.map +1 -0
- package/dist/esm/llm/index.d.ts +7 -4
- package/dist/esm/llm/index.d.ts.map +1 -1
- package/dist/esm/llm/index.js +7 -4
- package/dist/esm/llm/index.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/types/evals.d.ts.map +1 -1
- package/dist/src/__generated__/default_templates/CORRECTNESS_CLASSIFICATION_EVALUATOR_CONFIG.d.ts +3 -0
- package/dist/src/__generated__/default_templates/CORRECTNESS_CLASSIFICATION_EVALUATOR_CONFIG.d.ts.map +1 -0
- package/dist/src/__generated__/default_templates/CORRECTNESS_CLASSIFICATION_EVALUATOR_CONFIG.js +52 -0
- package/dist/src/__generated__/default_templates/CORRECTNESS_CLASSIFICATION_EVALUATOR_CONFIG.js.map +1 -0
- package/dist/src/__generated__/default_templates/DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG.d.ts.map +1 -1
- package/dist/src/__generated__/default_templates/DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG.js +10 -17
- package/dist/src/__generated__/default_templates/DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG.js.map +1 -1
- package/dist/src/__generated__/default_templates/FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.d.ts +3 -0
- package/dist/src/__generated__/default_templates/FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.d.ts.map +1 -0
- package/dist/src/__generated__/default_templates/FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.js +36 -0
- package/dist/src/__generated__/default_templates/FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.js.map +1 -0
- package/dist/src/__generated__/default_templates/HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.d.ts.map +1 -1
- package/dist/src/__generated__/default_templates/HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.js +12 -22
- package/dist/src/__generated__/default_templates/HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.js.map +1 -1
- package/dist/src/__generated__/default_templates/TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG.d.ts +3 -0
- package/dist/src/__generated__/default_templates/TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG.d.ts.map +1 -0
- package/dist/src/__generated__/default_templates/TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG.js +33 -0
- package/dist/src/__generated__/default_templates/TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG.js.map +1 -0
- package/dist/src/__generated__/default_templates/TOOL_SELECTION_CLASSIFICATION_EVALUATOR_CONFIG.d.ts +3 -0
- package/dist/src/__generated__/default_templates/TOOL_SELECTION_CLASSIFICATION_EVALUATOR_CONFIG.d.ts.map +1 -0
- package/dist/src/__generated__/default_templates/TOOL_SELECTION_CLASSIFICATION_EVALUATOR_CONFIG.js +30 -0
- package/dist/src/__generated__/default_templates/TOOL_SELECTION_CLASSIFICATION_EVALUATOR_CONFIG.js.map +1 -0
- package/dist/src/__generated__/default_templates/index.d.ts +4 -0
- package/dist/src/__generated__/default_templates/index.d.ts.map +1 -1
- package/dist/src/__generated__/default_templates/index.js +9 -1
- package/dist/src/__generated__/default_templates/index.js.map +1 -1
- package/dist/src/core/EvaluatorBase.d.ts.map +1 -1
- package/dist/src/llm/createCorrectnessEvaluator.d.ts +42 -0
- package/dist/src/llm/createCorrectnessEvaluator.d.ts.map +1 -0
- package/dist/src/llm/createCorrectnessEvaluator.js +49 -0
- package/dist/src/llm/createCorrectnessEvaluator.js.map +1 -0
- package/dist/src/llm/createDocumentRelevanceEvaluator.d.ts.map +1 -1
- package/dist/src/llm/createDocumentRelevanceEvaluator.js.map +1 -1
- package/dist/src/llm/createFaithfulnessEvaluator.d.ts +24 -0
- package/dist/src/llm/createFaithfulnessEvaluator.d.ts.map +1 -0
- package/dist/src/llm/createFaithfulnessEvaluator.js +30 -0
- package/dist/src/llm/createFaithfulnessEvaluator.js.map +1 -0
- package/dist/src/llm/createHallucinationEvaluator.d.ts +12 -0
- package/dist/src/llm/createHallucinationEvaluator.d.ts.map +1 -1
- package/dist/src/llm/createHallucinationEvaluator.js +17 -0
- package/dist/src/llm/createHallucinationEvaluator.js.map +1 -1
- package/dist/src/llm/createToolInvocationEvaluator.d.ts +74 -0
- package/dist/src/llm/createToolInvocationEvaluator.d.ts.map +1 -0
- package/dist/src/llm/createToolInvocationEvaluator.js +71 -0
- package/dist/src/llm/createToolInvocationEvaluator.js.map +1 -0
- package/dist/src/llm/index.d.ts +7 -4
- package/dist/src/llm/index.d.ts.map +1 -1
- package/dist/src/llm/index.js +7 -4
- package/dist/src/llm/index.js.map +1 -1
- package/dist/src/types/evals.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/__generated__/default_templates/CORRECTNESS_CLASSIFICATION_EVALUATOR_CONFIG.ts +51 -0
- package/src/__generated__/default_templates/DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG.ts +10 -17
- package/src/__generated__/default_templates/FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.ts +35 -0
- package/src/__generated__/default_templates/HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.ts +12 -22
- package/src/__generated__/default_templates/TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG.ts +32 -0
- package/src/__generated__/default_templates/TOOL_SELECTION_CLASSIFICATION_EVALUATOR_CONFIG.ts +29 -0
- package/src/__generated__/default_templates/index.ts +4 -0
- package/src/core/EvaluatorBase.ts +3 -3
- package/src/llm/createCorrectnessEvaluator.ts +71 -0
- package/src/llm/createDocumentRelevanceEvaluator.ts +7 -11
- package/src/llm/createFaithfulnessEvaluator.ts +52 -0
- package/src/llm/createHallucinationEvaluator.ts +25 -3
- package/src/llm/createToolInvocationEvaluator.ts +103 -0
- package/src/llm/index.ts +7 -4
- package/src/types/evals.ts +5 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CORRECTNESS_CLASSIFICATION_EVALUATOR_CONFIG.d.ts","sourceRoot":"","sources":["../../../../src/__generated__/default_templates/CORRECTNESS_CLASSIFICATION_EVALUATOR_CONFIG.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAE9D,eAAO,MAAM,2CAA2C,EAAE,6BA8CzD,CAAC"}
|
package/dist/esm/__generated__/default_templates/CORRECTNESS_CLASSIFICATION_EVALUATOR_CONFIG.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// This file is generated. Do not edit by hand.
|
|
2
|
+
export const CORRECTNESS_CLASSIFICATION_EVALUATOR_CONFIG = {
|
|
3
|
+
name: "correctness",
|
|
4
|
+
description: "Assess factual accuracy and completeness of model outputs.",
|
|
5
|
+
optimizationDirection: "MAXIMIZE",
|
|
6
|
+
template: [
|
|
7
|
+
{
|
|
8
|
+
role: "user",
|
|
9
|
+
content: `
|
|
10
|
+
You are an expert evaluator labeling model outputs for correctness. Your task is to assign a classification based on the following criteria:
|
|
11
|
+
|
|
12
|
+
<rubric>
|
|
13
|
+
CORRECT - The response:
|
|
14
|
+
- Provides accurate and complete information with no factual errors
|
|
15
|
+
- Addresses all parts of the question
|
|
16
|
+
- Is logically consistent with no contradictions
|
|
17
|
+
- Uses precise, domain-appropriate terminology
|
|
18
|
+
- Avoids ambiguous or misleading language
|
|
19
|
+
|
|
20
|
+
INCORRECT - The response contains any of:
|
|
21
|
+
- Factual errors or inaccuracies
|
|
22
|
+
- Incomplete or partial answers
|
|
23
|
+
- Misleading or ambiguous statements
|
|
24
|
+
- Incorrect terminology
|
|
25
|
+
- Logical inconsistencies
|
|
26
|
+
- Missing key information
|
|
27
|
+
</rubric>
|
|
28
|
+
|
|
29
|
+
<data>
|
|
30
|
+
<input>
|
|
31
|
+
{{input}}
|
|
32
|
+
</input>
|
|
33
|
+
<output>
|
|
34
|
+
{{output}}
|
|
35
|
+
</output>
|
|
36
|
+
</data>
|
|
37
|
+
|
|
38
|
+
Carefully read the input and output and check for factual accuracy and completeness. Focus on correctness of information rather than verboseness or style.
|
|
39
|
+
|
|
40
|
+
Is the output correct or incorrect?
|
|
41
|
+
`,
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
choices: {
|
|
45
|
+
"correct": 1,
|
|
46
|
+
"incorrect": 0
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=CORRECTNESS_CLASSIFICATION_EVALUATOR_CONFIG.js.map
|
package/dist/esm/__generated__/default_templates/CORRECTNESS_CLASSIFICATION_EVALUATOR_CONFIG.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CORRECTNESS_CLASSIFICATION_EVALUATOR_CONFIG.js","sourceRoot":"","sources":["../../../../src/__generated__/default_templates/CORRECTNESS_CLASSIFICATION_EVALUATOR_CONFIG.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAI/C,MAAM,CAAC,MAAM,2CAA2C,GAAkC;IACxF,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,4DAA4D;IACzE,qBAAqB,EAAE,UAAU;IACjC,QAAQ,EAAE;QACR;YACE,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCd;SACI;KACF;IACD,OAAO,EAAE;QACT,SAAS,EAAE,CAAC;QACZ,WAAW,EAAE,CAAC;KACf;CACA,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG.d.ts","sourceRoot":"","sources":["../../../../src/__generated__/default_templates/DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAE9D,eAAO,MAAM,kDAAkD,EAAE,
|
|
1
|
+
{"version":3,"file":"DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG.d.ts","sourceRoot":"","sources":["../../../../src/__generated__/default_templates/DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAE9D,eAAO,MAAM,kDAAkD,EAAE,6BA2BhE,CAAC"}
|
|
@@ -7,25 +7,18 @@ export const DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG = {
|
|
|
7
7
|
{
|
|
8
8
|
role: "user",
|
|
9
9
|
content: `
|
|
10
|
-
You are comparing a document to a question and trying to determine
|
|
11
|
-
if the document text contains information relevant to answering the
|
|
12
|
-
question. Here is the data:
|
|
10
|
+
You are comparing a document to a question and trying to determine if the document text contains information relevant to answering the question. Here is the data:
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
<data>
|
|
13
|
+
<question>
|
|
14
|
+
{{input}}
|
|
15
|
+
</question>
|
|
16
|
+
<document_text>
|
|
17
|
+
{{documentText}}
|
|
18
|
+
</document_text>
|
|
19
|
+
</data>
|
|
21
20
|
|
|
22
|
-
Compare the question above to the document text. You must determine
|
|
23
|
-
whether the document text contains information that can answer the
|
|
24
|
-
question. Please focus on whether the very specific question can be
|
|
25
|
-
answered by the information in the document text. Your response must be
|
|
26
|
-
either "relevant" or "unrelated". "unrelated" means that the document
|
|
27
|
-
text does not contain an answer to the question. "relevant" means the
|
|
28
|
-
document text contains an answer to the question.
|
|
21
|
+
Compare the question above to the document text. You must determine whether the document text contains information that can answer the question. Please focus on whether the very specific question can be answered by the information in the document text. Your response must be either "relevant" or "unrelated". "unrelated" means that the document text does not contain an answer to the question. "relevant" means the document text contains an answer to the question.
|
|
29
22
|
`,
|
|
30
23
|
},
|
|
31
24
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG.js","sourceRoot":"","sources":["../../../../src/__generated__/default_templates/DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAI/C,MAAM,CAAC,MAAM,kDAAkD,GAAkC;IAC/F,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,iFAAiF;IAC9F,qBAAqB,EAAE,UAAU;IACjC,QAAQ,EAAE;QACR;YACE,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE
|
|
1
|
+
{"version":3,"file":"DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG.js","sourceRoot":"","sources":["../../../../src/__generated__/default_templates/DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAI/C,MAAM,CAAC,MAAM,kDAAkD,GAAkC;IAC/F,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,iFAAiF;IAC9F,qBAAqB,EAAE,UAAU;IACjC,QAAQ,EAAE;QACR;YACE,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE;;;;;;;;;;;;;CAad;SACI;KACF;IACD,OAAO,EAAE;QACT,UAAU,EAAE,CAAC;QACb,WAAW,EAAE,CAAC;KACf;CACA,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.d.ts","sourceRoot":"","sources":["../../../../src/__generated__/default_templates/FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAE9D,eAAO,MAAM,4CAA4C,EAAE,6BA8B1D,CAAC"}
|
package/dist/esm/__generated__/default_templates/FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// This file is generated. Do not edit by hand.
|
|
2
|
+
export const FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG = {
|
|
3
|
+
name: "faithfulness",
|
|
4
|
+
description: "A specialized evaluator for detecting faithfulness in grounded LLM responses.",
|
|
5
|
+
optimizationDirection: "MAXIMIZE",
|
|
6
|
+
template: [
|
|
7
|
+
{
|
|
8
|
+
role: "user",
|
|
9
|
+
content: `
|
|
10
|
+
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.
|
|
11
|
+
|
|
12
|
+
<data>
|
|
13
|
+
<query>
|
|
14
|
+
{{input}}
|
|
15
|
+
</query>
|
|
16
|
+
<context>
|
|
17
|
+
{{context}}
|
|
18
|
+
</context>
|
|
19
|
+
<response>
|
|
20
|
+
{{output}}
|
|
21
|
+
</response>
|
|
22
|
+
</data>
|
|
23
|
+
|
|
24
|
+
Is the response above faithful or unfaithful based on the query and context?
|
|
25
|
+
`,
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
choices: {
|
|
29
|
+
"faithful": 1,
|
|
30
|
+
"unfaithful": 0
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.js.map
|
package/dist/esm/__generated__/default_templates/FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.js.map
ADDED
|
@@ -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;AAI/C,MAAM,CAAC,MAAM,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.d.ts","sourceRoot":"","sources":["../../../../src/__generated__/default_templates/HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAE9D,eAAO,MAAM,6CAA6C,EAAE,
|
|
1
|
+
{"version":3,"file":"HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.d.ts","sourceRoot":"","sources":["../../../../src/__generated__/default_templates/HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAE9D,eAAO,MAAM,6CAA6C,EAAE,6BA8B3D,CAAC"}
|
package/dist/esm/__generated__/default_templates/HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.js
CHANGED
|
@@ -7,29 +7,19 @@ export const HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG = {
|
|
|
7
7
|
{
|
|
8
8
|
role: "user",
|
|
9
9
|
content: `
|
|
10
|
-
In this task, you will be presented with a query, some context and a response. The response
|
|
11
|
-
is generated to the question based on the context. The response may contain false
|
|
12
|
-
information. You must use the context to determine if the response to the question
|
|
13
|
-
contains false information, if the response is a hallucination of facts. Your objective is
|
|
14
|
-
to determine whether the response text contains factual information and is not a
|
|
15
|
-
hallucination. A 'hallucination' refers to a response that is not based on the context or
|
|
16
|
-
assumes information that is not available in the context. Your response should be a single
|
|
17
|
-
word: either 'factual' or 'hallucinated', and it should not include any other text or
|
|
18
|
-
characters. 'hallucinated' indicates that the response provides factually inaccurate
|
|
19
|
-
information to the query based on the context. 'factual' indicates that the response to
|
|
20
|
-
the question is correct relative to the context, and does not contain made up
|
|
21
|
-
information. Please read the query and context carefully before determining your
|
|
22
|
-
response.
|
|
10
|
+
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 a hallucination of facts. Your objective is to determine whether the response text contains factual information and is not a hallucination. A 'hallucination' 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 'factual' or 'hallucinated', and it should not include any other text or characters. 'hallucinated' indicates that the response provides factually inaccurate information to the query based on the context. 'factual' 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.
|
|
23
11
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
12
|
+
<data>
|
|
13
|
+
<query>
|
|
14
|
+
{{input}}
|
|
15
|
+
</query>
|
|
16
|
+
<context>
|
|
17
|
+
{{context}}
|
|
18
|
+
</context>
|
|
19
|
+
<response>
|
|
20
|
+
{{output}}
|
|
21
|
+
</response>
|
|
22
|
+
</data>
|
|
33
23
|
|
|
34
24
|
Is the response above factual or hallucinated based on the query and context?
|
|
35
25
|
`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.js","sourceRoot":"","sources":["../../../../src/__generated__/default_templates/HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAI/C,MAAM,CAAC,MAAM,6CAA6C,GAAkC;IAC1F,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,iFAAiF;IAC9F,qBAAqB,EAAE,UAAU;IACjC,QAAQ,EAAE;QACR;YACE,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE
|
|
1
|
+
{"version":3,"file":"HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.js","sourceRoot":"","sources":["../../../../src/__generated__/default_templates/HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAI/C,MAAM,CAAC,MAAM,6CAA6C,GAAkC;IAC1F,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,iFAAiF;IAC9F,qBAAqB,EAAE,UAAU;IACjC,QAAQ,EAAE;QACR;YACE,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE;;;;;;;;;;;;;;;;CAgBd;SACI;KACF;IACD,OAAO,EAAE;QACT,cAAc,EAAE,CAAC;QACjB,SAAS,EAAE,CAAC;KACb;CACA,CAAC"}
|
|
@@ -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"}
|
package/dist/esm/__generated__/default_templates/TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// This file is generated. Do not edit by hand.
|
|
2
|
+
export const TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG = {
|
|
3
|
+
name: "tool_invocation",
|
|
4
|
+
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).",
|
|
5
|
+
optimizationDirection: "MAXIMIZE",
|
|
6
|
+
template: [
|
|
7
|
+
{
|
|
8
|
+
role: "user",
|
|
9
|
+
content: `
|
|
10
|
+
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.
|
|
11
|
+
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
|
|
12
|
+
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".
|
|
13
|
+
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.
|
|
14
|
+
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.
|
|
15
|
+
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.
|
|
16
|
+
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).
|
|
17
|
+
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.
|
|
18
|
+
<data> <context> {{input}} </context>
|
|
19
|
+
<available_tools> {{availableTools}} </available_tools>
|
|
20
|
+
<tool_invocation> {{toolSelection}} </tool_invocation> </data>
|
|
21
|
+
Given the above data, is the tool invocation correct or incorrect?
|
|
22
|
+
`,
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
choices: {
|
|
26
|
+
"correct": 1,
|
|
27
|
+
"incorrect": 0
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
//# 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;AAI/C,MAAM,CAAC,MAAM,+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 @@
|
|
|
1
|
+
{"version":3,"file":"TOOL_SELECTION_CLASSIFICATION_EVALUATOR_CONFIG.d.ts","sourceRoot":"","sources":["../../../../src/__generated__/default_templates/TOOL_SELECTION_CLASSIFICATION_EVALUATOR_CONFIG.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAE9D,eAAO,MAAM,8CAA8C,EAAE,6BAwB5D,CAAC"}
|
package/dist/esm/__generated__/default_templates/TOOL_SELECTION_CLASSIFICATION_EVALUATOR_CONFIG.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// This file is generated. Do not edit by hand.
|
|
2
|
+
export const TOOL_SELECTION_CLASSIFICATION_EVALUATOR_CONFIG = {
|
|
3
|
+
name: "tool_selection",
|
|
4
|
+
description: "For determining if the correct tool was selected for a given context. Requires conversation context, a list of available tools, and the LLM's tool selections.",
|
|
5
|
+
optimizationDirection: "MAXIMIZE",
|
|
6
|
+
template: [
|
|
7
|
+
{
|
|
8
|
+
role: "user",
|
|
9
|
+
content: `
|
|
10
|
+
You are an impartial judge evaluating an LLM's tool-calling behavior, specifically whether the LLM selected the most appropriate tool or tools for the task.
|
|
11
|
+
Your task: Determine whether the LLM's tool selection was correct or incorrect based on: - The conversation context - The available tools - The LLM's tool invocation(s)
|
|
12
|
+
Criteria Return "correct" only when ALL of the following are true: - The LLM chose the best available tool for the user query OR correctly avoided tools if none were needed. - The tool name exists in the available tools list. - The tool is allowed and safe to call. - The LLM selected the correct number of tools for the task.
|
|
13
|
+
Return "incorrect" if ANY of the following are true: - The LLM used a hallucinated or nonexistent tool. - The LLM selected a tool when none was needed. - The LLM did not use a tool when one was required. - The LLM chose a suboptimal or irrelevant tool. - The LLM selected an unsafe or not-permitted tool. - The tool name does not appear in the available tools list.
|
|
14
|
+
Before providing your final judgment, explain your reasoning and consider: - What does the input context require? - Can this be answered without tools, or is a tool necessary? - If a tool was selected, does it exist in the available tools? - Does the selected tool's description match the user's needs? - Is the selection safe and appropriate? - Is there a better tool available that should have been chosen instead?
|
|
15
|
+
<data> <context> {{input}} </context>
|
|
16
|
+
<available_tools> {{availableTools}} </available_tools>
|
|
17
|
+
<tool_selection> {{toolSelection}} </tool_selection> </data>
|
|
18
|
+
Given the above data, is the tool selection correct or incorrect?
|
|
19
|
+
`,
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
choices: {
|
|
23
|
+
"correct": 1,
|
|
24
|
+
"incorrect": 0
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=TOOL_SELECTION_CLASSIFICATION_EVALUATOR_CONFIG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TOOL_SELECTION_CLASSIFICATION_EVALUATOR_CONFIG.js","sourceRoot":"","sources":["../../../../src/__generated__/default_templates/TOOL_SELECTION_CLASSIFICATION_EVALUATOR_CONFIG.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAI/C,MAAM,CAAC,MAAM,8CAA8C,GAAkC;IAC3F,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,gKAAgK;IAC7K,qBAAqB,EAAE,UAAU;IACjC,QAAQ,EAAE;QACR;YACE,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE;;;;;;;;;;CAUd;SACI;KACF;IACD,OAAO,EAAE;QACT,SAAS,EAAE,CAAC;QACZ,WAAW,EAAE,CAAC;KACf;CACA,CAAC"}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
export { CORRECTNESS_CLASSIFICATION_EVALUATOR_CONFIG } from "./CORRECTNESS_CLASSIFICATION_EVALUATOR_CONFIG.js";
|
|
1
2
|
export { DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG } from "./DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG.js";
|
|
3
|
+
export { FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG } from "./FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.js";
|
|
2
4
|
export { HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG } from "./HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.js";
|
|
5
|
+
export { TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG } from "./TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG.js";
|
|
6
|
+
export { TOOL_SELECTION_CLASSIFICATION_EVALUATOR_CONFIG } from "./TOOL_SELECTION_CLASSIFICATION_EVALUATOR_CONFIG.js";
|
|
3
7
|
//# 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,kDAAkD,EAAE,MAAM,sDAAsD,CAAC;AAC1H,OAAO,EAAE,6CAA6C,EAAE,MAAM,iDAAiD,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,8CAA8C,EAAE,MAAM,kDAAkD,CAAC"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
// This file is generated. Do not edit by hand.
|
|
2
|
+
export { CORRECTNESS_CLASSIFICATION_EVALUATOR_CONFIG } from "./CORRECTNESS_CLASSIFICATION_EVALUATOR_CONFIG.js";
|
|
2
3
|
export { DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG } from "./DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG.js";
|
|
4
|
+
export { FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG } from "./FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.js";
|
|
3
5
|
export { HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG } from "./HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.js";
|
|
6
|
+
export { TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG } from "./TOOL_INVOCATION_CLASSIFICATION_EVALUATOR_CONFIG.js";
|
|
7
|
+
export { TOOL_SELECTION_CLASSIFICATION_EVALUATOR_CONFIG } from "./TOOL_SELECTION_CLASSIFICATION_EVALUATOR_CONFIG.js";
|
|
4
8
|
//# 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,OAAO,EAAE,kDAAkD,EAAE,MAAM,sDAAsD,CAAC;AAC1H,OAAO,EAAE,6CAA6C,EAAE,MAAM,iDAAiD,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/__generated__/default_templates/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAE/C,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,8CAA8C,EAAE,MAAM,kDAAkD,CAAC"}
|
|
@@ -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,
|
|
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"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { CreateClassificationEvaluatorArgs } from "../types/evals.js";
|
|
2
|
+
import { ClassificationEvaluator } from "./ClassificationEvaluator.js";
|
|
3
|
+
export interface CorrectnessEvaluatorArgs<RecordType extends Record<string, unknown> = CorrectnessEvaluationRecord> 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 correctness evaluator.
|
|
11
|
+
*/
|
|
12
|
+
export type CorrectnessEvaluationRecord = {
|
|
13
|
+
input: string;
|
|
14
|
+
output: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Creates a correctness evaluator function.
|
|
18
|
+
*
|
|
19
|
+
* This function returns an evaluator that determines whether a given output
|
|
20
|
+
* is factually accurate, complete, logically consistent, and uses precise terminology.
|
|
21
|
+
*
|
|
22
|
+
* @param args - The arguments for creating the correctness evaluator.
|
|
23
|
+
* @param args.model - The model to use for classification.
|
|
24
|
+
* @param args.choices - The possible classification choices (defaults to CORRECTNESS_CHOICES).
|
|
25
|
+
* @param args.promptTemplate - The prompt template to use (defaults to CORRECTNESS_TEMPLATE).
|
|
26
|
+
* @param args.telemetry - The telemetry to use for the evaluator.
|
|
27
|
+
*
|
|
28
|
+
* @returns An evaluator function that takes a {@link CorrectnessEvaluationRecord} and returns a classification result
|
|
29
|
+
* indicating whether the output is correct or incorrect.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* const evaluator = createCorrectnessEvaluator({ model: openai("gpt-4o-mini") });
|
|
34
|
+
* const result = await evaluator.evaluate({
|
|
35
|
+
* input: "What is the capital of France?",
|
|
36
|
+
* output: "Paris is the capital of France.",
|
|
37
|
+
* });
|
|
38
|
+
* console.log(result.label); // "correct" or "incorrect"
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function createCorrectnessEvaluator<RecordType extends Record<string, unknown> = CorrectnessEvaluationRecord>(args: CorrectnessEvaluatorArgs<RecordType>): ClassificationEvaluator<RecordType>;
|
|
42
|
+
//# sourceMappingURL=createCorrectnessEvaluator.d.ts.map
|
|
@@ -0,0 +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,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"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { CORRECTNESS_CLASSIFICATION_EVALUATOR_CONFIG } from "../__generated__/default_templates/index.js";
|
|
2
|
+
import { createClassificationEvaluator } from "./createClassificationEvaluator.js";
|
|
3
|
+
/**
|
|
4
|
+
* Creates a correctness evaluator function.
|
|
5
|
+
*
|
|
6
|
+
* This function returns an evaluator that determines whether a given output
|
|
7
|
+
* is factually accurate, complete, logically consistent, and uses precise terminology.
|
|
8
|
+
*
|
|
9
|
+
* @param args - The arguments for creating the correctness evaluator.
|
|
10
|
+
* @param args.model - The model to use for classification.
|
|
11
|
+
* @param args.choices - The possible classification choices (defaults to CORRECTNESS_CHOICES).
|
|
12
|
+
* @param args.promptTemplate - The prompt template to use (defaults to CORRECTNESS_TEMPLATE).
|
|
13
|
+
* @param args.telemetry - The telemetry to use for the evaluator.
|
|
14
|
+
*
|
|
15
|
+
* @returns An evaluator function that takes a {@link CorrectnessEvaluationRecord} and returns a classification result
|
|
16
|
+
* indicating whether the output is correct or incorrect.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const evaluator = createCorrectnessEvaluator({ model: openai("gpt-4o-mini") });
|
|
21
|
+
* const result = await evaluator.evaluate({
|
|
22
|
+
* input: "What is the capital of France?",
|
|
23
|
+
* output: "Paris is the capital of France.",
|
|
24
|
+
* });
|
|
25
|
+
* console.log(result.label); // "correct" or "incorrect"
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export function createCorrectnessEvaluator(args) {
|
|
29
|
+
const { choices = CORRECTNESS_CLASSIFICATION_EVALUATOR_CONFIG.choices, promptTemplate = CORRECTNESS_CLASSIFICATION_EVALUATOR_CONFIG.template, optimizationDirection = CORRECTNESS_CLASSIFICATION_EVALUATOR_CONFIG.optimizationDirection, name = CORRECTNESS_CLASSIFICATION_EVALUATOR_CONFIG.name, ...rest } = args;
|
|
30
|
+
return createClassificationEvaluator({
|
|
31
|
+
...rest,
|
|
32
|
+
promptTemplate,
|
|
33
|
+
choices,
|
|
34
|
+
optimizationDirection,
|
|
35
|
+
name,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=createCorrectnessEvaluator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createCorrectnessEvaluator.js","sourceRoot":"","sources":["../../../src/llm/createCorrectnessEvaluator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2CAA2C,EAAE,MAAM,oCAAoC,CAAC;AAIjG,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAsBhF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,0BAA0B,CAGxC,IAA0C;IAE1C,MAAM,EACJ,OAAO,GAAG,2CAA2C,CAAC,OAAO,EAC7D,cAAc,GAAG,2CAA2C,CAAC,QAAQ,EACrE,qBAAqB,GAAG,2CAA2C,CAAC,qBAAqB,EACzF,IAAI,GAAG,2CAA2C,CAAC,IAAI,EACvD,GAAG,IAAI,EACR,GAAG,IAAI,CAAC;IACT,OAAO,6BAA6B,CAAa;QAC/C,GAAG,IAAI;QACP,cAAc;QACd,OAAO;QACP,qBAAqB;QACrB,IAAI;KACL,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -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,
|
|
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":"AAAA,OAAO,EAAE,kDAAkD,EAAE,MAAM,oCAAoC,CAAC;AAIxG,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"createDocumentRelevanceEvaluator.js","sourceRoot":"","sources":["../../../src/llm/createDocumentRelevanceEvaluator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kDAAkD,EAAE,MAAM,oCAAoC,CAAC;AAIxG,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAwBhF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,gCAAgC,CAI9C,IAAgD;IAEhD,MAAM,EACJ,OAAO,GAAG,kDAAkD,CAAC,OAAO,EACpE,cAAc,GAAG,kDAAkD,CAAC,QAAQ,EAC5E,qBAAqB,GAAG,kDAAkD,CAAC,qBAAqB,EAChG,IAAI,GAAG,kDAAkD,CAAC,IAAI,EAC9D,GAAG,IAAI,EACR,GAAG,IAAI,CAAC;IACT,OAAO,6BAA6B,CAAa;QAC/C,GAAG,IAAI;QACP,cAAc;QACd,OAAO;QACP,qBAAqB;QACrB,IAAI;KACL,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { CreateClassificationEvaluatorArgs } from "../types/evals.js";
|
|
2
|
+
import { ClassificationEvaluator } from "./ClassificationEvaluator.js";
|
|
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,19 @@
|
|
|
1
|
+
import { FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG } from "../__generated__/default_templates/index.js";
|
|
2
|
+
import { createClassificationEvaluator } from "./createClassificationEvaluator.js";
|
|
3
|
+
/**
|
|
4
|
+
* Creates a function that evaluates whether an answer is faithful or unfaithful based on a query and reference text.
|
|
5
|
+
*
|
|
6
|
+
* @param args - The arguments for creating the faithfulness evaluator.
|
|
7
|
+
* @returns A function that evaluates whether an answer is faithful or unfaithful based on a query and reference text.
|
|
8
|
+
*/
|
|
9
|
+
export function createFaithfulnessEvaluator(args) {
|
|
10
|
+
const { choices = FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.choices, promptTemplate = FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.template, optimizationDirection = FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.optimizationDirection, name = FAITHFULNESS_CLASSIFICATION_EVALUATOR_CONFIG.name, ...rest } = args;
|
|
11
|
+
return createClassificationEvaluator({
|
|
12
|
+
...rest,
|
|
13
|
+
promptTemplate,
|
|
14
|
+
choices,
|
|
15
|
+
optimizationDirection,
|
|
16
|
+
name,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=createFaithfulnessEvaluator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createFaithfulnessEvaluator.js","sourceRoot":"","sources":["../../../src/llm/createFaithfulnessEvaluator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4CAA4C,EAAE,MAAM,oCAAoC,CAAC;AAIlG,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAsBhF;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CAGzC,IAA2C;IAE3C,MAAM,EACJ,OAAO,GAAG,4CAA4C,CAAC,OAAO,EAC9D,cAAc,GAAG,4CAA4C,CAAC,QAAQ,EACtE,qBAAqB,GAAG,4CAA4C,CAAC,qBAAqB,EAC1F,IAAI,GAAG,4CAA4C,CAAC,IAAI,EACxD,GAAG,IAAI,EACR,GAAG,IAAI,CAAC;IACT,OAAO,6BAA6B,CAAa;QAC/C,GAAG,IAAI;QACP,cAAc;QACd,OAAO;QACP,qBAAqB;QACrB,IAAI;KACL,CAAC,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.js";
|
|
2
8
|
import { ClassificationEvaluator } from "./ClassificationEvaluator.js";
|
|
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":"
|
|
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,12 +1,29 @@
|
|
|
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 { HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG } from "../__generated__/default_templates/index.js";
|
|
2
8
|
import { createClassificationEvaluator } from "./createClassificationEvaluator.js";
|
|
3
9
|
/**
|
|
10
|
+
* @deprecated Use createFaithfulnessEvaluator instead.
|
|
11
|
+
*
|
|
4
12
|
* Creates a function that evaluates whether an answer is factual or hallucinated based on a query and reference text.
|
|
5
13
|
*
|
|
14
|
+
* Note: This is deprecated. Please use createFaithfulnessEvaluator which:
|
|
15
|
+
* - Uses 'faithful'/'unfaithful' labels instead of 'factual'/'hallucinated'
|
|
16
|
+
* - Maximizes the score (1.0 for faithful, 0.0 for unfaithful)
|
|
17
|
+
*
|
|
6
18
|
* @param args - The arguments for creating the hallucination evaluator.
|
|
7
19
|
* @returns A function that evaluates whether an answer is factual or hallucinated based on a query and reference text.
|
|
8
20
|
*/
|
|
9
21
|
export function createHallucinationEvaluator(args) {
|
|
22
|
+
// eslint-disable-next-line no-console
|
|
23
|
+
console.warn("createHallucinationEvaluator is deprecated and will be removed in a future version. " +
|
|
24
|
+
"Please use createFaithfulnessEvaluator instead. The new evaluator uses " +
|
|
25
|
+
"'faithful'/'unfaithful' labels and maximizes score (1.0=faithful) instead of " +
|
|
26
|
+
"minimizing it (0.0=factual).");
|
|
10
27
|
const { choices = HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.choices, promptTemplate = HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.template, optimizationDirection = HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.optimizationDirection, name = HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.name, ...rest } = args;
|
|
11
28
|
return createClassificationEvaluator({
|
|
12
29
|
...rest,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createHallucinationEvaluator.js","sourceRoot":"","sources":["../../../src/llm/createHallucinationEvaluator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6CAA6C,EAAE,MAAM,oCAAoC,CAAC;AAInG,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"createHallucinationEvaluator.js","sourceRoot":"","sources":["../../../src/llm/createHallucinationEvaluator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,6CAA6C,EAAE,MAAM,oCAAoC,CAAC;AAInG,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAuBhF;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,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,6CAA6C,CAAC,OAAO,EAC/D,cAAc,GAAG,6CAA6C,CAAC,QAAQ,EACvE,qBAAqB,GAAG,6CAA6C,CAAC,qBAAqB,EAC3F,IAAI,GAAG,6CAA6C,CAAC,IAAI,EACzD,GAAG,IAAI,EACR,GAAG,IAAI,CAAC;IACT,OAAO,6BAA6B,CAAa;QAC/C,GAAG,IAAI;QACP,cAAc;QACd,OAAO;QACP,qBAAqB;QACrB,IAAI;KACL,CAAC,CAAC;AACL,CAAC"}
|