A Python project demonstrating language extraction using the langextract library. This project is set up with uv for dependency management, pytest for testing, mypy for type checking, and ruff for linting.
-
Clone the repository:
git clone https://github.com/jumtra/try-google-langExtract.git # Assuming this is the correct repo name cd try-google-langExtract
-
Create and activate a virtual environment:
uv venv source .venv/bin/activate -
Install dependencies:
uv add --group dev uv add uv pip install -e .
This project uses the langextract library to perform language extraction.
To run the main script:
uv run main.pyThe langextract library, especially when using cloud-hosted models, requires an API key. You must provide this API key via the LANGEXTRACT_API_KEY environment variable.
Example:
export LANGEXTRACT_API_KEY="YOUR_API_KEY_HERE"
uv run main.pyReplace "YOUR_API_KEY_HERE" with your actual langextract API key.
To run the tests, use pytest:
uv run pytestThis will also generate a coverage report.
To ensure code quality and consistency, you can run ruff for linting and mypy for type checking:
uv run ruff check .
uv run mypy src/