Skip to content

v0.12.0

Release Date: 2026-02-22

Highlights

  • Tool/function calling support for OpenAI provider

Added

  • Tool, ToolSpec, ToolCall, ToolFunction types for tool calling
  • Tools and ToolChoice fields in ChatCompletionRequest
  • ToolCallID and ToolCalls fields in Message
  • Conversion between unified tool format and OpenAI format

Tool Calling Example

response, err := client.CreateChatCompletion(ctx, &omnillm.ChatCompletionRequest{
    Model: omnillm.ModelGPT4o,
    Messages: []omnillm.Message{
        {Role: omnillm.RoleUser, Content: "What's the weather in Tokyo?"},
    },
    Tools: []omnillm.Tool{
        {
            Type: "function",
            Function: omnillm.ToolFunction{
                Name:        "get_weather",
                Description: "Get current weather for a location",
                Parameters: map[string]any{
                    "type": "object",
                    "properties": map[string]any{
                        "location": map[string]any{
                            "type":        "string",
                            "description": "City name",
                        },
                    },
                    "required": []string{"location"},
                },
            },
        },
    },
})

// Check for tool calls in response
if len(response.Choices[0].Message.ToolCalls) > 0 {
    // Execute tool and send result back
}

Upgrade Notes

This is a backwards-compatible feature addition. No changes required for existing code.