langextract
A Python library for extracting structured information from unstructured text using LLMs with precise source grounding and interactive visualization.
File Explorer
- 1-bug.md
- 2-feature-request.md
- config.yml
- pull_request_template.md
- add-new-checks.sh
- add-size-labels.sh
- revalidate-all-prs.sh
- zenodo_publish.py
- auto-update-pr.yaml
- check-infrastructure-changes.yml
- check-linked-issue.yml
- check-pr-size.yml
- check-pr-up-to-date.yaml
- ci.yaml
- publish.yml
- revalidate-pr.yml
- validate-community-providers.yaml
- validate_pr_template.yaml
- zenodo-publish.yml
- benchmark.py
- config.py
- fuzzy_benchmark.py
- plotting.py
- utils.py
- langextract_concept.gif
- langextract_concept.html
- langextract_concept_still.png
- logo.svg
- medication_entity.gif
- medication_entity_re.gif
- romeo_juliet_basic.gif
- romeo_juliet_full.gif
- batch_api_example.md
- japanese_extraction.md
- longer_text_example.md
- medication_examples.md
- output_schema.md
- __init__.py
- provider.py
- schema.py
- pyproject.toml
- README.md
- test_example_provider.py
- romeo_juliet_extraction.ipynb
- .dockerignore
- demo_ollama.py
- docker-compose.yml
- Dockerfile
- README.md
- __init__.py
- exceptions.py
- inference.py
- README.md
- registry.py
- schema.py
- __init__.py
- base_model.py
- data.py
- debug_utils.py
- exceptions.py
- format_handler.py
- output_schema.py
- schema.py
- tokenizer.py
- types.py
- __init__.py
- gemini.py
- openai.py
- __init__.py
- builtin_registry.py
- gemini.py
- gemini_batch.py
- ollama.py
- openai.py
- openai_batch.py
- patterns.py
- README.md
- router.py
- __init__.py
- annotation.py
- chunking.py
- data.py
- data_lib.py
- exceptions.py
- extraction.py
- factory.py
- inference.py
- io.py
- plugins.py
- progress.py
- prompt_validation.py
- prompting.py
- py.typed
- registry.py
- resolver.py
- schema.py
- tokenizer.py
- visualization.py
- create_provider_plugin.py
- validate_community_providers.py
- basic_extraction.py
- multiple_documents.py
- relationship_extraction.py
- prompt-validation.md
- providers.md
- resolver-params.md
- README.md
- SKILL.md
- .pylintrc
- annotation_test.py
- chunking_test.py
- create_provider_plugin_test.py
- data_lib_test.py
- extract_precedence_test.py
- extract_schema_integration_test.py
- factory_schema_test.py
- factory_test.py
- format_handler_test.py
- fuzzy_alignment_cases_test.py
- gemini_retry_test.py
- inference_test.py
- init_test.py
- io_test.py
- openai_batch_test.py
- progress_test.py
- prompt_validation_test.py
- prompting_test.py
- provider_plugin_test.py
- provider_schema_test.py
- registry_test.py
- resolver_test.py
- schema_test.py
- test_gemini_batch_api.py
- test_kwargs_passthrough.py
- test_live_api.py
- test_ollama_integration.py
- tokenizer_test.py
- visualization_test.py
- .gitignore
- .pre-commit-config.yaml
- .pylintrc
- autoformat.sh
- CITATION.cff
- COMMUNITY_PROVIDERS.md
- CONTRIBUTING.md
- Dockerfile
- LICENSE
- pyproject.toml
- README.md
- tox.ini
# Installation Guide
pythonSetup Steps
pip install langextract
Install the LangExtract library using Python's package manager.
export GEMINI_API_KEY="your_api_key_here"
Set the API key environment variable for cloud models.
Key Commands
pip install langextract
Install the LangExtract library.
# Use via CDN
jsDelivrjsDelivr serves any public GitHub repository as a CDN with zero setup. Pick a version and a file to get a ready-to-paste link and snippet.
Release Timeline
Actively MaintainedCommand Glossary
Commands referenced in this DOCs, explained below.
batch
View Details ▼
batch
Execute commands at a later time when the system load levels permit.
Results will be sent to the user's mail.
See also: `at`, `atq`, `atrm`, `mail`.
batch
Execute commands from `stdin` (press `<Ctrl d>` when done):
systemctl start atd
Start the `atd` daemon:
echo "{{./make_db_backup.sh}}" | batch
Execute a command from `stdin`:
docker build
View Details ▼
docker build
Build an image from a Dockerfile.
docker build .
Build a Docker image using the Dockerfile in the current directory:
docker build {{github.com/creack/docker-firefox}}
Build a Docker image from a Dockerfile at a specified URL:
docker build {{[-t|--tag]}} {{name:tag}} .
Build a Docker image and tag it:
docker run
View Details ▼
docker run
This command is an alias of `docker container run`.
tldr docker container run
View documentation for the original command:
git clone
View Details ▼
git clone
Clone an existing repository.
git clone {{remote_repository_location}} {{path/to/directory}}
Clone an existing repository into a new directory (the default directory is the repository name):
git clone --recursive {{remote_repository_location}}
Clone an existing repository and its submodules:
git clone {{[-n|--no-checkout]}} {{remote_repository_location}}
Clone only the `.git` directory of an existing repository:
ollama
View Details ▼
ollama
A large language model runner.
For a list of available models, see <https://ollama.com/library>.
ollama serve
Start the daemon required to run other commands:
ollama run {{model}}
Run a model and chat with it (will automatically download the model if it's not downloaded):
ollama run {{model}} --think=false "{{prompt}}"
Run a model with a single prompt and thinking turned off:
pip install
View Details ▼
pip install
Install Python packages.
pip install {{package1 package2 ...}}
Install one or more packages:
pip install {{package1 package2 ...}} {{[-U|--upgrade]}}
Upgrade all specified packages to the latest version, installing any that are not already present:
pip install {{package}}=={{version}}
Install a specific version of a package:
pre-commit
View Details ▼
pre-commit
Create Git hooks that run before commits.
pre-commit install
Install pre-commit into your Git hooks:
pre-commit run
Run pre-commit hooks on all staged files:
pre-commit run --all-files
Run pre-commit hooks on all files, staged or unstaged:
pylint
View Details ▼
pylint
A Python code linter.
pylint {{path/to/file.py}}
Show lint errors in a file:
pylint {{package_or_module}}
Lint a package or module (must be importable; no `.py` suffix):
pylint {{path/to/directory}}
Lint a package from a directory path (must contain an `__init__.py` file):
pytest
View Details ▼
pytest
Run Python tests.
pytest {{path/to/test_file1.py path/to/test_file2.py ...}}
Run tests from specific files:
pytest -k {{expression}}
Run tests with names matching a specific [k]eyword expression:
pytest {{[-x|--exitfirst]}}
Exit as soon as a test fails or encounters an error:
python
View Details ▼
python
Python language interpreter.
python
Start a REPL (interactive shell):
python {{path/to/file.py}}
Execute a specific Python file:
python -i {{path/to/file.py}}
Execute a specific Python file and start a REPL:
tox
View Details ▼
tox
Automate Python testing across multiple Python versions.
Use tox.ini to configure environments and test command.
tox
Run tests on all test environments:
tox-quickstart
Create a `tox.ini` configuration:
tox {{[-a|--listenvs-all]}}
List the available environments:
