Modular, extensible OpenAI-compatible tool calling service for local and remote LLMs.
- Automatic discovery and registration of tool services via decorators
- Service registry and dynamic schema generation
- Chat orchestration with tool execution
- Harmony-style message separation (system, developer, user)
- Flexible configuration via environment variables or .env
- Support for custom tool directories
fromservices.chat_serviceimportChatServicefromservices.tool_serviceimportToolService# Optionally discover tools in a custom directorycustom_tool_dirs= ["/path/to/your/tools"]
tool_service=ToolService(tool_dirs=custom_tool_dirs)
tools=tool_service.get_tool_schema()
chat_service=ChatService(api_key="your-key", base_url="http://localhost:8080/v1", model="gpt-oss-20b", tools=tools)
messages= [
{"role": "system", "content": "You are a concise assistant."},
{"role": "user", "content": "Add 10 and 5."}
]
response=chat_service.chat_completion(messages)
print(response)python main.py- Create a Python file in your tools directory
- Use the
@register_tooldecorator fromtools.__base__ - Example:
fromtools.__base__importToolBase, register_tool@register_toolclassMyTool(ToolBase):
name="my_tool"description="Does something useful."parameters= { ... }
defmy_tool(self, ...):
...MIT