Metadata-Version: 2.4
Name: claude-llm-tools
Version: 0.2.0
Summary: A library for auto-generating JSON Schema and dispatching tool calls in applications that use the Anthropic API to interact with Claude.
Project-URL: Homepage, https://github.com/gmr/claude-llm-tools
Project-URL: Bug Tracker, https://github.com/gmr/claude-llm-tools/issues
Author-email: "Gavin M. Roy" <gavinr@aweber.com>
License-Expression: BSD-3-Clause
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.12
Requires-Dist: anthropic<1,>=0.49.0
Requires-Dist: jsonschema-models>=1.2.1
Requires-Dist: pydantic<3,>=2.11.0
Provides-Extra: dev
Requires-Dist: build; extra == 'dev'
Requires-Dist: mypy; extra == 'dev'
Requires-Dist: pre-commit; extra == 'dev'
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: pytest-cov; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Description-Content-Type: text/markdown

# Claude LLM Tools

A library for auto-generating JSON Schema and dispatching tool calls in applications
that use the Anthropic API to interact with Claude.

## Installation
```shell
pip install claude-llm-tools
```

## Usage

```python
import anthropic
import claude_llm_tools


@claude_llm_tools.tool
def add_numbers(req: claude_llm_tools.Request, a: int, b: int) -> int:
    """
    Add two numbers together and return the result.

    Args:
        a: The first number
        b: The second number

    Returns:
        The sum of a and b
    """
    print(req.tool_use.id)
    return a + b


client = anthropic.Anthropic()

# You can implement the Anthropic text editor contract
claude_llm_tools.add_tool(..., tool_type='text_editor_20250124')

message = client.messages.create(
    model="claude-3-7-sonnet-20250219",
    max_tokens=1000,
    temperature=1,
    system="You are a world-class poet. Respond only with short poems about math.",
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": "Why is the ocean salty?"
                }
            ]
        }
    ],
    tools=claude_llm_tools.tools()
)

for block in message.content:
    match block.type:
        case 'text':
            ...
        case 'tool_use':
            result = await claude_llm_tools.dispatch(block)
```
