Documentation
¶
Overview ¶
Package azure provides an Azure OpenAI Responses API client. It keeps Azure's resource endpoint and api-key authentication separate, delegates request encoding, non-streaming response decoding, tool and usage semantics to inference's shared OpenAI Responses codec, and normalizes Azure-specific reasoning and termination variants locally.
SSE SEMANTICS ARE NOT DELEGATED. streamCollector.mapFrame in codec.go is a private fork of the shared codec's stream collector: it owns frame decoding, both failure channels, and the terminal envelope, and delegates only unknown frames back to the shared per-event decoder. See that function's doc comment for what Azure does differently, the primary source for each divergence, and what would let the fork be deleted. A fix landed in inference/codec/openairesponses' collector does NOT reach this package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
New constructs an Azure OpenAI Responses API client. An explicit model base URL wins; otherwise WithResourceName or AZURE_RESOURCE_NAME supplies the Azure resource used to build the modern /openai/v1 endpoint.
func NewCounter ¶
func NewCounter(_ auth.APIKey) (contextcount.ContextCounter, error)
NewCounter reports Azure's deliberate counter boundary. Azure's modern Responses endpoint does not expose OpenAI's /responses/input_tokens route, so returning an estimator here would violate the exact ContextCounter contract.
Types ¶
type Option ¶
type Option func(*config)
Option customizes Azure OpenAI endpoint resolution and stable Responses request fields.
func WithMetadata ¶
WithMetadata attaches Azure Responses request metadata. The map is copied when the option is applied so later caller mutation cannot affect requests.
func WithPromptCacheKey ¶
WithPromptCacheKey sets the stable Azure Responses prompt-cache key.
func WithReasoning ¶
func WithReasoning(options ReasoningOptions) Option
WithReasoning sets the Responses reasoning controls for every request. It replaces the reasoning controls inferred from model sampling.
func WithResourceName ¶
WithResourceName sets the Azure resource name used when Model.BaseURL is empty. It takes precedence over AZURE_RESOURCE_NAME.
type ReasoningOptions ¶
type ReasoningOptions struct {
Effort string `json:"effort,omitempty"`
Summary string `json:"summary,omitempty"`
}
ReasoningOptions controls the Azure Responses reasoning object. The fields are strings because Azure owns the accepted vocabulary and may add values without changing this package's neutral request model.
type ResourceConfigurationError ¶
type ResourceConfigurationError struct {
Reason ResourceConfigurationReason
}
ResourceConfigurationError reports a missing or malformed Azure resource name. It is intentionally secret-free and inspectable with errors.As.
func (*ResourceConfigurationError) Error ¶
func (e *ResourceConfigurationError) Error() string
type ResourceConfigurationReason ¶
type ResourceConfigurationReason string
ResourceConfigurationReason classifies Azure resource-name configuration failures without including provider-controlled values in the error text.
const ( ResourceConfigurationMissing ResourceConfigurationReason = "resource name is missing" ResourceConfigurationInvalid ResourceConfigurationReason = "resource name is invalid" )