Documentation
¶
Overview ¶
Azure OpenAI tool-calling example for Chronos.
This example shows how to drive multi-round tool calling against an Azure OpenAI deployment. The model is given two tools — a calculator and a small knowledge lookup — and the example runs the full tool-call loop: it sends the request with tool definitions, and whenever the model responds with StopReasonToolCall it executes the requested tools, feeds the results back, and asks again, repeating until the model produces a final answer.
The same loop pattern works for any provider (see examples/graph_with_llm), because tools are wired through the provider-agnostic model.ChatRequest.
Prerequisites:
- An Azure OpenAI resource with a chat model deployment (e.g. gpt-4o-mini) that supports function calling
- Go 1.24+
Set the following environment variables before running:
export AZURE_OPENAI_API_KEY=<your-azure-api-key> export AZURE_OPENAI_ENDPOINT=https://<your-resource>.openai.azure.com export AZURE_OPENAI_DEPLOYMENT=<your-deployment-name> export AZURE_OPENAI_API_VERSION=2024-10-21
Run:
go run ./examples/azure_tools/main.go
If AZURE_OPENAI_API_KEY is not set the example prints the required variables and exits cleanly (0) without making any network call.