Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llm_tool_registry-0.1.1.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llm_tool_registry-0.1.1-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

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

Hashes for llm_tool_registry-0.1.1.tar.gz
Algorithm Hash digest
SHA256 255fca446e9fdc7b83b89da56d44a0ee3f5de977e38f02cd8956cc33ec17002e
MD5 73d4f8b09444248753bbefee098a66ab
BLAKE2b-256 7207cc2c675402271ed013a8489a3c84da4d9006a2ad11f5b4b6fa846d9cd707

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_tool_registry-0.1.1.tar.gz:

Publisher: publish.yml on rheyer/llm_tool_registry

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file llm_tool_registry-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for llm_tool_registry-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dcb921ca2c76b3c462bc252cc4aa05a1bfb5541f64ec12da90b0e23a6dbdea8a
MD5 2e1c5a623c0b46f9b6353d401d8160a5
BLAKE2b-256 1b1902e721e3d80fef7f166031c0a1a1dae5d2e5a0c436e7896cfe732b556e80

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page