providers

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	TypeOpenAICompat = "openai-compatible"
	TypeAnthropic    = "anthropic-compatible"
	TypeGemini       = "gemini"

	DefaultOpenAICompatModel = "gpt-5.4-mini"
	DefaultAnthropicModel    = "claude-sonnet-4-5"
	DefaultGeminiModel       = "gemini-2.5-flash"
	DefaultReasoningEffort   = "medium"
)
View Source
const (
	ReasoningEffortNone    = "none"
	ReasoningEffortMinimal = "minimal"
	ReasoningEffortLow     = "low"
	ReasoningEffortMedium  = DefaultReasoningEffort
	ReasoningEffortHigh    = "high"
	ReasoningEffortXHigh   = "xhigh"
)

Variables

This section is empty.

Functions

func DefaultReasoningEffortForProvider

func DefaultReasoningEffortForProvider(providerID string, providerType string) string

func NormalizeModelID

func NormalizeModelID(providerID string, providerType string, modelID string) string

func NormalizeProviderID

func NormalizeProviderID(value string) string

func NormalizeReasoningEffort

func NormalizeReasoningEffort(value string) string

func NormalizeReasoningEffortForProvider

func NormalizeReasoningEffortForProvider(providerID string, providerType string, value string) string

func NormalizeToolSchema

func NormalizeToolSchema(schema json.RawMessage, dialect ToolSchemaDialect) json.RawMessage

func ReasoningEfforts

func ReasoningEfforts() []string

func ReasoningEffortsForProvider added in v0.1.1

func ReasoningEffortsForProvider(providerID string, providerType string) []string

func ScanSSE

func ScanSSE(ctx context.Context, body io.Reader, handle func(SSEEvent) error) error

ScanSSE reads SSE frames from body and invokes handle for each event payload.

func StreamText

func StreamText(ctx context.Context, delta string) error

StreamText forwards a streamed text delta to the sink attached to ctx.

func WithTextStream

func WithTextStream(ctx context.Context, fn TextStreamFunc) context.Context

WithTextStream attaches an optional text delta sink to the request context.

Types

type BaseURLOption added in v0.1.1

type BaseURLOption struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	URL  string `json:"url"`
}

type Capabilities

type Capabilities struct {
	ModelDiscovery  bool `json:"model_discovery,omitempty"`
	ReasoningEffort bool `json:"reasoning_effort,omitempty"`
	ToolCalling     bool `json:"tool_calling,omitempty"`
	NormalizeModel  bool `json:"normalize_model,omitempty"`
}

func ProviderCapabilities added in v0.1.1

func ProviderCapabilities(providerID string, providerType string) Capabilities

type CatalogEntry

type CatalogEntry struct {
	ID              string          `json:"id"`
	Name            string          `json:"name"`
	Type            string          `json:"type"`
	Implemented     bool            `json:"implemented"`
	RequiresBaseURL bool            `json:"requires_base_url"`
	Capabilities    Capabilities    `json:"capabilities"`
	DefaultBaseURL  string          `json:"default_base_url,omitempty"`
	BaseURLOptions  []BaseURLOption `json:"base_url_options,omitempty"`
	DefaultModel    string          `json:"default_model,omitempty"`
	APIKeyEnv       string          `json:"api_key_env,omitempty"`
	ConfigPath      string          `json:"config_path,omitempty"`
	Notes           string          `json:"notes,omitempty"`
}

func AvailableCatalog

func AvailableCatalog() []CatalogEntry

func Catalog

func Catalog() []CatalogEntry

func CatalogEntryByID

func CatalogEntryByID(providerID string) (CatalogEntry, bool)

type ImageContent

type ImageContent struct {
	MIMEType    string `json:"mime_type,omitempty"`
	DataBase64  string `json:"data_base64,omitempty"`
	Name        string `json:"name,omitempty"`
	StoragePath string `json:"storage_path,omitempty"`
	Temporary   bool   `json:"temporary,omitempty"`
	Size        int64  `json:"size,omitempty"`
}

type Message

type Message struct {
	Role       string
	Content    string
	Images     []ImageContent
	ToolCallID string
	ToolCalls  []ToolCall
}

func NormalizeMessages

func NormalizeMessages(messages []Message, mode ToolUseMode) []Message

type ModelCapabilities added in v0.1.1

type ModelCapabilities struct {
	ToolCalling        bool
	ToolSchemaDialect  ToolSchemaDialect
	ParallelToolCalls  bool
	ReasoningEffort    bool
	ReasoningMode      ReasoningMode
	ReasoningWithTools bool
	ThoughtSignatures  bool
	NormalizeModel     bool
}

