@arizeai/phoenix-evals 0.0.6 → 0.0.8
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/default_templates/DOCUMENT_RELEVANCY_TEMPLATE.d.ts +6 -0
- package/dist/esm/default_templates/DOCUMENT_RELEVANCY_TEMPLATE.d.ts.map +1 -0
- package/dist/esm/default_templates/DOCUMENT_RELEVANCY_TEMPLATE.js +25 -0
- package/dist/esm/default_templates/DOCUMENT_RELEVANCY_TEMPLATE.js.map +1 -0
- package/dist/esm/default_templates/index.d.ts +1 -0
- package/dist/esm/default_templates/index.d.ts.map +1 -1
- package/dist/esm/default_templates/index.js +1 -0
- package/dist/esm/default_templates/index.js.map +1 -1
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/llm/createClassifier.d.ts +1 -1
- package/dist/esm/llm/createClassifier.d.ts.map +1 -1
- package/dist/esm/llm/createClassifier.js.map +1 -1
- package/dist/esm/llm/createDocumentRelevancyEvaluator.d.ts +40 -0
- package/dist/esm/llm/createDocumentRelevancyEvaluator.d.ts.map +1 -0
- package/dist/esm/llm/createDocumentRelevancyEvaluator.js +39 -0
- package/dist/esm/llm/createDocumentRelevancyEvaluator.js.map +1 -0
- package/dist/esm/llm/createHallucinationEvaluator.d.ts +11 -3
- package/dist/esm/llm/createHallucinationEvaluator.d.ts.map +1 -1
- package/dist/esm/llm/createHallucinationEvaluator.js.map +1 -1
- package/dist/esm/llm/generateClassification.d.ts +1 -2
- package/dist/esm/llm/generateClassification.d.ts.map +1 -1
- package/dist/esm/llm/index.d.ts +1 -0
- package/dist/esm/llm/index.d.ts.map +1 -1
- package/dist/esm/llm/index.js +1 -0
- package/dist/esm/llm/index.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/types/evals.d.ts +4 -4
- package/dist/esm/types/evals.d.ts.map +1 -1
- package/dist/esm/types/prompts.d.ts +7 -6
- package/dist/esm/types/prompts.d.ts.map +1 -1
- package/dist/src/default_templates/DOCUMENT_RELEVANCY_TEMPLATE.d.ts +6 -0
- package/dist/src/default_templates/DOCUMENT_RELEVANCY_TEMPLATE.d.ts.map +1 -0
- package/dist/src/default_templates/DOCUMENT_RELEVANCY_TEMPLATE.js +28 -0
- package/dist/src/default_templates/DOCUMENT_RELEVANCY_TEMPLATE.js.map +1 -0
- package/dist/src/default_templates/index.d.ts +1 -0
- package/dist/src/default_templates/index.d.ts.map +1 -1
- package/dist/src/default_templates/index.js +1 -0
- package/dist/src/default_templates/index.js.map +1 -1
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/llm/createClassifier.d.ts +1 -1
- package/dist/src/llm/createClassifier.d.ts.map +1 -1
- package/dist/src/llm/createClassifier.js.map +1 -1
- package/dist/src/llm/createDocumentRelevancyEvaluator.d.ts +40 -0
- package/dist/src/llm/createDocumentRelevancyEvaluator.d.ts.map +1 -0
- package/dist/src/llm/createDocumentRelevancyEvaluator.js +49 -0
- package/dist/src/llm/createDocumentRelevancyEvaluator.js.map +1 -0
- package/dist/src/llm/createHallucinationEvaluator.d.ts +11 -3
- package/dist/src/llm/createHallucinationEvaluator.d.ts.map +1 -1
- package/dist/src/llm/createHallucinationEvaluator.js.map +1 -1
- package/dist/src/llm/generateClassification.d.ts +1 -2
- package/dist/src/llm/generateClassification.d.ts.map +1 -1
- package/dist/src/llm/index.d.ts +1 -0
- package/dist/src/llm/index.d.ts.map +1 -1
- package/dist/src/llm/index.js +1 -0
- package/dist/src/llm/index.js.map +1 -1
- package/dist/src/types/evals.d.ts +4 -4
- package/dist/src/types/evals.d.ts.map +1 -1
- package/dist/src/types/prompts.d.ts +7 -6
- package/dist/src/types/prompts.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/src/default_templates/DOCUMENT_RELEVANCY_TEMPLATE.ts +25 -0
- package/src/default_templates/index.ts +1 -0
- package/src/index.ts +2 -0
- package/src/llm/createClassifier.ts +3 -6
- package/src/llm/createDocumentRelevancyEvaluator.ts +64 -0
- package/src/llm/createHallucinationEvaluator.ts +13 -3
- package/src/llm/generateClassification.ts +1 -1
- package/src/llm/index.ts +1 -0
- package/src/types/evals.ts +5 -7
- package/src/types/prompts.ts +7 -6
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const DOCUMENT_RELEVANCY_TEMPLATE = "\nYou are comparing a document to a question and trying to determine if the document text\ncontains information relevant to answering the question. Here is the data:\n\n [BEGIN DATA]\n ************\n [Question]: {{input}}\n ************\n [Document text]: {{documentText}}\n ************\n [END DATA]\n\nCompare the Question above to the Document text. You must determine whether the Document text\ncontains information that can answer the Question. Please focus on whether the very specific\nquestion can be answered by the information in the Document text.\nYour response must be single word, either \"relevant\" or \"unrelated\",\nand should not contain any text or characters aside from that word.\n\"unrelated\" means that the document text does not contain an answer to the Question.\n\"relevant\" means the document text contains an answer to the Question.\n";
|
|
2
|
+
export declare const DOCUMENT_RELEVANCY_CHOICES: {
|
|
3
|
+
relevant: number;
|
|
4
|
+
unrelated: number;
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=DOCUMENT_RELEVANCY_TEMPLATE.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DOCUMENT_RELEVANCY_TEMPLATE.d.ts","sourceRoot":"","sources":["../../../src/default_templates/DOCUMENT_RELEVANCY_TEMPLATE.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,2BAA2B,23BAmBvC,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;CAGtC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export const DOCUMENT_RELEVANCY_TEMPLATE = `
|
|
2
|
+
You are comparing a document to a question and trying to determine if the document text
|
|
3
|
+
contains information relevant to answering the question. Here is the data:
|
|
4
|
+
|
|
5
|
+
[BEGIN DATA]
|
|
6
|
+
************
|
|
7
|
+
[Question]: {{input}}
|
|
8
|
+
************
|
|
9
|
+
[Document text]: {{documentText}}
|
|
10
|
+
************
|
|
11
|
+
[END DATA]
|
|
12
|
+
|
|
13
|
+
Compare the Question above to the Document text. You must determine whether the Document text
|
|
14
|
+
contains information that can answer the Question. Please focus on whether the very specific
|
|
15
|
+
question can be answered by the information in the Document text.
|
|
16
|
+
Your response must be single word, either "relevant" or "unrelated",
|
|
17
|
+
and should not contain any text or characters aside from that word.
|
|
18
|
+
"unrelated" means that the document text does not contain an answer to the Question.
|
|
19
|
+
"relevant" means the document text contains an answer to the Question.
|
|
20
|
+
`;
|
|
21
|
+
export const DOCUMENT_RELEVANCY_CHOICES = {
|
|
22
|
+
relevant: 1,
|
|
23
|
+
unrelated: 0,
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=DOCUMENT_RELEVANCY_TEMPLATE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DOCUMENT_RELEVANCY_TEMPLATE.js","sourceRoot":"","sources":["../../../src/default_templates/DOCUMENT_RELEVANCY_TEMPLATE.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,2BAA2B,GAAG;;;;;;;;;;;;;;;;;;;CAmB1C,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,QAAQ,EAAE,CAAC;IACX,SAAS,EAAE,CAAC;CACb,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/default_templates/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/default_templates/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/default_templates/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/default_templates/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC"}
|
package/dist/esm/index.d.ts
CHANGED
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
|
package/dist/esm/index.js
CHANGED
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
|
|
@@ -2,5 +2,5 @@ import { CreateClassifierArgs, EvaluatorFn } from "../types/evals.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* A function that serves as a factory that will output a classification evaluator
|
|
4
4
|
*/
|
|
5
|
-
export declare function createClassifier<
|
|
5
|
+
export declare function createClassifier<ExampleType extends Record<string, unknown>>(args: CreateClassifierArgs): EvaluatorFn<ExampleType>;
|
|
6
6
|
//# sourceMappingURL=createClassifier.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createClassifier.d.ts","sourceRoot":"","sources":["../../../src/llm/createClassifier.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"createClassifier.d.ts","sourceRoot":"","sources":["../../../src/llm/createClassifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,oBAAoB,EACpB,WAAW,EACZ,MAAM,gBAAgB,CAAC;AAkBxB;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC1E,IAAI,EAAE,oBAAoB,GACzB,WAAW,CAAC,WAAW,CAAC,CA4B1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createClassifier.js","sourceRoot":"","sources":["../../../src/llm/createClassifier.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createClassifier.js","sourceRoot":"","sources":["../../../src/llm/createClassifier.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C;;;GAGG;AACH,SAAS,eAAe,CACtB,OAAiC;IAEjC,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpC,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACzC,CAAC;IACD,OAAO,MAA+B,CAAC;AACzC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAA0B;IAE1B,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;IAEzD,OAAO,KAAK,EAAE,IAAiB,EAA6B,EAAE;QAC5D,MAAM,iBAAiB,GAAG;YACxB,GAAG,IAAI;SACR,CAAC;QAEF,MAAM,MAAM,GAAG,cAAc,CAAC;YAC5B,QAAQ,EAAE,cAAc;YACxB,SAAS,EAAE,iBAAiB;SAC7B,CAAC,CAAC;QAEH,MAAM,cAAc,GAAG,MAAM,sBAAsB,CAAC;YAClD,KAAK;YACL,MAAM,EAAE,eAAe,CAAC,OAAO,CAAC;YAChC,MAAM;YACN,GAAG,IAAI;SACR,CAAC,CAAC;QAEH,mEAAmE;QACnE,MAAM,KAAK,GAAG,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QAE5C,OAAO;YACL,KAAK;YACL,GAAG,cAAc;SAClB,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { CreateClassifierArgs, EvaluatorFn } from "../types/evals.js";
|
|
2
|
+
export interface DocumentRelevancyEvaluatorArgs extends Omit<CreateClassifierArgs, "promptTemplate" | "choices"> {
|
|
3
|
+
choices?: CreateClassifierArgs["choices"];
|
|
4
|
+
promptTemplate?: CreateClassifierArgs["promptTemplate"];
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* An example to be evaluated by the document relevancy evaluator.
|
|
8
|
+
*/
|
|
9
|
+
export type DocumentRelevancyExample = {
|
|
10
|
+
input: string;
|
|
11
|
+
documentText: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Creates a document relevancy evaluator function.
|
|
15
|
+
*
|
|
16
|
+
* This function returns an evaluator that determines whether a given document text
|
|
17
|
+
* is relevant to a provided input question. The evaluator uses a classification model
|
|
18
|
+
* and a prompt template to make its determination.
|
|
19
|
+
*
|
|
20
|
+
* @param args - The arguments for creating the document relevancy evaluator.
|
|
21
|
+
* @param args.model - The model to use for classification.
|
|
22
|
+
* @param args.choices - The possible classification choices (defaults to DOCUMENT_RELEVANCY_CHOICES).
|
|
23
|
+
* @param args.promptTemplate - The prompt template to use (defaults to DOCUMENT_RELEVANCY_TEMPLATE).
|
|
24
|
+
* @param args.telemetry - The telemetry to use for the evaluator.
|
|
25
|
+
*
|
|
26
|
+
* @returns An evaluator function that takes a {@link DocumentRelevancyExample} and returns a classification result
|
|
27
|
+
* indicating whether the document is relevant to the input question.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* const evaluator = createDocumentRelevancyEvaluator({ model: openai("gpt-4o-mini") });
|
|
32
|
+
* const result = await evaluator({
|
|
33
|
+
* input: "What is the capital of France?",
|
|
34
|
+
* documentText: "Paris is the capital and most populous city of France.",
|
|
35
|
+
* });
|
|
36
|
+
* console.log(result.label); // "relevant" or "unrelated"
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare function createDocumentRelevancyEvaluator(args: DocumentRelevancyEvaluatorArgs): EvaluatorFn<DocumentRelevancyExample>;
|
|
40
|
+
//# sourceMappingURL=createDocumentRelevancyEvaluator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createDocumentRelevancyEvaluator.d.ts","sourceRoot":"","sources":["../../../src/llm/createDocumentRelevancyEvaluator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAMnE,MAAM,WAAW,8BACf,SAAQ,IAAI,CAAC,oBAAoB,EAAE,gBAAgB,GAAG,SAAS,CAAC;IAChE,OAAO,CAAC,EAAE,oBAAoB,CAAC,SAAS,CAAC,CAAC;IAC1C,cAAc,CAAC,EAAE,oBAAoB,CAAC,gBAAgB,CAAC,CAAC;CACzD;AAED;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,gCAAgC,CAC9C,IAAI,EAAE,8BAA8B,GACnC,WAAW,CAAC,wBAAwB,CAAC,CAcvC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { createClassifier } from "./createClassifier.js";
|
|
2
|
+
import { DOCUMENT_RELEVANCY_TEMPLATE, DOCUMENT_RELEVANCY_CHOICES, } from "../default_templates/DOCUMENT_RELEVANCY_TEMPLATE.js";
|
|
3
|
+
/**
|
|
4
|
+
* Creates a document relevancy evaluator function.
|
|
5
|
+
*
|
|
6
|
+
* This function returns an evaluator that determines whether a given document text
|
|
7
|
+
* is relevant to a provided input question. The evaluator uses a classification model
|
|
8
|
+
* and a prompt template to make its determination.
|
|
9
|
+
*
|
|
10
|
+
* @param args - The arguments for creating the document relevancy evaluator.
|
|
11
|
+
* @param args.model - The model to use for classification.
|
|
12
|
+
* @param args.choices - The possible classification choices (defaults to DOCUMENT_RELEVANCY_CHOICES).
|
|
13
|
+
* @param args.promptTemplate - The prompt template to use (defaults to DOCUMENT_RELEVANCY_TEMPLATE).
|
|
14
|
+
* @param args.telemetry - The telemetry to use for the evaluator.
|
|
15
|
+
*
|
|
16
|
+
* @returns An evaluator function that takes a {@link DocumentRelevancyExample} and returns a classification result
|
|
17
|
+
* indicating whether the document is relevant to the input question.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const evaluator = createDocumentRelevancyEvaluator({ model: openai("gpt-4o-mini") });
|
|
22
|
+
* const result = await evaluator({
|
|
23
|
+
* input: "What is the capital of France?",
|
|
24
|
+
* documentText: "Paris is the capital and most populous city of France.",
|
|
25
|
+
* });
|
|
26
|
+
* console.log(result.label); // "relevant" or "unrelated"
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export function createDocumentRelevancyEvaluator(args) {
|
|
30
|
+
const { choices = DOCUMENT_RELEVANCY_CHOICES, promptTemplate = DOCUMENT_RELEVANCY_TEMPLATE, ...rest } = args;
|
|
31
|
+
const documentRelevancyEvaluatorFn = createClassifier({
|
|
32
|
+
...args,
|
|
33
|
+
promptTemplate,
|
|
34
|
+
choices,
|
|
35
|
+
...rest,
|
|
36
|
+
});
|
|
37
|
+
return documentRelevancyEvaluatorFn;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=createDocumentRelevancyEvaluator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createDocumentRelevancyEvaluator.js","sourceRoot":"","sources":["../../../src/llm/createDocumentRelevancyEvaluator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EACL,2BAA2B,EAC3B,0BAA0B,GAC3B,MAAM,kDAAkD,CAAC;AAgB1D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,gCAAgC,CAC9C,IAAoC;IAEpC,MAAM,EACJ,OAAO,GAAG,0BAA0B,EACpC,cAAc,GAAG,2BAA2B,EAC5C,GAAG,IAAI,EACR,GAAG,IAAI,CAAC;IACT,MAAM,4BAA4B,GAChC,gBAAgB,CAA2B;QACzC,GAAG,IAAI;QACP,cAAc;QACd,OAAO;QACP,GAAG,IAAI;KACR,CAAC,CAAC;IACL,OAAO,4BAA4B,CAAC;AACtC,CAAC"}
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import { CreateClassifierArgs, EvaluatorFn } from "../types/evals.js";
|
|
2
|
-
interface HallucinationEvaluatorArgs extends Omit<CreateClassifierArgs, "promptTemplate" | "choices"> {
|
|
2
|
+
export interface HallucinationEvaluatorArgs extends Omit<CreateClassifierArgs, "promptTemplate" | "choices"> {
|
|
3
3
|
choices?: CreateClassifierArgs["choices"];
|
|
4
4
|
promptTemplate?: CreateClassifierArgs["promptTemplate"];
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* An example to be evaluated by the hallucination evaluator.
|
|
8
|
+
*/
|
|
9
|
+
export type HallucinationExample = {
|
|
10
|
+
input: string;
|
|
11
|
+
output: string;
|
|
12
|
+
reference?: string;
|
|
13
|
+
context?: string;
|
|
14
|
+
};
|
|
6
15
|
/**
|
|
7
16
|
* Creates a function that evaluates whether an answer is factual or hallucinated based on a query and reference text.
|
|
8
17
|
*
|
|
9
18
|
* @param args - The arguments for creating the hallucination evaluator.
|
|
10
19
|
* @returns A function that evaluates whether an answer is factual or hallucinated based on a query and reference text.
|
|
11
20
|
*/
|
|
12
|
-
export declare function createHallucinationEvaluator(args: HallucinationEvaluatorArgs): EvaluatorFn<
|
|
13
|
-
export {};
|
|
21
|
+
export declare function createHallucinationEvaluator(args: HallucinationEvaluatorArgs): EvaluatorFn<HallucinationExample>;
|
|
14
22
|
//# sourceMappingURL=createHallucinationEvaluator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createHallucinationEvaluator.d.ts","sourceRoot":"","sources":["../../../src/llm/createHallucinationEvaluator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAMnE,
|
|
1
|
+
{"version":3,"file":"createHallucinationEvaluator.d.ts","sourceRoot":"","sources":["../../../src/llm/createHallucinationEvaluator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAMnE,MAAM,WAAW,0BACf,SAAQ,IAAI,CAAC,oBAAoB,EAAE,gBAAgB,GAAG,SAAS,CAAC;IAChE,OAAO,CAAC,EAAE,oBAAoB,CAAC,SAAS,CAAC,CAAC;IAC1C,cAAc,CAAC,EAAE,oBAAoB,CAAC,gBAAgB,CAAC,CAAC;CACzD;AAED;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AACF;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,0BAA0B,GAC/B,WAAW,CAAC,oBAAoB,CAAC,CAanC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createHallucinationEvaluator.js","sourceRoot":"","sources":["../../../src/llm/createHallucinationEvaluator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EACL,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,6CAA6C,CAAC;
|
|
1
|
+
{"version":3,"file":"createHallucinationEvaluator.js","sourceRoot":"","sources":["../../../src/llm/createHallucinationEvaluator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EACL,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,6CAA6C,CAAC;AAiBrD;;;;;GAKG;AACH,MAAM,UAAU,4BAA4B,CAC1C,IAAgC;IAEhC,MAAM,EACJ,OAAO,GAAG,qBAAqB,EAC/B,cAAc,GAAG,sBAAsB,EACvC,GAAG,IAAI,EACR,GAAG,IAAI,CAAC;IACT,MAAM,wBAAwB,GAAG,gBAAgB,CAAuB;QACtE,GAAG,IAAI;QACP,cAAc;QACd,OAAO;QACP,GAAG,IAAI;KACR,CAAC,CAAC;IACH,OAAO,wBAAwB,CAAC;AAClC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ClassificationResult, WithLLM } from "../types/evals.js";
|
|
2
2
|
import { WithTelemetry } from "../types/otel.js";
|
|
3
3
|
import type { WithPrompt } from "../types/prompts.js";
|
|
4
|
-
interface ClassifyArgs extends WithLLM, WithPrompt, WithTelemetry {
|
|
4
|
+
export interface ClassifyArgs extends WithLLM, WithPrompt, WithTelemetry {
|
|
5
5
|
/**
|
|
6
6
|
* The labels to classify the example into. E.x. ["correct", "incorrect"]
|
|
7
7
|
*/
|
|
@@ -19,5 +19,4 @@ interface ClassifyArgs extends WithLLM, WithPrompt, WithTelemetry {
|
|
|
19
19
|
* A function that leverages an llm to perform a classification
|
|
20
20
|
*/
|
|
21
21
|
export declare function generateClassification(args: ClassifyArgs): Promise<ClassificationResult>;
|
|
22
|
-
export {};
|
|
23
22
|
//# sourceMappingURL=generateClassification.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateClassification.d.ts","sourceRoot":"","sources":["../../../src/llm/generateClassification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAInD,
|
|
1
|
+
{"version":3,"file":"generateClassification.d.ts","sourceRoot":"","sources":["../../../src/llm/generateClassification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAInD,MAAM,WAAW,YAAa,SAAQ,OAAO,EAAE,UAAU,EAAE,aAAa;IACtE;;OAEG;IACH,MAAM,EAAE,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;IAC9B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AACD;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,YAAY,GACjB,OAAO,CAAC,oBAAoB,CAAC,CAyB/B"}
|
package/dist/esm/llm/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/llm/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gCAAgC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/llm/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC"}
|
package/dist/esm/llm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/llm/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gCAAgC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/llm/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC"}
|