Skip to main content

Python client for the ToolRouter API

Project description

ToolRouter Python SDK

A Python client for the ToolRouter API.

Installation

pip install toolrouter

Usage

Option 1: Using the ToolRouter class

from toolrouter import ToolRouter

# Initialize the client
router = ToolRouter(
    client_id="your-client-id",
    api_key="your-api-key",
    # Optional: base_url="https://api.toolrouter.ai/s"  # Default value shown
)

# List available tools
tools = router.list_tools(schema="openai")  # schema is optional, defaults to "openai"

# Call a tool
result = router.call_tool(
    tool_name="example_tool",
    tool_input={
        "param1": "value1",
        "param2": "value2"
    }
)

Option 2: Using standalone functions

from toolrouter import setup_default_router, list_tools, call_tool

# Setup the default router (do this once at the start of your application)
setup_default_router(
    client_id="your-client-id",
    api_key="your-api-key",
    # Optional: base_url="https://api.toolrouter.ai/s"  # Default value shown
)

# List available tools
tools = list_tools(schema="openai")  # schema is optional, defaults to "openai"

# Call a tool
result = call_tool(
    tool_name="example_tool",
    tool_input={
        "param1": "value1",
        "param2": "value2"
    }
)

Development

Setting up for development

# Clone the repository
git clone https://github.com/toolrouter/toolrouter-python.git
cd toolrouter-python

# Create a virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install development dependencies
pip install -e ".[dev]"

Publishing to PyPI

# Build the package
python -m pip install --upgrade build
python -m build

# Upload to PyPI
python -m pip install --upgrade twine
python -m twine upload dist/*

License

MIT

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

toolrouter-0.1.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

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

toolrouter-0.1.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file toolrouter-0.1.0.tar.gz.

File metadata

  • Download URL: toolrouter-0.1.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0b2

File hashes

Hashes for toolrouter-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9cd9f15ba28d23396ea709b5c236952a2b8fe660483b13c9952b055863b35787
MD5 8c92d679ea5bde49421d144bd598cc35
BLAKE2b-256 d70cb140a3e4e82c98209073cfdb92f9278e955ec56f0dd5962efa2ef311ca75

See more details on using hashes here.

File details

Details for the file toolrouter-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: toolrouter-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0b2

File hashes

Hashes for toolrouter-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 23859f5f714cd18c41cefd6fb30ed85be384f01216b404b3990948fee8b11b01
MD5 f3d13f016c8e530f3417104df7303834
BLAKE2b-256 17580d0aef72ab36d8a31026cdc953e009b57ba3e651c1ee752843a9662a1636

See more details on using hashes here.

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