Skip to content

Commit 00f184e

Browse files
authored
Add a tip for giving clear type definitions for LLM extraction (#195)
1 parent e5a1809 commit 00f184e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

docs/docs/ops/functions.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,17 @@ Return type: `vector[float32; N]`, where `N` is determined by the model
4949
* `output_type` (type: `type`, required): The type of the output. e.g. a dataclass type name. See [Data Types](/docs/core/data_types) for all supported data types. The LLM will output values that match the schema of the type.
5050
* `instruction` (type: `str`, optional): Additional instruction for the LLM.
5151

52+
:::tip Clear type definitions
53+
54+
Definitions of the `output_type` is fed into LLM as guidance to generate the output.
55+
To improve the quality of the extracted information, giving clear definitions for your dataclasses is especially important, e.g.
56+
57+
* Provide readable field names for your dataclasses.
58+
* Provide reasonable docstrings for your dataclasses.
59+
* For any optional fields, clearly annotate that they are optional, by `SomeType | None` or `typing.Optional[SomeType]`.
60+
61+
:::
62+
5263
Input data:
5364

5465
* `text` (type: `str`, required): The text to extract information from.

0 commit comments

Comments
 (0)