You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs-website/docs/pipeline-components/extractors/llmmetadataextractor.mdx
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ Extracts metadata from documents using a Large Language Model. The metadata is e
14
14
|||
15
15
| --- | --- |
16
16
|**Most common position in a pipeline**| After [PreProcessors](../preprocessors.mdx) in an indexing pipeline |
17
-
|**Mandatory init variables**|`prompt`: The prompt to instruct the LLM on how to extract metadata from the document <br /> <br />`chat_generator`: A Chat Generator instance which represents the LLM configured to return a JSON object |
17
+
|**Mandatory init variables**|`prompt`: The prompt to instruct the LLM on how to extract metadata from the document. It must contain exactly one variable, called `document`. <br /> <br />`chat_generator`: A Chat Generator instance which represents the LLM configured to return a JSON object |
18
18
|**Mandatory run variables**|`documents`: A list of documents |
19
19
|**Output variables**|`documents`: A list of documents |
@@ -27,7 +27,7 @@ Extracts metadata from documents using a Large Language Model. The metadata is e
27
27
28
28
The `LLMMetadataExtractor` extraction relies on an LLM and a prompt to perform the metadata extraction. At initialization time, it expects an LLM, a Haystack Generator, and a prompt describing the metadata extraction process.
29
29
30
-
The prompt should have a variable called `document` that will point to a single document in the list of documents. So, to access the content of the document, you can use `{{ document.content }}` in the prompt.
30
+
The prompt must have exactly one variable, called `document`, that points to a single document in the list of documents. So, to access the content of the document, you can use `{{ document.content }}` in the prompt. The component raises a `ValueError` at initialization if the prompt has no variables, more than one variable, or a variable with a different name.
31
31
32
32
At runtime, it expects a list of documents and will run the LLM on each document in the list, extracting metadata from the document. The metadata will be added to the document's metadata field.
0 commit comments