Help us shape the future of Go! Take the 2026 Go Developer Survey

modelbuilder

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildModel

func BuildModel(ctx context.Context, cfg *ModelConfig, opts ...BuildOption) (model.ToolCallingChatModel, error)

func IsSupportedClass

func IsSupportedClass(c ModelClass) bool

IsSupportedClass reports whether a model class has a registered builder. It is the single source of truth for "is this a valid class": the config validator delegates here, so adding a provider means editing only modelClassBuilders.

func SupportsThoughtLevel

func SupportsThoughtLevel(c ModelClass) bool

SupportsThoughtLevel reports whether a model class exposes a meaningful thinking switch: ark/claude/gemini/qwen/ollama do; openai/deepseek do not. It is the single home for this per-class fact; the ACP config-option layer delegates here when deciding whether to advertise a thought_level selector.

Types

type ArkConnectionInfo

type ArkConnectionInfo struct {
	Region string `json:"region,omitempty" yaml:"region,omitempty"`
}

type BuildOption

type BuildOption func(p *LLMParams)

func WithLLMMaxTokens

func WithLLMMaxTokens(maxTokens int) BuildOption

type Builder

type Builder interface {
	Build(ctx context.Context, params *LLMParams) (model.ToolCallingChatModel, error)
}

func NewBuilder

func NewBuilder(cfg *ModelConfig) (Builder, error)

type ConnectionInfo

type ConnectionInfo struct {
	APIKey  string `json:"api_key" yaml:"api_key"`
	BaseURL string `json:"base_url,omitempty" yaml:"base_url,omitempty"`
	Model   string `json:"model" yaml:"model"`

	Ark    *ArkConnectionInfo    `json:"ark,omitempty" yaml:"ark,omitempty"`
	OpenAI *OpenAIConnectionInfo `json:"openai,omitempty" yaml:"openai,omitempty"`
	Gemini *GeminiConnectionInfo `json:"gemini,omitempty" yaml:"gemini,omitempty"`
}

type GeminiConnectionInfo

type GeminiConnectionInfo struct {
	Backend  string `json:"backend,omitempty" yaml:"backend,omitempty"`
	Project  string `json:"project,omitempty" yaml:"project,omitempty"`
	Location string `json:"location,omitempty" yaml:"location,omitempty"`
}

type LLMParams

type LLMParams struct {
	Temperature      *float32       `json:"temperature,omitempty" yaml:"temperature,omitempty"`
	FrequencyPenalty *float32       `json:"frequency_penalty,omitempty" yaml:"frequency_penalty,omitempty"`
	PresencePenalty  *float32       `json:"presence_penalty,omitempty" yaml:"presence_penalty,omitempty"`
	MaxTokens        *int           `json:"max_tokens,omitempty" yaml:"max_tokens,omitempty"`
	TopP             *float32       `json:"top_p,omitempty" yaml:"top_p,omitempty"`
	TopK             *int32         `json:"top_k,omitempty" yaml:"top_k,omitempty"`
	ResponseFormat   ResponseFormat `json:"response_format,omitempty" yaml:"response_format,omitempty"`
	EnableThinking   *bool          `json:"enable_thinking,omitempty" yaml:"enable_thinking,omitempty"`
}

type ModelClass

type ModelClass string
const (
	ModelClassArk      ModelClass = "ark"
	ModelClassOpenAI   ModelClass = "openai"
	ModelClassClaude   ModelClass = "claude"
	ModelClassDeepSeek ModelClass = "deepseek"
	ModelClassGemini   ModelClass = "gemini"
	ModelClassOllama   ModelClass = "ollama"
	ModelClassQwen     ModelClass = "qwen"
)

type ModelConfig

type ModelConfig struct {
	ModelClass   ModelClass      `json:"model_class" yaml:"model_class"`
	Connection   *ConnectionInfo `json:"connection" yaml:"connection"`
	ThinkingType ThinkingType    `json:"thinking_type,omitempty" yaml:"thinking_type,omitempty"`
}

type OpenAIConnectionInfo

type OpenAIConnectionInfo struct {
	ByAzure    bool   `json:"by_azure,omitempty" yaml:"by_azure,omitempty"`
	APIVersion string `json:"api_version,omitempty" yaml:"api_version,omitempty"`
}

type ResponseFormat

type ResponseFormat string
const (
	ResponseFormatText     ResponseFormat = "text"
	ResponseFormatJSON     ResponseFormat = "json"
	ResponseFormatMarkdown ResponseFormat = "markdown"
)

type ThinkingType

type ThinkingType string
const (
	ThinkingTypeAuto    ThinkingType = "auto"
	ThinkingTypeEnable  ThinkingType = "enable"
	ThinkingTypeDisable ThinkingType = "disable"
)

Jump to

Keyboard shortcuts

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