Prerequisites
LangExtract requires Python 3.10 or higher.Choose Your Installation Method
Select the installation method that best fits your needs:
- PyPI: Recommended for most users
- Virtual Environment: Best for isolated development
- From Source: For contributors and advanced users
- Docker: For containerized deployments
Install LangExtract
Installing with
-e puts the package in development mode, allowing you to modify the code without reinstalling.Install Optional Dependencies
LangExtract supports optional providers and tools:
OpenAI Support
All Optional Dependencies
Development Tools
Testing Framework
Jupyter Notebook
Set Up API Key
Cloud-hosted models like Gemini require an API key. Local models with Ollama don’t need one.
Get Your API Key
Choose your provider:- AI Studio for Gemini models
- Vertex AI for enterprise use
- OpenAI Platform for OpenAI models
Configure Your API Key
Core Dependencies
LangExtract requires the following packages:- google-genai (>=1.39.0) - Gemini model support
- aiohttp (>=3.8.0) - Async HTTP requests
- pydantic (>=1.8.0) - Data validation
- pandas (>=1.3.0) - Data processing
- python-dotenv (>=0.19.0) - Environment variable management
- tqdm (>=4.64.0) - Progress bars
Using Local LLMs with Ollama
Run LangExtract without API keys using Ollama:Troubleshooting
ImportError
If you encounter import errors, ensure you’re using Python 3.10 or higher:API Key Issues
If your API key isn’t being recognized:- Check that
LANGEXTRACT_API_KEYis set in your environment - Verify the
.envfile is in your working directory - Ensure you’re loading the
.envfile in your code if needed