azureopenai

package module
v0.21.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package azureopenai adapts Azure OpenAI's current OpenAI-compatible v1 API to the Core model interfaces.

BaseURL is the complete Azure OpenAI v1 base URL, for example "https://RESOURCE.openai.azure.com/openai/v1/". Model names are Azure deployment names. Authentication uses the API key through the standard OpenAI client authentication path accepted by Azure's v1 endpoint.

Only the current v1 endpoint shape is modeled; no dated api-version is required.

Output token limits go out as max_completion_tokens. Azure documents that reasoning models "will only work with the max_completion_tokens parameter when using the Chat Completions API", and lists max_tokens among the parameters those models do not support, so max_tokens was the one field a caller's MaxOutputTokens could not survive on a GPT-5 or o-series deployment.

Index

Constants

View Source
const (
	OpenAIRequestExtensionKey     = "azureopenai/openai_request"
	OpenAIResponseExtensionKey    = "azureopenai/openai_response"
	OpenAIStreamChunkExtensionKey = "azureopenai/openai_stream_chunk"
)

Namespacing preserves provider-specific data without promoting it into the shared Core protocol or colliding with another provider.

View Source
const (
	Provider = "AzureOpenAI"
)

Provider is the stable backend name for host-side attribution.

Variables

This section is empty.

Functions

This section is empty.

Types

type AudioTTSModel

type AudioTTSModel = openai.AudioTTSModel

AudioTTSModel is the shared protocol type itself rather than a wrapper, so this provider adds no second public surface for callers to choose between.

func NewAudioTTSModel

func NewAudioTTSModel(ctx context.Context, config AudioTTSModelConfig) (*AudioTTSModel, error)

NewAudioTTSModel rejects an invalid provider binding before the first speech call.

type AudioTTSModelConfig

type AudioTTSModelConfig struct {
	Config
	DefaultOptions   tts.Options
	MaxResponseBytes int64
}

AudioTTSModelConfig binds provider access and defaults shared by every speech call.

func (AudioTTSModelConfig) Validate

func (a AudioTTSModelConfig) Validate() error

type AudioTranscriptionModel

type AudioTranscriptionModel = openai.AudioTranscriptionModel

AudioTranscriptionModel is the shared protocol type itself rather than a wrapper, so this provider adds no second public surface for callers to choose between.

func NewAudioTranscriptionModel

func NewAudioTranscriptionModel(ctx context.Context, config AudioTranscriptionModelConfig) (*AudioTranscriptionModel, error)

NewAudioTranscriptionModel rejects an invalid provider binding before the first transcription call.

type AudioTranscriptionModelConfig

type AudioTranscriptionModelConfig struct {
	Config
	DefaultOptions transcription.Options
}

AudioTranscriptionModelConfig binds provider access and defaults shared by every transcription call.

func (AudioTranscriptionModelConfig) Validate

func (a AudioTranscriptionModelConfig) Validate() error

type Chat

type Chat = openai.ChatCompletions

Chat implements Azure OpenAI's Chat Completions protocol.

func NewChat

func NewChat(ctx context.Context, config ChatConfig) (*Chat, error)

NewChat rejects an invalid provider binding before the first chat call.

type ChatConfig

type ChatConfig struct {
	Config
	DefaultOptions corechat.Options
}

ChatConfig binds provider access and defaults shared by every chat call.

func (ChatConfig) Validate

func (c ChatConfig) Validate() error

type Config

type Config struct {
	APIKey     string
	BaseURL    string
	HTTPClient *http.Client
}

Config identifies one Azure OpenAI endpoint and its transport.

func (Config) Validate

func (c Config) Validate() error

type EmbeddingModel

type EmbeddingModel = openai.EmbeddingModel

EmbeddingModel is the shared protocol type itself rather than a wrapper, so this provider adds no second public surface for callers to choose between.

func NewEmbeddingModel

func NewEmbeddingModel(ctx context.Context, config EmbeddingModelConfig) (*EmbeddingModel, error)

NewEmbeddingModel rejects an invalid provider binding before the first embedding call.

type EmbeddingModelConfig

type EmbeddingModelConfig struct {
	Config
	DefaultOptions embedding.Options
}

EmbeddingModelConfig binds provider access and defaults shared by every embedding call.

func (EmbeddingModelConfig) Validate

func (e EmbeddingModelConfig) Validate() error

type ImageModel

type ImageModel = openai.ImageModel

ImageModel is the shared protocol type itself rather than a wrapper, so this provider adds no second public surface for callers to choose between.

func NewImageModel

func NewImageModel(ctx context.Context, config ImageModelConfig) (*ImageModel, error)

NewImageModel rejects an invalid provider binding before the first image call.

type ImageModelConfig

type ImageModelConfig struct {
	Config
	DefaultOptions image.Options
}

ImageModelConfig binds provider access and defaults shared by every image call.

func (ImageModelConfig) Validate

func (i ImageModelConfig) Validate() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL