Implements a tool registry to make tool calling easier when using LLMs
Project description
The llm_tool_registry package simplifies tool/function calling integration with Language Models (LLMs) like OpenAI's GPT models. It provides a clean, type-safe way to register Python functions as tools that can be called by LLMs.
Key features:
- Type-safe function registration with automatic JSON Schema generation
- Automatic parameter validation and documentation checking
- Support for OpenAI's function calling format
- Clean decorator-based API for registering tools
- Built-in docstring validation to ensure complete documentation
- Handles common Python types including strings, numbers, booleans, lists, and dictionaries
- Support for optional parameters and Union types
Example usage:
from llm_tool_registry import ToolRegistry
registry = ToolRegistry()
@registry.tool()
def get_weather(location: str, unit: str = "celsius") -> dict:
"""Get the weather for a location.
Args:
location: The city and state/country
unit: The temperature unit (celsius/fahrenheit)
"""
# Implementation here
pass
# Get OpenAI-compatible schema
schemas = registry.get_openai_schema()
# Execute registered tool
result = registry.execute("get_weather", location="London, UK")
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 llm_tool_registry-0.1.1.tar.gz.
File metadata
- Download URL: llm_tool_registry-0.1.1.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
255fca446e9fdc7b83b89da56d44a0ee3f5de977e38f02cd8956cc33ec17002e
|
|
| MD5 |
73d4f8b09444248753bbefee098a66ab
|
|
| BLAKE2b-256 |
7207cc2c675402271ed013a8489a3c84da4d9006a2ad11f5b4b6fa846d9cd707
|
Provenance
The following attestation bundles were made for llm_tool_registry-0.1.1.tar.gz:
Publisher:
publish.yml on rheyer/llm_tool_registry
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llm_tool_registry-0.1.1.tar.gz -
Subject digest:
255fca446e9fdc7b83b89da56d44a0ee3f5de977e38f02cd8956cc33ec17002e - Sigstore transparency entry: 154058017
- Sigstore integration time:
-
Permalink:
rheyer/llm_tool_registry@76981796871530880fe3a93a552d3d8f413760db -
Branch / Tag:
refs/tags/0.1.1 - Owner: https://github.com/rheyer
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@76981796871530880fe3a93a552d3d8f413760db -
Trigger Event:
push
-
Statement type:
File details
Details for the file llm_tool_registry-0.1.1-py3-none-any.whl.
File metadata
- Download URL: llm_tool_registry-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dcb921ca2c76b3c462bc252cc4aa05a1bfb5541f64ec12da90b0e23a6dbdea8a
|
|
| MD5 |
2e1c5a623c0b46f9b6353d401d8160a5
|
|
| BLAKE2b-256 |
1b1902e721e3d80fef7f166031c0a1a1dae5d2e5a0c436e7896cfe732b556e80
|
Provenance
The following attestation bundles were made for llm_tool_registry-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on rheyer/llm_tool_registry
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llm_tool_registry-0.1.1-py3-none-any.whl -
Subject digest:
dcb921ca2c76b3c462bc252cc4aa05a1bfb5541f64ec12da90b0e23a6dbdea8a - Sigstore transparency entry: 154058018
- Sigstore integration time:
-
Permalink:
rheyer/llm_tool_registry@76981796871530880fe3a93a552d3d8f413760db -
Branch / Tag:
refs/tags/0.1.1 - Owner: https://github.com/rheyer
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@76981796871530880fe3a93a552d3d8f413760db -
Trigger Event:
push
-
Statement type: