Skip to content

v2.17.0 - Unified Tool Calling

Choose a tag to compare

@lfnovo lfnovo released this 24 Jan 00:42
· 101 commits to main since this release
5e36a1f

Unified Tool Calling

This release adds unified tool/function calling support across all LLM providers. Define your tools once and use them with OpenAI, Anthropic, Google, Groq, Mistral, and more!

Highlights

  • Consistent Interface: chat_complete(messages, tools=tools) works the same way across all providers
  • 10 Providers Tested: OpenAI, Anthropic, Google, Groq, Mistral, DeepSeek, xAI, OpenRouter, Azure, Ollama
  • New Types: Tool, ToolFunction, ToolCall, FunctionCall
  • Validation: Optional validate_tool_calls=True parameter with JSON Schema validation
  • Multi-turn Support: Full support for tool result messages

Quick Example

from esperanto import AIFactory
from esperanto.common_types import Tool, ToolFunction

tool = Tool(
    type="function",
    function=ToolFunction(
        name="get_weather",
        description="Get weather for a city",
        parameters={"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]}
    )
)

# Works with any provider!
model = AIFactory.create_language("openai", "gpt-4o")  # or "anthropic", "google", etc.
response = model.chat_complete(messages, tools=[tool])

Documentation

Acknowledgments

A huge thank you to @JTCorrin for the incredible contribution implementing tool calling across all providers! This was a massive undertaking that significantly enhances Esperanto's capabilities. 🙏

Full Changelog

See CHANGELOG.md for details.