LangExtract is a Python library for robustly extracting structured data from large language models (LLMs). It handles automatic chunking, multi-language support, and provides integrations with various LLM providers (e.g., OpenAI, Vertex AI, Ollama). The current version is 1.2.1, with a frequent release cadence, often introducing new providers, features, and bug fixes.
pip install langextractVerified import paths — ran on the pinned version, not inferred.
This quickstart defines a schema using `langextract_schema` and then uses the `extract` function to parse structured data from a given text, demonstrating a basic usage pattern. Ensure your LLM provider's API key is available (e.g., `OPENAI_API_KEY`).
Update to `langextract>=1.0.4` and ensure your `ModelConfig` for Ollama uses `model_id='llama2'` instead of `model='llama2'`.
Upgrade to `langextract>=1.2.1` to fix the parameter passing, or avoid using `reasoning_effort` for affected models if an upgrade is not possible.
Upgrade to `langextract>=1.2.0` to ensure proper loading and resolution of model providers.
Upgrade to `langextract>=1.1.1` to ensure the `project` parameter is correctly passed to the Vertex AI Batch API.
If you relied on the `debug=True` behavior, explicitly set `debug=True` in your `extract()` calls after upgrading to `langextract>=1.0.9`.
Upgrade `langextract` to version 1.2.1 or newer (`pip install --upgrade langextract`).
Upgrade `langextract` to version 1.2.0 or newer (`pip install --upgrade langextract`).
Upgrade `langextract` to version 1.1.1 or newer (`pip install --upgrade langextract`).
Update your `ModelConfig` for Ollama to use `model_id` instead of `model`, e.g., `ModelConfig(provider='ollama', model_id='llama2')`.
No dependency data recorded yet.