Pydantic
PydanticProgramExtractor #
Bases: BaseExtractor
Pydantic program extractor.
Uses an LLM to extract out a Pydantic object. Return attributes of that object in a dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
program
|
BasePydanticProgram
|
Pydantic program to extract. |
required |
input_key
|
str
|
Key to use as input to the program (the program template string must expose this key). |
'input'
|
extract_template_str
|
str
|
Template to use for extraction. |
'Here is the content of the section:\n----------------\n{context_str}\n----------------\nGiven the contextual information, extract out a {class_name} object.'
|
Source code in llama-index-core/llama_index/core/extractors/metadata_extractors.py
465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 |
|
aextract
async
#
aextract(nodes: Sequence[BaseNode]) -> List[Dict]
Extract pydantic program.
Source code in llama-index-core/llama_index/core/extractors/metadata_extractors.py
505 506 507 508 509 510 511 512 513 514 515 |
|