Anthropic Claude provider plugin for LangExtract
Project description
langextract-claude
Anthropic Claude provider for LangExtract.
LangExtract ships with Gemini, Vertex AI, OpenAI, and Ollama providers. This package adds Claude support as a third-party provider plugin.
Installation
pip install langextract-claude
Usage
import langextract as lx
results = lx.extract(text, schema, model_id="claude-sonnet-4-6")
Any claude-* model ID is automatically routed to this provider. The default model is claude-sonnet-4-6.
Configuration
The API key is resolved in order:
- Explicit
api_keyparameter ANTHROPIC_API_KEYenvironment variableLANGEXTRACT_API_KEYenvironment variable
from langextract_claude import AnthropicLanguageModel
model = AnthropicLanguageModel(
model_id="claude-sonnet-4-6",
api_key="sk-ant-...", # or set ANTHROPIC_API_KEY
temperature=0.0,
max_tokens=8192,
max_workers=5, # parallel inference threads
)
Features
- Multi-block JSON normalization — Claude sometimes splits large extractions across multiple fenced code blocks. This provider automatically merges them into a single block that LangExtract can parse.
- Parallel inference — batch prompts are processed concurrently via a thread pool (configurable
max_workers, default 5). - Auto-discovery — any model ID matching
^claudeis routed here. No manual provider registration needed.
License
Apache-2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file langextract_claude-0.1.0.tar.gz.
File metadata
- Download URL: langextract_claude-0.1.0.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d3ada1c75022d5ebad986e665f45c993a38ef1f69e8ef51f4291ad98726e9801
|
|
| MD5 |
2d8fe1a44b930569b4162104f5af393a
|
|
| BLAKE2b-256 |
758089f3c271cb230245413505f8807a18bb4bb7584647da396b92168bfb0dce
|
File details
Details for the file langextract_claude-0.1.0-py3-none-any.whl.
File metadata
- Download URL: langextract_claude-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca41e3795c96eb63752a64fc2e3111816dff75b417d2e08b2ec8595998682090
|
|
| MD5 |
1a266f2290d659a32b231b27fc20a6b0
|
|
| BLAKE2b-256 |
3b75945cddf849bb7379229a8a57b91efd892839ada92b8f5203b19424f5401d
|