Documentation
¶
Overview ¶
Package cloudflare adapts Cloudflare AI Gateway's compatible text endpoints to sigma.
Index ¶
- Constants
- func RegisterAIGateway(registry *sigma.Registry, opts ...ProviderOption) error
- func RegisterAIGatewayAnthropic(registry *sigma.Registry, opts ...AnthropicProviderOption) error
- func RegisterAIGatewayResponses(registry *sigma.Registry, opts ...ProviderOption) error
- func RegisterDefaultAIGateway(opts ...ProviderOption) error
- func RegisterDefaultAIGatewayAnthropic(opts ...AnthropicProviderOption) error
- func RegisterDefaultAIGatewayResponses(opts ...ProviderOption) error
- type AnthropicProvider
- type AnthropicProviderOption
- func WithAnthropicBaseURL(baseURL string) AnthropicProviderOption
- func WithAnthropicHTTPClient(client *http.Client) AnthropicProviderOption
- func WithAnthropicHeader(key, value string) AnthropicProviderOption
- func WithAnthropicHeaders(headers map[string]string) AnthropicProviderOption
- func WithAnthropicMessagesCompat(compat anthropic.MessagesCompat) AnthropicProviderOption
- type Provider
- type ProviderOption
- type ResponsesProvider
Constants ¶
const ( DefaultAIGatewayOpenAIBaseURL = "https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai" DefaultAIGatewayAnthropicBaseURL = "https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic" )
Variables ¶
This section is empty.
Functions ¶
func RegisterAIGateway ¶
func RegisterAIGateway(registry *sigma.Registry, opts ...ProviderOption) error
RegisterAIGateway adds a Cloudflare AI Gateway Chat Completions provider to registry.
func RegisterAIGatewayAnthropic ¶
func RegisterAIGatewayAnthropic(registry *sigma.Registry, opts ...AnthropicProviderOption) error
RegisterAIGatewayAnthropic adds a Cloudflare AI Gateway Anthropic-compatible provider to registry.
func RegisterAIGatewayResponses ¶
func RegisterAIGatewayResponses(registry *sigma.Registry, opts ...ProviderOption) error
RegisterAIGatewayResponses adds a Cloudflare AI Gateway Responses provider to registry.
func RegisterDefaultAIGateway ¶
func RegisterDefaultAIGateway(opts ...ProviderOption) error
RegisterDefaultAIGateway adds a Cloudflare AI Gateway Chat Completions provider to sigma's default registry.
func RegisterDefaultAIGatewayAnthropic ¶
func RegisterDefaultAIGatewayAnthropic(opts ...AnthropicProviderOption) error
RegisterDefaultAIGatewayAnthropic adds a Cloudflare AI Gateway Anthropic-compatible provider to sigma's default registry.
func RegisterDefaultAIGatewayResponses ¶
func RegisterDefaultAIGatewayResponses(opts ...ProviderOption) error
RegisterDefaultAIGatewayResponses adds a Cloudflare AI Gateway Responses provider to sigma's default registry.
Types ¶
type AnthropicProvider ¶
AnthropicProvider adapts Cloudflare AI Gateway's Anthropic-compatible Messages endpoint.
func NewAIGatewayAnthropicProvider ¶
func NewAIGatewayAnthropicProvider(opts ...AnthropicProviderOption) *AnthropicProvider
NewAIGatewayAnthropicProvider constructs a Cloudflare AI Gateway Anthropic-compatible provider.
type AnthropicProviderOption ¶
type AnthropicProviderOption = anthropic.ProviderOption
AnthropicProviderOption configures an AnthropicProvider.
func WithAnthropicBaseURL ¶
func WithAnthropicBaseURL(baseURL string) AnthropicProviderOption
WithAnthropicBaseURL configures the Anthropic-compatible provider base URL.
func WithAnthropicHTTPClient ¶
func WithAnthropicHTTPClient(client *http.Client) AnthropicProviderOption
WithAnthropicHTTPClient configures the Anthropic-compatible provider fallback HTTP client.
func WithAnthropicHeader ¶
func WithAnthropicHeader(key, value string) AnthropicProviderOption
WithAnthropicHeader configures an Anthropic-compatible provider default request header.
func WithAnthropicHeaders ¶
func WithAnthropicHeaders(headers map[string]string) AnthropicProviderOption
WithAnthropicHeaders configures Anthropic-compatible provider default request headers.
func WithAnthropicMessagesCompat ¶
func WithAnthropicMessagesCompat(compat anthropic.MessagesCompat) AnthropicProviderOption
WithAnthropicMessagesCompat overrides detected Anthropic-compatible endpoint behavior.
type Provider ¶
Provider adapts Cloudflare AI Gateway's OpenAI-compatible Chat Completions endpoint.
func NewAIGatewayProvider ¶
func NewAIGatewayProvider(opts ...ProviderOption) *Provider
NewAIGatewayProvider constructs a Cloudflare AI Gateway Chat Completions provider.
type ProviderOption ¶
type ProviderOption = openai.ProviderOption
ProviderOption configures a Provider.
func WithBaseURL ¶
func WithBaseURL(baseURL string) ProviderOption
WithBaseURL configures the provider base URL, for example an httptest server URL.
func WithHTTPClient ¶
func WithHTTPClient(client *http.Client) ProviderOption
WithHTTPClient configures the provider fallback HTTP client.
func WithHeader ¶
func WithHeader(key, value string) ProviderOption
WithHeader configures a provider default request header.
func WithHeaders ¶
func WithHeaders(headers map[string]string) ProviderOption
WithHeaders configures provider default request headers.
type ResponsesProvider ¶
type ResponsesProvider = openai.ResponsesProvider
ResponsesProvider adapts Cloudflare AI Gateway's OpenAI-compatible Responses endpoint.
func NewAIGatewayResponsesProvider ¶
func NewAIGatewayResponsesProvider(opts ...ProviderOption) *ResponsesProvider
NewAIGatewayResponsesProvider constructs a Cloudflare AI Gateway Responses provider.