Usage guide
Setup, environment variables, and Python/JavaScript/Go usage examples.
AzureOpenAILLM
Azure OpenAI LLM plugin. Wraps Azure-hosted OpenAI chat-completion models (GPT-4o, o-series, etc.) with streaming generation, tool/function calling, and structured-output support via a user-managed Azure deployment.Constructor
Azure OpenAI API key. Falls back to the
AZURE_OPENAI_API_KEY environment variable when omitted.Full Azure OpenAI resource endpoint URL, e.g.
"https://<resource>.openai.azure.com/". Falls back to the AZURE_OPENAI_ENDPOINT environment variable when omitted.Name of the Azure OpenAI deployment (not the underlying model name). This is the custom name you chose when deploying a model in the Azure portal or AI Foundry, e.g.
"gpt-4o-deployment". Accepts any AzureOpenAILLMModel enum value or a raw string. Defaults to None (empty string, must be provided).Azure OpenAI REST API version date string. Defaults to
"2024-10-21" (GA stable release for chat completions). Use "2025-03-01-preview" or later to access preview features.Sampling temperature in
[0.0, 2.0]. Lower values produce more deterministic output. Defaults to 0.7.Maximum tokens the model may generate per response. Defaults to
1024.Nucleus sampling probability mass in
(0.0, 1.0]. Mutually exclusive with temperature; set one or the other. Defaults to None (disabled).Float in
[-2.0, 2.0]. Penalises token repetition based on cumulative frequency in the output so far. Positive values reduce repetition. Defaults to None.Float in
[-2.0, 2.0]. Penalises tokens that have already appeared at least once, encouraging topic diversity. Defaults to None.Integer seed for deterministic sampling. When set, the API makes a best effort to return the same result for identical inputs. Defaults to
None.String (or up to four strings) at which the model stops generating further tokens. Defaults to
None.Opaque end-user identifier forwarded to Azure for abuse monitoring. Defaults to
None.Controls how the model selects tools. One of
"none" (no tools), "auto" (model decides), or "required" (must call a tool). Also accepts a named tool dict. Defaults to None ("auto" when tools are present).When
True, the model may emit multiple tool calls in a single response turn. Defaults to None (provider default, currently True).response_format
Enforce a structured output schema. Pass
{"type": "json_object"} for JSON mode or a JSON Schema dict for strict structured outputs. Defaults to None (plain text).Controls reasoning token budget for o-series (reasoning) models. One of
"low", "medium", or "high". Ignored for non-reasoning models. Defaults to None.aclose
cancel_current_generation
chat
The conversation history to send to the model.
Optional tool definitions the model may call.
Optional conversational graph guiding the exchange.
LLMResponse: Response chunks produced as the model generates output.
emit
The event to emit.
off
The event the handler was registered for.
The handler to remove.
on
callback is omitted.
The event to listen for.
The handler to invoke when the event is emitted. If
None, a decorator is returned that registers the decorated function.The registered callback when
callback is provided, otherwise a decorator that registers and returns the function it wraps.