@arizeai/phoenix-evals 0.6.0 → 0.6.1

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 (96) hide show
  1. package/dist/esm/__generated__/default_templates/DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG.d.ts +3 -0
  2. package/dist/esm/__generated__/default_templates/DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG.d.ts.map +1 -0
  3. package/dist/esm/__generated__/default_templates/DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG.js +37 -0
  4. package/dist/esm/__generated__/default_templates/DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG.js.map +1 -0
  5. package/dist/esm/__generated__/default_templates/HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.d.ts +3 -0
  6. package/dist/esm/__generated__/default_templates/HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.d.ts.map +1 -0
  7. package/dist/esm/__generated__/default_templates/HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.js +43 -0
  8. package/dist/esm/__generated__/default_templates/HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.js.map +1 -0
  9. package/dist/esm/__generated__/default_templates/index.d.ts +3 -0
  10. package/dist/esm/__generated__/default_templates/index.d.ts.map +1 -0
  11. package/dist/esm/__generated__/default_templates/index.js +4 -0
  12. package/dist/esm/__generated__/default_templates/index.js.map +1 -0
  13. package/dist/esm/__generated__/types.d.ts +9 -0
  14. package/dist/esm/__generated__/types.d.ts.map +1 -0
  15. package/dist/esm/__generated__/types.js +3 -0
  16. package/dist/esm/__generated__/types.js.map +1 -0
  17. package/dist/esm/llm/{createDocumentRelevancyEvaluator.d.ts → createDocumentRelevanceEvaluator.d.ts} +11 -11
  18. package/dist/esm/llm/{createDocumentRelevancyEvaluator.d.ts.map → createDocumentRelevanceEvaluator.d.ts.map} +1 -1
  19. package/dist/esm/llm/{createDocumentRelevancyEvaluator.js → createDocumentRelevanceEvaluator.js} +10 -10
  20. package/dist/esm/llm/createDocumentRelevanceEvaluator.js.map +1 -0
  21. package/dist/esm/llm/createHallucinationEvaluator.d.ts +0 -1
  22. package/dist/esm/llm/createHallucinationEvaluator.d.ts.map +1 -1
  23. package/dist/esm/llm/createHallucinationEvaluator.js +2 -2
  24. package/dist/esm/llm/createHallucinationEvaluator.js.map +1 -1
  25. package/dist/esm/llm/index.d.ts +1 -1
  26. package/dist/esm/llm/index.js +1 -1
  27. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  28. package/dist/esm/utils/bindEvaluator.d.ts +1 -1
  29. package/dist/esm/utils/bindEvaluator.js +1 -1
  30. package/dist/src/__generated__/default_templates/DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG.d.ts +3 -0
  31. package/dist/src/__generated__/default_templates/DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG.d.ts.map +1 -0
  32. package/dist/src/__generated__/default_templates/DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG.js +40 -0
  33. package/dist/src/__generated__/default_templates/DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG.js.map +1 -0
  34. package/dist/src/__generated__/default_templates/HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.d.ts +3 -0
  35. package/dist/src/__generated__/default_templates/HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.d.ts.map +1 -0
  36. package/dist/src/__generated__/default_templates/HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.js +46 -0
  37. package/dist/src/__generated__/default_templates/HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.js.map +1 -0
  38. package/dist/src/__generated__/default_templates/index.d.ts +3 -0
  39. package/dist/src/__generated__/default_templates/index.d.ts.map +1 -0
  40. package/dist/src/__generated__/default_templates/index.js +9 -0
  41. package/dist/src/__generated__/default_templates/index.js.map +1 -0
  42. package/dist/src/__generated__/types.d.ts +9 -0
  43. package/dist/src/__generated__/types.d.ts.map +1 -0
  44. package/dist/src/__generated__/types.js +4 -0
  45. package/dist/src/__generated__/types.js.map +1 -0
  46. package/dist/src/llm/{createDocumentRelevancyEvaluator.d.ts → createDocumentRelevanceEvaluator.d.ts} +11 -11
  47. package/dist/src/llm/{createDocumentRelevancyEvaluator.d.ts.map → createDocumentRelevanceEvaluator.d.ts.map} +1 -1
  48. package/dist/src/llm/{createDocumentRelevancyEvaluator.js → createDocumentRelevanceEvaluator.js} +11 -11
  49. package/dist/src/llm/createDocumentRelevanceEvaluator.js.map +1 -0
  50. package/dist/src/llm/createHallucinationEvaluator.d.ts +0 -1
  51. package/dist/src/llm/createHallucinationEvaluator.d.ts.map +1 -1
  52. package/dist/src/llm/createHallucinationEvaluator.js +2 -2
  53. package/dist/src/llm/createHallucinationEvaluator.js.map +1 -1
  54. package/dist/src/llm/index.d.ts +1 -1
  55. package/dist/src/llm/index.js +1 -1
  56. package/dist/src/utils/bindEvaluator.d.ts +1 -1
  57. package/dist/src/utils/bindEvaluator.js +1 -1
  58. package/dist/tsconfig.tsbuildinfo +1 -1
  59. package/package.json +1 -1
  60. package/src/__generated__/default_templates/DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG.ts +39 -0
  61. package/src/__generated__/default_templates/HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.ts +45 -0
  62. package/src/__generated__/default_templates/index.ts +4 -0
  63. package/src/__generated__/types.ts +11 -0
  64. package/src/llm/{createDocumentRelevancyEvaluator.ts → createDocumentRelevanceEvaluator.ts} +18 -21
  65. package/src/llm/createHallucinationEvaluator.ts +5 -9
  66. package/src/llm/index.ts +1 -1
  67. package/src/utils/bindEvaluator.ts +1 -1
  68. package/dist/esm/default_templates/DOCUMENT_RELEVANCY_TEMPLATE.d.ts +0 -6
  69. package/dist/esm/default_templates/DOCUMENT_RELEVANCY_TEMPLATE.d.ts.map +0 -1
  70. package/dist/esm/default_templates/DOCUMENT_RELEVANCY_TEMPLATE.js +0 -25
  71. package/dist/esm/default_templates/DOCUMENT_RELEVANCY_TEMPLATE.js.map +0 -1
  72. package/dist/esm/default_templates/HALLUCINATION_TEMPLATE.d.ts +0 -6
  73. package/dist/esm/default_templates/HALLUCINATION_TEMPLATE.d.ts.map +0 -1
  74. package/dist/esm/default_templates/HALLUCINATION_TEMPLATE.js +0 -31
  75. package/dist/esm/default_templates/HALLUCINATION_TEMPLATE.js.map +0 -1
  76. package/dist/esm/default_templates/index.d.ts +0 -3
  77. package/dist/esm/default_templates/index.d.ts.map +0 -1
  78. package/dist/esm/default_templates/index.js +0 -3
  79. package/dist/esm/default_templates/index.js.map +0 -1
  80. package/dist/esm/llm/createDocumentRelevancyEvaluator.js.map +0 -1
  81. package/dist/src/default_templates/DOCUMENT_RELEVANCY_TEMPLATE.d.ts +0 -6
  82. package/dist/src/default_templates/DOCUMENT_RELEVANCY_TEMPLATE.d.ts.map +0 -1
  83. package/dist/src/default_templates/DOCUMENT_RELEVANCY_TEMPLATE.js +0 -28
  84. package/dist/src/default_templates/DOCUMENT_RELEVANCY_TEMPLATE.js.map +0 -1
  85. package/dist/src/default_templates/HALLUCINATION_TEMPLATE.d.ts +0 -6
  86. package/dist/src/default_templates/HALLUCINATION_TEMPLATE.d.ts.map +0 -1
  87. package/dist/src/default_templates/HALLUCINATION_TEMPLATE.js +0 -34
  88. package/dist/src/default_templates/HALLUCINATION_TEMPLATE.js.map +0 -1
  89. package/dist/src/default_templates/index.d.ts +0 -3
  90. package/dist/src/default_templates/index.d.ts.map +0 -1
  91. package/dist/src/default_templates/index.js +0 -19
  92. package/dist/src/default_templates/index.js.map +0 -1
  93. package/dist/src/llm/createDocumentRelevancyEvaluator.js.map +0 -1
  94. package/src/default_templates/DOCUMENT_RELEVANCY_TEMPLATE.ts +0 -25
  95. package/src/default_templates/HALLUCINATION_TEMPLATE.ts +0 -31
  96. package/src/default_templates/index.ts +0 -2
