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
pip install claude-llm-tools
Usage
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
@claude_llm_tools.tool(
name='multiply_numbers',
description='Multiply two numbers together and return the product.'
)
def multiply(req: claude_llm_tools.Request, x: int, y: int) -> int:
"""This docstring will be overridden by the description parameter above."""
print(req.tool_use.id)
return x * y
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)
Metadata
Release files for claude-llm-tools 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| claude_llm_tools-0.3.0.tar.gz | 12.1 kB | Without provenance | Details for claude_llm_tools-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| claude_llm_tools-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for claude_llm_tools-0.3.0-py3-none-any.whl |
Total release size: 19.9 kB
Release files / claude_llm_tools-0.3.0.tar.gz
| Download URL | claude_llm_tools-0.3.0.tar.gz |
|---|---|
| Size | 12.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
60bfd6c20793103aa6b0dfb477b3105a541bad2dec63798bd8b3981537c29f07
|
|
BLAKE2b-256 checksum How to use checksums |
e49982ffd4546dc8d86080ee7b8f26371b2bfd4e351164fd6f5e6072a6adf66f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / claude_llm_tools-0.3.0-py3-none-any.whl
| Download URL | claude_llm_tools-0.3.0-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9c2297002eff63c4ec28ab28c111d81c5a64f9a830502adbc729610c17191586
|
|
BLAKE2b-256 checksum How to use checksums |
0a937e0b47988dc54096733cc1780c806604ae3044ae37356bb090e63810e124
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Security for claude-llm-tools 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.