Skip to main content

A simple tool class for schema generation. Helps agents create schemas for methods/functions easily.

Project description

sap-tool

A simple Python package that helps agents create JSON schemas for methods/functions in a very simple way. This is useful for building agent tools, APIs, or any system that needs to describe callable functions in a structured format.

Installation

pip install sap-tool

Usage

from sap_tool import Tool

def foo(a: int, b: str):
    pass

tool = Tool(foo, "foo", "A test function.")
schema = tool.formulate_tool_schema()
# Example print output from the package:
# {'a': {'type': 'integer'}, 'b': {'type': 'string'}}
# {'type': 'function', 'function': {'name': 'foo', 'description': 'A test function.', 'parameters': {'type': 'object', 'properties': {'a': {'type': 'integer'}, 'b': {'type': 'string'}}, 'required': ['a', 'b']}}}
print(schema)

What does it do?

  • Automatically generates a JSON schema for any Python function's parameters and types.
  • Makes it easy to describe agent tools and methods for LLMs or other automation systems.
  • Minimal, easy-to-use API.

Example Output

{'a': {'type': 'integer'}, 'b': {'type': 'string'}}
{'type': 'function', 'function': {'name': 'foo', 'description': 'A test function.', 'parameters': {'type': 'object', 'properties': {'a': {'type': 'integer'}, 'b': {'type': 'string'}}, 'required': ['a', 'b']}}}

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

sap_tool-0.1.4.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

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

sap_tool-0.1.4-py3-none-any.whl (2.3 kB view details)

Uploaded Python 3

File details

Details for the file sap_tool-0.1.4.tar.gz.

File metadata

  • Download URL: sap_tool-0.1.4.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.6

File hashes

Hashes for sap_tool-0.1.4.tar.gz
Algorithm Hash digest
SHA256 f4be7cfca225a2a1521960a33a35cba7daa081a521001b438e90511a08ab3731
MD5 293b19eec9dbe728d1f1f9b15ddcd309
BLAKE2b-256 949219fac3ed7554784f387894cd5cafd2c0ba7fbfad72c8200d8bb6f692acab

See more details on using hashes here.

File details

Details for the file sap_tool-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: sap_tool-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 2.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.6

File hashes

Hashes for sap_tool-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3f3f442057c925193f86d703a42fee87231356a63672cdfb2485736862b4e915
MD5 35030ad822d088fe6b976617d5454328
BLAKE2b-256 3aa527960d9425deb6a881b5820d5871b3f9f7114081eb706835c6244aeaf984

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