A library for auto-generating JSON Schema and dispatching tool calls in applications that use the Anthropic API to interact with Claude.
Project description
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
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)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
claude_llm_tools-0.1.1.tar.gz
(10.4 kB
view details)
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 claude_llm_tools-0.1.1.tar.gz.
File metadata
- Download URL: claude_llm_tools-0.1.1.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
040dc2f9ee9bf208a4d0d82c0cc2946261d58dcfff00831555b195e498110946
|
|
| MD5 |
29f99842cc2201dcf80f93e396633e11
|
|
| BLAKE2b-256 |
b34af9199612efd05a0ef58040420913c52ac95bc4997a14e6fa6eb5b959fd62
|
File details
Details for the file claude_llm_tools-0.1.1-py3-none-any.whl.
File metadata
- Download URL: claude_llm_tools-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e2fbe28dccd1af56df04d09ecfcf2c9a4a9d5197df6de4a834288db2373e579
|
|
| MD5 |
5aa36f29078a6142b0f5493f50c1c37e
|
|
| BLAKE2b-256 |
a58759afa986f724b5acd98782abc272853046ef650316b2baad51272963c60f
|