func ProviderRuntimeCapabilities added in v0.1.2

func ProviderRuntimeCapabilities(providerID string, providerType string) ModelCapabilities

ProviderRuntimeCapabilities resolves runtime behavior from the provider catalog. The catalog is currently provider-level; model-specific capabilities should be added here only when the catalog carries real model data for them.

type ProviderProfile

type ProviderProfile struct {
	ProviderID              string
	Model                   string
	ProviderType            string
	RuntimeProviderType     string
	RuntimeProfile          RuntimeProfile
	Capabilities            ModelCapabilities
	SupportsReasoningEffort bool
}

func ProfileForModel added in v0.1.1

func ProfileForModel(providerID string, providerType string, modelID string) ProviderProfile

func ProfileForProvider

func ProfileForProvider(providerType string) ProviderProfile

func (ProviderProfile) RuntimeProfileWithOverrides

func (p ProviderProfile) RuntimeProfileWithOverrides(profile RuntimeProfile) RuntimeProfile

type ReasoningMode added in v0.1.1

type ReasoningMode string
const (
	ReasoningModeNone           ReasoningMode = ""
	ReasoningModeOpenAIEffort   ReasoningMode = "openai_effort"
	ReasoningModeGeminiThinking ReasoningMode = "gemini_thinking"
)

type Request

type Request struct {
	RunID              string
	SessionID          string
	SystemPrompt       string
	CustomInstructions string
	Messages           []Message
	Tools              []ToolDefinition
}

func NormalizeRequest

func NormalizeRequest(request Request, profile RuntimeProfile) Request

type Response

type Response struct {
	Text      string
	Model     string
	Provider  string
	ToolCalls []ToolCall
	Usage     Usage
}

type Runtime

type Runtime interface {
	Generate(ctx context.Context, request Request) (Response, error)
}

type RuntimeCapabilityProvider added in v0.1.1

type RuntimeCapabilityProvider interface {
	ModelCapabilities() ModelCapabilities
}

type RuntimeProfile

type RuntimeProfile struct {
	ToolSchemaDialect ToolSchemaDialect
	ToolUseMode       ToolUseMode
}

func NormalizeRuntimeProfile

func NormalizeRuntimeProfile(profile RuntimeProfile) RuntimeProfile

type RuntimeProfiler

type RuntimeProfiler interface {
	RuntimeProfile() RuntimeProfile
}

type SSEEvent

type SSEEvent struct {
	Type string
	Data string
}

type TextStreamFunc

type TextStreamFunc func(delta string) error

func TextStreamFromContext

func TextStreamFromContext(ctx context.Context) TextStreamFunc

TextStreamFromContext returns the text delta sink attached to ctx, if any.

type ToolCall

type ToolCall struct {
	ID        string          `json:"id"`
	Name      string          `json:"name"`
	Arguments json.RawMessage `json:"arguments,omitempty"`
}

type ToolDefinition

type ToolDefinition struct {
	Name        string          `json:"name"`
	Description string          `json:"description,omitempty"`
	InputSchema json.RawMessage `json:"input_schema,omitempty"`
}

func NormalizeTools

func NormalizeTools(tools []ToolDefinition, dialect ToolSchemaDialect, mode ToolUseMode) []ToolDefinition

type ToolSchemaDialect

type ToolSchemaDialect string
const (
	ToolSchemaJSONSchema ToolSchemaDialect = "json_schema"
	ToolSchemaGemini     ToolSchemaDialect = "gemini"
)

func NormalizeToolSchemaDialect

func NormalizeToolSchemaDialect(value ToolSchemaDialect) ToolSchemaDialect

type ToolUseMode

type ToolUseMode string
const (
	ToolUseNative   ToolUseMode = "native"
	ToolUseDisabled ToolUseMode = "disabled"
)

func NormalizeOptionalToolUseMode

func NormalizeOptionalToolUseMode(value ToolUseMode) ToolUseMode

func NormalizeToolUseMode

func NormalizeToolUseMode(value ToolUseMode) ToolUseMode

type Usage

type Usage struct {
	InputTokens     int64
	OutputTokens    int64
	TotalTokens     int64
	CachedTokens    int64
	ReasoningTokens int64
	ProviderRaw     json.RawMessage
}

Directories

Path Synopsis
ai

Jump to

Keyboard shortcuts

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