Skip to main content

Instantly turn your Python functions into structured, AI-callable tools.

Project description

toolsmith

Toolsmith turns your Python functions into structured, AI-callable tools, using type hints and docstrings. Integrates with any LLM provider that is compatible with the OpenAI API.

  • Very easy to use: Just write normal Python functions with typehints.
  • Pydantic support: Pydantic types get automatically serialized and deserialized.
  • Unopinionated: Toolsmith gets out of the way in terms of how you want to wire up the LLM loop.
  • Fast: Highly performant based on Pydantic's speed.

Installation

$ pip install toolsmith

Usage

Simply define any functions you may have normally:

def create_user(name: str, age: int) -> str:
    """Saves a user to the DB"""
    return f"Created user {name}, age {age}"

def search_users(query: str, regex: bool) -> str:
    return "Found some users"

Put it all together and call the OpenAI API:

import openai
import toolsmith

toolbox = toolsmith.create([create_user, search_users])

client = openai.OpenAI()
response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Make a 33 year old user called Alice"}]
    tools=toolbox.get_schema(),
)

invocations = toolbox.parse_invocations(response.choices[0].message.tool_calls)
results = toolbox.execute_function_calls(invocations)

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

toolsmith-0.1.1a2.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

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

toolsmith-0.1.1a2-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file toolsmith-0.1.1a2.tar.gz.

File metadata

  • Download URL: toolsmith-0.1.1a2.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.10.9 Darwin/24.3.0

File hashes

Hashes for toolsmith-0.1.1a2.tar.gz
Algorithm Hash digest
SHA256 9131ee9cb041f7e0e2d71efbe2df5255b599ebee65d8a37d1402d3581e860cb3
MD5 6b58686d2550bd0d1ffa0fe1c2b29fc9
BLAKE2b-256 0ca51dd9bd92530275213d12bf2401dbd3cfd131d71f0ff629fefc64a42f8d35

See more details on using hashes here.

File details

Details for the file toolsmith-0.1.1a2-py3-none-any.whl.

File metadata

  • Download URL: toolsmith-0.1.1a2-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.10.9 Darwin/24.3.0

File hashes

Hashes for toolsmith-0.1.1a2-py3-none-any.whl
Algorithm Hash digest
SHA256 3730bc27a198abe7ef0d155b68560fdd39b19a9b72fe2c9e2cdff69f37342514
MD5 443965474810a6ad42e30a8098fdde40
BLAKE2b-256 1d6d8c45130b92bed56bb3133ca40eef20694c0e3fa0bde90f3eb958aaadde53

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