Documentation
¶
Index ¶
- type LLMResponse
- type Message
- type Option
- type Provider
- func NewProvider(apiKey, apiBase, proxy, userAgent string, opts ...Option) *Provider
- func NewProviderWithIdentity(apiBase, proxy, userAgent string, opts ...Option) (*Provider, error)
- func NewProviderWithIdentityAndTimeout(apiBase, proxy, userAgent string, requestTimeoutSeconds int) (*Provider, error)
- func NewProviderWithTimeout(apiKey, apiBase, proxy, userAgent string, requestTimeoutSeconds int) *Provider
- func NewProviderWithTokenSource(apiBase, proxy, userAgent string, ...) *Provider
- type ToolDefinition
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LLMResponse ¶
type LLMResponse = protocoltypes.LLMResponse
type Message ¶
type Message = protocoltypes.Message
type Option ¶
type Option func(*Provider)
Option configures the Azure Provider.
func WithRequestTimeout ¶
WithRequestTimeout sets the HTTP request timeout.
func WithTokenSource ¶
WithTokenSource sets a callback that returns a bearer token per request. When set, it takes precedence over the static api key.
func WithUserAgent ¶
WithUserAgent sets the User-Agent header for requests.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider implements the LLM provider interface for Azure OpenAI endpoints. It handles Azure-specific authentication (Bearer token), URL construction (Responses API), and request/response formatting.
func NewProvider ¶
NewProvider creates a new Azure OpenAI provider.
func NewProviderWithIdentity ¶
NewProviderWithIdentity returns an error in the default build.
func NewProviderWithIdentityAndTimeout ¶
func NewProviderWithIdentityAndTimeout( apiBase, proxy, userAgent string, requestTimeoutSeconds int, ) (*Provider, error)
NewProviderWithIdentityAndTimeout returns an error in the default build.
func NewProviderWithTimeout ¶
func NewProviderWithTimeout(apiKey, apiBase, proxy, userAgent string, requestTimeoutSeconds int) *Provider
NewProviderWithTimeout creates a new Azure OpenAI provider with a custom request timeout in seconds.
func NewProviderWithTokenSource ¶
func NewProviderWithTokenSource( apiBase, proxy, userAgent string, tokenSource func(ctx context.Context) (string, error), opts ...Option, ) *Provider
NewProviderWithTokenSource creates a new Azure OpenAI provider that obtains its bearer token from the supplied callback on every request. Used for Entra ID auth where tokens are short-lived and refreshed by the underlying credential.
func (*Provider) Chat ¶
func (p *Provider) Chat( ctx context.Context, messages []Message, tools []ToolDefinition, model string, options map[string]any, ) (*LLMResponse, error)
Chat sends a request to the Azure OpenAI Responses API endpoint. The model parameter is passed in the request body.
func (*Provider) GetDefaultModel ¶
GetDefaultModel returns an empty string as Azure deployments are user-configured.
type ToolDefinition ¶
type ToolDefinition = protocoltypes.ToolDefinition