mirror of
https://github.com/run-llama/llama_extract.git
synced 2026-07-01 01:37:54 -04:00
f92a13af4cbbb518e9aa00f2ccba800ba3e3d014
LlamaExtract (EXPERIMENTAL)
LlamaExtract provides a simple API for extracting structured data from unstructured text.
⚠️ Warning 🚧
The released version of LlamaExtract on PyPi is no longer supported. This library is under active development and we will share an updated version on PyPi very soon. In the meantime, please do not use this code on Github. If you are interested in being an early adopter, please contact us at support@llamaindex.ai or reach out on Discord.
🚧
Installation
# Warning: Contains breaking changes
pip install llama-extract==0.1.0
Usage
Create a LlamaExtract client
extractor = LlamaExtract(api_key="YOUR_API_KEY")
Create an agent
agent = extractor.create_agent(
name="test_agent",
data_schema={
"type": "object",
"properties": {
"name": {"type": "string"},
"email": {"type": "string"},
},
"required": ["name", "email"],
},
)
You can also pass in a Pydantic model to define the data schema.
from pydantic import BaseModel
class Resume(BaseModel):
name: str
email: str
agent = extractor.create_agent(name="test_agent", data_schema=Resume)
Extract data from a file
result = await agent.aextract("path/to/resume.pdf")
For a more detailed example and an illustration of usage patterns, please refer to the demo notebook.
Description
Releases
4