@@ -0,0 +1,45 @@
1
+ // This file is generated. Do not edit by hand.
2
+
3
+ import type { ClassificationEvaluatorConfig } from "../types";
4
+
5
+ export const HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG: ClassificationEvaluatorConfig = {
6
+ name: "hallucination",
7
+ description: "A specialized evaluator for detecting hallucinations in grounded LLM responses.",
8
+ optimizationDirection: "MINIMIZE",
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
14
+ is generated to the question based on the context. The response may contain false
15
+ information. You must use the context to determine if the response to the question
16
+ contains false information, if the response is a hallucination of facts. Your objective is
17
+ to determine whether the response text contains factual information and is not a
18
+ hallucination. A 'hallucination' refers to a response that is not based on the context or
19
+ assumes information that is not available in the context. Your response should be a single
20
+ word: either 'factual' or 'hallucinated', and it should not include any other text or
21
+ characters. 'hallucinated' indicates that the response provides factually inaccurate
22
+ information to the query based on the context. 'factual' indicates that the response to
23
+ the question is correct relative to the context, and does not contain made up
24
+ information. Please read the query and context carefully before determining your
25
+ response.
26
+
27
+ [BEGIN DATA]
28
+ ************
29
+ [Query]: {{input}}
30
+ ************
31
+ [Context]: {{context}}
32
+ ************
33
+ [Response]: {{output}}
34
+ ************
35
+ [END DATA]
36
+
37
+ Is the response above factual or hallucinated based on the query and context?
38
+ `,
39
+ },
40
+ ],
41
+ choices: {
42
+ "hallucinated": 1,
43
+ "factual": 0
44
+ },
45
+ };
@@ -0,0 +1,4 @@
1
+ // This file is generated. Do not edit by hand.
2
+
3
+ export { DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG } from "./DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG";
4
+ export { HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG } from "./HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG";
@@ -0,0 +1,11 @@
1
+ // This file is generated. Do not edit by hand.
2
+
3
+ import type { PromptTemplate } from "../types/templating";
4
+
5
+ export type ClassificationEvaluatorConfig = {
6
+ name: string;
7
+ description: string;
8
+ optimizationDirection: "MINIMIZE" | "MAXIMIZE";
9
+ template: PromptTemplate;
10
+ choices: Record<string, number>;
11
+ };
@@ -1,17 +1,14 @@
1
- import {
2
- DOCUMENT_RELEVANCY_CHOICES,
3
- DOCUMENT_RELEVANCY_TEMPLATE,
4
- } from "../default_templates/DOCUMENT_RELEVANCY_TEMPLATE";
1
+ import { DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG } from "../__generated__/default_templates";
5
2
  import { CreateClassificationEvaluatorArgs } from "../types/evals";
6
3
 
7
4
  import { ClassificationEvaluator } from "./ClassificationEvaluator";
8
5
  import { createClassificationEvaluator } from "./createClassificationEvaluator";
9
6
 
10
- export interface DocumentRelevancyEvaluatorArgs<
7
+ export interface DocumentRelevanceEvaluatorArgs<
11
8
  RecordType extends Record<
12
9
  string,
13
10
  unknown
14
- > = DocumentRelevancyEvaluationRecord,
11
+ > = DocumentRelevanceEvaluationRecord,
15
12
  > extends Omit<
16
13
  CreateClassificationEvaluatorArgs<RecordType>,
17
14
  "promptTemplate" | "choices" | "optimizationDirection" | "name"
@@ -23,33 +20,33 @@ export interface DocumentRelevancyEvaluatorArgs<
23
20
  }
24
21
 
25
22
  /**
26
- * A record to be evaluated by the document relevancy evaluator.
23
+ * A record to be evaluated by the document relevance evaluator.
27
24
  */
28
- export interface DocumentRelevancyEvaluationRecord {
25
+ export interface DocumentRelevanceEvaluationRecord {
29
26
  input: string;
30
27
  documentText: string;
31
28
  [key: string]: unknown;
32
29
  }
33
30
 
34
31
  /**
35
- * Creates a document relevancy evaluator function.
32
+ * Creates a document relevance evaluator function.
36
33
  *
37
34
  * This function returns an evaluator that determines whether a given document text
38
35
  * is relevant to a provided input question. The evaluator uses a classification model
39
36
  * and a prompt template to make its determination.
40
37
  *
41
- * @param args - The arguments for creating the document relevancy evaluator.
38
+ * @param args - The arguments for creating the document relevance evaluator.
42
39
  * @param args.model - The model to use for classification.
43
- * @param args.choices - The possible classification choices (defaults to DOCUMENT_RELEVANCY_CHOICES).
44
- * @param args.promptTemplate - The prompt template to use (defaults to DOCUMENT_RELEVANCY_TEMPLATE).
40
+ * @param args.choices - The possible classification choices (defaults to DOCUMENT_RELEVANCE_CHOICES).
41
+ * @param args.promptTemplate - The prompt template to use (defaults to DOCUMENT_RELEVANCE_TEMPLATE).
45
42
  * @param args.telemetry - The telemetry to use for the evaluator.
46
43
  *
47
- * @returns An evaluator function that takes a {@link DocumentRelevancyExample} and returns a classification result
44
+ * @returns An evaluator function that takes a {@link DocumentRelevanceExample} and returns a classification result
48
45
  * indicating whether the document is relevant to the input question.
49
46
  *
50
47
  * @example
51
48
  * ```ts
52
- * const evaluator = createDocumentRelevancyEvaluator({ model: openai("gpt-4o-mini") });
49
+ * const evaluator = createDocumentRelevanceEvaluator({ model: openai("gpt-4o-mini") });
53
50
  * const result = await evaluator.evaluate({
54
51
  * input: "What is the capital of France?",
55
52
  * documentText: "Paris is the capital and most populous city of France.",
@@ -57,19 +54,19 @@ export interface DocumentRelevancyEvaluationRecord {
57
54
  * console.log(result.label); // "relevant" or "unrelated"
58
55
  * ```
59
56
  */
60
- export function createDocumentRelevancyEvaluator<
57
+ export function createDocumentRelevanceEvaluator<
61
58
  RecordType extends Record<
62
59
  string,
63
60
  unknown
64
- > = DocumentRelevancyEvaluationRecord,
61
+ > = DocumentRelevanceEvaluationRecord,
65
62
  >(
66
- args: DocumentRelevancyEvaluatorArgs<RecordType>
63
+ args: DocumentRelevanceEvaluatorArgs<RecordType>
67
64
  ): ClassificationEvaluator<RecordType> {
68
65
  const {
69
- choices = DOCUMENT_RELEVANCY_CHOICES,
70
- promptTemplate = DOCUMENT_RELEVANCY_TEMPLATE,
71
- optimizationDirection = "MAXIMIZE",
72
- name = "document_relevancy",
66
+ choices = DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG.choices,
67
+ promptTemplate = DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG.template,
68
+ optimizationDirection = DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG.optimizationDirection,
69
+ name = DOCUMENT_RELEVANCE_CLASSIFICATION_EVALUATOR_CONFIG.name,
73
70
  ...rest
74
71
  } = args;
75
72
  return createClassificationEvaluator<RecordType>({
@@ -1,7 +1,4 @@
1
- import {
2
- HALLUCINATION_CHOICES,
3
- HALLUCINATION_TEMPLATE,
4
- } from "../default_templates/HALLUCINATION_TEMPLATE";
1
+ import { HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG } from "../__generated__/default_templates";
5
2
  import { CreateClassificationEvaluatorArgs } from "../types/evals";
6
3
 
7
4
  import { ClassificationEvaluator } from "./ClassificationEvaluator";
@@ -25,7 +22,6 @@ export interface HallucinationEvaluatorArgs<
25
22
  export type HallucinationEvaluationRecord = {
26
23
  input: string;
27
24
  output: string;
28
- reference?: string;
29
25
  context?: string;
30
26
  };
31
27
  /**
@@ -40,10 +36,10 @@ export function createHallucinationEvaluator<
40
36
  args: HallucinationEvaluatorArgs<RecordType>
41
37
  ): ClassificationEvaluator<RecordType> {
42
38
  const {
43
- choices = HALLUCINATION_CHOICES,
44
- promptTemplate = HALLUCINATION_TEMPLATE,
45
- optimizationDirection = "MINIMIZE",
46
- name = "hallucination",
39
+ choices = HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.choices,
40
+ promptTemplate = HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.template,
41
+ optimizationDirection = HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.optimizationDirection,
42
+ name = HALLUCINATION_CLASSIFICATION_EVALUATOR_CONFIG.name,
47
43
  ...rest
48
44
  } = args;
49
45
  return createClassificationEvaluator<RecordType>({
package/src/llm/index.ts CHANGED
@@ -2,6 +2,6 @@ export * from "./generateClassification";
2
2
  export * from "./createClassifierFn";
3
3
  export * from "./createClassificationEvaluator";
4
4
  export * from "./createHallucinationEvaluator";
5
- export * from "./createDocumentRelevancyEvaluator";
5
+ export * from "./createDocumentRelevanceEvaluator";
6
6
  export * from "./ClassificationEvaluator";
7
7
  export * from "./LLMEvaluator";
@@ -206,7 +206,7 @@ export type BindingContext<RecordType extends Record<string, unknown>> = {
206
206
  *
207
207
  * // Document relevancy evaluator (if it exists)
208
208
  * const relevancyEvaluator = bindEvaluator<EvaluationData>(
209
- * createDocumentRelevancyEvaluator({ model: openai("gpt-4") }),
209
+ * createDocumentRelevanceEvaluator({ model: openai("gpt-4") }),
210
210
  * {
211
211
  * inputMapping: {
212
212
  * query: "userQuery",
@@ -1,6 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,25 +0,0 @@
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
@@ -1 +0,0 @@
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,6 +0,0 @@
1
- export declare const HALLUCINATION_TEMPLATE = "\nIn this task, you will be presented with a query, a reference text and an answer. The answer is\ngenerated to the question based on the reference text. The answer may contain false information. You\nmust use the reference text to determine if the answer to the question contains false information,\nif the answer is a hallucination of facts. Your objective is to determine whether the answer text\ncontains factual information and is not a hallucination. A 'hallucination' refers to\nan answer that is not based on the reference text or assumes information that is not available in\nthe reference text. Your response should be a single word: either \"factual\" or \"hallucinated\", and\nit should not include any other text or characters. \"hallucinated\" indicates that the answer\nprovides factually inaccurate information to the query based on the reference text. \"factual\"\nindicates that the answer to the question is correct relative to the reference text, and does not\ncontain made up information. Please read the query and reference text carefully before determining\nyour response.\n\n [BEGIN DATA]\n ************\n [Query]: {{input}}\n ************\n [Reference text]: {{reference}}\n ************\n [Answer]: {{output}}\n ************\n [END DATA]\n\nIs the answer above factual or hallucinated based on the query and reference text?\n";
2
- export declare const HALLUCINATION_CHOICES: {
3
- hallucinated: number;
4
- factual: number;
5
- };
6
- //# sourceMappingURL=HALLUCINATION_TEMPLATE.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"HALLUCINATION_TEMPLATE.d.ts","sourceRoot":"","sources":["../../../src/default_templates/HALLUCINATION_TEMPLATE.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,u2CAyBlC,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;CAGjC,CAAC"}
@@ -1,31 +0,0 @@
1
- export const HALLUCINATION_TEMPLATE = `
2
- In this task, you will be presented with a query, a reference text and an answer. The answer is
3
- generated to the question based on the reference text. The answer may contain false information. You
4
- must use the reference text to determine if the answer to the question contains false information,
5
- if the answer is a hallucination of facts. Your objective is to determine whether the answer text
6
- contains factual information and is not a hallucination. A 'hallucination' refers to
7
- an answer that is not based on the reference text or assumes information that is not available in
8
- the reference text. Your response should be a single word: either "factual" or "hallucinated", and
9
- it should not include any other text or characters. "hallucinated" indicates that the answer
10
- provides factually inaccurate information to the query based on the reference text. "factual"
11
- indicates that the answer to the question is correct relative to the reference text, and does not
12
- contain made up information. Please read the query and reference text carefully before determining
13
- your response.
14
-
15
- [BEGIN DATA]
16
- ************
17
- [Query]: {{input}}
18
- ************
19
- [Reference text]: {{reference}}
20
- ************
21
- [Answer]: {{output}}
22
- ************
23
- [END DATA]
24
-
25
- Is the answer above factual or hallucinated based on the query and reference text?
26
- `;
27
- export const HALLUCINATION_CHOICES = {
28
- hallucinated: 1,
29
- factual: 0,
30
- };
31
- //# sourceMappingURL=HALLUCINATION_TEMPLATE.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"HALLUCINATION_TEMPLATE.js","sourceRoot":"","sources":["../../../src/default_templates/HALLUCINATION_TEMPLATE.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;CAyBrC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,YAAY,EAAE,CAAC;IACf,OAAO,EAAE,CAAC;CACX,CAAC"}
@@ -1,3 +0,0 @@
1
- export * from "./HALLUCINATION_TEMPLATE.js";
2
- export * from "./DOCUMENT_RELEVANCY_TEMPLATE.js";
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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,3 +0,0 @@
1
- export * from "./HALLUCINATION_TEMPLATE.js";
2
- export * from "./DOCUMENT_RELEVANCY_TEMPLATE.js";
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/default_templates/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"createDocumentRelevancyEvaluator.js","sourceRoot":"","sources":["../../../src/llm/createDocumentRelevancyEvaluator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,2BAA2B,GAC5B,MAAM,kDAAkD,CAAC;AAI1D,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AA0BhF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,gCAAgC,CAM9C,IAAgD;IAEhD,MAAM,EACJ,OAAO,GAAG,0BAA0B,EACpC,cAAc,GAAG,2BAA2B,EAC5C,qBAAqB,GAAG,UAAU,EAClC,IAAI,GAAG,oBAAoB,EAC3B,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,6 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DOCUMENT_RELEVANCY_CHOICES = exports.DOCUMENT_RELEVANCY_TEMPLATE = void 0;
4
- exports.DOCUMENT_RELEVANCY_TEMPLATE = `
5
- You are comparing a document to a question and trying to determine if the document text
6
- contains information relevant to answering the question. Here is the data:
7
-
8
- [BEGIN DATA]
9
- ************
10
- [Question]: {{input}}
11
- ************
12
- [Document text]: {{documentText}}
13
- ************
14
- [END DATA]
15
-
16
- Compare the Question above to the Document text. You must determine whether the Document text
17
- contains information that can answer the Question. Please focus on whether the very specific
18
- question can be answered by the information in the Document text.
19
- Your response must be single word, either "relevant" or "unrelated",
20
- and should not contain any text or characters aside from that word.
21
- "unrelated" means that the document text does not contain an answer to the Question.
22
- "relevant" means the document text contains an answer to the Question.
23
- `;
24
- exports.DOCUMENT_RELEVANCY_CHOICES = {
25
- relevant: 1,
26
- unrelated: 0,
27
- };
28
- //# sourceMappingURL=DOCUMENT_RELEVANCY_TEMPLATE.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DOCUMENT_RELEVANCY_TEMPLATE.js","sourceRoot":"","sources":["../../../src/default_templates/DOCUMENT_RELEVANCY_TEMPLATE.ts"],"names":[],"mappings":";;;AAAa,QAAA,2BAA2B,GAAG;;;;;;;;;;;;;;;;;;;CAmB1C,CAAC;AAEW,QAAA,0BAA0B,GAAG;IACxC,QAAQ,EAAE,CAAC;IACX,SAAS,EAAE,CAAC;CACb,CAAC"}
@@ -1,6 +0,0 @@
1
- export declare const HALLUCINATION_TEMPLATE = "\nIn this task, you will be presented with a query, a reference text and an answer. The answer is\ngenerated to the question based on the reference text. The answer may contain false information. You\nmust use the reference text to determine if the answer to the question contains false information,\nif the answer is a hallucination of facts. Your objective is to determine whether the answer text\ncontains factual information and is not a hallucination. A 'hallucination' refers to\nan answer that is not based on the reference text or assumes information that is not available in\nthe reference text. Your response should be a single word: either \"factual\" or \"hallucinated\", and\nit should not include any other text or characters. \"hallucinated\" indicates that the answer\nprovides factually inaccurate information to the query based on the reference text. \"factual\"\nindicates that the answer to the question is correct relative to the reference text, and does not\ncontain made up information. Please read the query and reference text carefully before determining\nyour response.\n\n [BEGIN DATA]\n ************\n [Query]: {{input}}\n ************\n [Reference text]: {{reference}}\n ************\n [Answer]: {{output}}\n ************\n [END DATA]\n\nIs the answer above factual or hallucinated based on the query and reference text?\n";
2
- export declare const HALLUCINATION_CHOICES: {
3
- hallucinated: number;
4
- factual: number;
5
- };
6
- //# sourceMappingURL=HALLUCINATION_TEMPLATE.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"HALLUCINATION_TEMPLATE.d.ts","sourceRoot":"","sources":["../../../src/default_templates/HALLUCINATION_TEMPLATE.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,u2CAyBlC,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;CAGjC,CAAC"}
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HALLUCINATION_CHOICES = exports.HALLUCINATION_TEMPLATE = void 0;
4
- exports.HALLUCINATION_TEMPLATE = `
5
- In this task, you will be presented with a query, a reference text and an answer. The answer is
6
- generated to the question based on the reference text. The answer may contain false information. You
7
- must use the reference text to determine if the answer to the question contains false information,
8
- if the answer is a hallucination of facts. Your objective is to determine whether the answer text
9
- contains factual information and is not a hallucination. A 'hallucination' refers to
10
- an answer that is not based on the reference text or assumes information that is not available in
11
- the reference text. Your response should be a single word: either "factual" or "hallucinated", and
12
- it should not include any other text or characters. "hallucinated" indicates that the answer
13
- provides factually inaccurate information to the query based on the reference text. "factual"
14
- indicates that the answer to the question is correct relative to the reference text, and does not
15
- contain made up information. Please read the query and reference text carefully before determining
16
- your response.
17
-
18
- [BEGIN DATA]
19
- ************
20
- [Query]: {{input}}
21
- ************
22
- [Reference text]: {{reference}}
23
- ************
24
- [Answer]: {{output}}
25
- ************
26
- [END DATA]
27
-
28
- Is the answer above factual or hallucinated based on the query and reference text?
29
- `;
30
- exports.HALLUCINATION_CHOICES = {
31
- hallucinated: 1,
32
- factual: 0,
33
- };
34
- //# sourceMappingURL=HALLUCINATION_TEMPLATE.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"HALLUCINATION_TEMPLATE.js","sourceRoot":"","sources":["../../../src/default_templates/HALLUCINATION_TEMPLATE.ts"],"names":[],"mappings":";;;AAAa,QAAA,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;CAyBrC,CAAC;AAEW,QAAA,qBAAqB,GAAG;IACnC,YAAY,EAAE,CAAC;IACf,OAAO,EAAE,CAAC;CACX,CAAC"}
@@ -1,3 +0,0 @@
1
- export * from "./HALLUCINATION_TEMPLATE";
2
- export * from "./DOCUMENT_RELEVANCY_TEMPLATE";
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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,19 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./HALLUCINATION_TEMPLATE"), exports);
18
- __exportStar(require("./DOCUMENT_RELEVANCY_TEMPLATE"), exports);
19
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/default_templates/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAyC;AACzC,gEAA8C"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"createDocumentRelevancyEvaluator.js","sourceRoot":"","sources":["../../../src/llm/createDocumentRelevancyEvaluator.ts"],"names":[],"mappings":";;;;;;;;;;;;;AA2DA,4EAsBC;AAjFD,kGAG0D;AAI1D,mFAAgF;AA0BhF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,SAAgB,gCAAgC,CAM9C,IAAgD;IAEhD,MAAM,EACJ,OAAO,GAAG,wDAA0B,EACpC,cAAc,GAAG,yDAA2B,EAC5C,qBAAqB,GAAG,UAAU,EAClC,IAAI,GAAG,oBAAoB,KAEzB,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,25 +0,0 @@
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
-
22
- export const DOCUMENT_RELEVANCY_CHOICES = {
23
- relevant: 1,
24
- unrelated: 0,
25
- };
@@ -1,31 +0,0 @@
1
- export const HALLUCINATION_TEMPLATE = `
2
- In this task, you will be presented with a query, a reference text and an answer. The answer is
3
- generated to the question based on the reference text. The answer may contain false information. You
4
- must use the reference text to determine if the answer to the question contains false information,
5
- if the answer is a hallucination of facts. Your objective is to determine whether the answer text
6
- contains factual information and is not a hallucination. A 'hallucination' refers to
7
- an answer that is not based on the reference text or assumes information that is not available in
8
- the reference text. Your response should be a single word: either "factual" or "hallucinated", and
9
- it should not include any other text or characters. "hallucinated" indicates that the answer
10
- provides factually inaccurate information to the query based on the reference text. "factual"
11
- indicates that the answer to the question is correct relative to the reference text, and does not
12
- contain made up information. Please read the query and reference text carefully before determining
13
- your response.
14
-
15
- [BEGIN DATA]
16
- ************
17
- [Query]: {{input}}
18
- ************
19
- [Reference text]: {{reference}}
20
- ************
21
- [Answer]: {{output}}
22
- ************
23
- [END DATA]
24
-
25
- Is the answer above factual or hallucinated based on the query and reference text?
26
- `;
27
-
28
- export const HALLUCINATION_CHOICES = {
29
- hallucinated: 1,
30
- factual: 0,
31
- };
@@ -1,2 +0,0 @@
1
- export * from "./HALLUCINATION_TEMPLATE";
2
- export * from "./DOCUMENT_RELEVANCY_TEMPLATE";