langextract

(★ 38,461)

A Python library for extracting structured information from unstructured text using LLMs with precise source grounding and interactive visualization.

File Explorer

  • .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

python
Prerequisites

Setup 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.

API key configuration is required when using cloud models like Gemini or OpenAI.

# Use via CDN

jsDelivr

jsDelivr 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 Maintained

Command Glossary

Commands referenced in this DOCs, explained below.

🔍

batch

View Details ▼

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 ▼

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 ▼

This command is an alias of `docker container run`.

tldr docker container run

View documentation for the original command:

🔍

git clone

View Details ▼

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 ▼

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 ▼

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 ▼

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 ▼

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 ▼

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 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 ▼

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:

# Project Badges

// repository documentation