Metadata-Version: 2.4
Name: langextract-claude
Version: 0.1.0
Summary: Anthropic Claude provider plugin for LangExtract
Author-email: Maximilian Daub <maximilian.daub@outlook.com>
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/madakas/currikon-os/tree/main/experiments/langextract-claude
Project-URL: Repository, https://github.com/madakas/currikon-os
Project-URL: Issues, https://github.com/madakas/currikon-os/issues
Project-URL: Changelog, https://github.com/madakas/currikon-os/releases
Keywords: langextract,anthropic,claude,extraction,llm
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: anthropic>=0.40.0
Requires-Dist: langextract>=1.1.0
Dynamic: license-file

# langextract-claude

Anthropic Claude provider for [LangExtract](https://pypi.org/project/langextract/).

LangExtract ships with Gemini, Vertex AI, OpenAI, and Ollama providers. This package adds Claude support as a third-party provider plugin.

## Installation

```bash
pip install langextract-claude
```

## Usage

```python
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:

1. Explicit `api_key` parameter
2. `ANTHROPIC_API_KEY` environment variable
3. `LANGEXTRACT_API_KEY` environment variable

```python
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 `^claude` is routed here. No manual provider registration needed.

## License

Apache-2.0
