extract_from_text
Extract structured data from unstructured text using Large Language Models. Define extraction instructions and examples to identify entities, map them to source locations, and retrieve precise metadata for accurate grounding.
Instructions
Extract structured information from text using langextract.
Uses Large Language Models to extract structured information from unstructured text based on user-defined instructions and examples. Each extraction is mapped to its exact location in the source text for precise source grounding.
Args: text: The text to extract information from prompt_description: Clear instructions for what to extract examples: List of example extractions to guide the model model_id: LLM model to use (default: "gemini-2.5-flash") max_char_buffer: Max characters per chunk (default: 1000) temperature: Sampling temperature 0.0-1.0 (default: 0.5) extraction_passes: Number of extraction passes for better recall (default: 1) max_workers: Max parallel workers (default: 10)
Returns: Dictionary containing extracted entities with source locations and metadata
Raises: ToolError: If extraction fails due to invalid parameters or API issues
Input Schema
Name | Required | Description | Default |
---|---|---|---|
examples | Yes | ||
extraction_passes | No | ||
max_char_buffer | No | ||
max_workers | No | ||
model_id | No | gemini-2.5-flash | |
prompt_description | Yes | ||
temperature | No | ||
text | Yes |