Documentation
¶
Index ¶
- Constants
- func CloneAnyMap(in map[string]any) map[string]any
- func DbrainModelfilePreset() map[string]any
- func ResolveBaseURL(opts BaseURLResolveOptions) (string, error)
- type BaseURLResolveOptions
- type Capabilities
- type CapabilityStatus
- type HeaderPolicy
- type ModelRef
- type ParamAccounting
- type ParamPolicy
- type ParityParams
- type PromptPolicy
- type Provider
- type ProviderOverrides
- type ProviderSpec
- type ReasoningPolicy
- type Registry
- type ResolveOptions
- type Target
- type Task
- type Transport
Constants ¶
const ( ParityPresetNone = "none" ParityPresetDbrainModelfile = "dbrain-modelfile" )
Parity preset identifiers used by model_bakeoff --parity-preset.
const ( StrictnessNone = "none" StrictnessStrict = "strict" StrictnessNonStrict = "non-strict" )
Strictness labels describe how strict a parity run is about the parameters actually sent to a provider.
const ( ToolOllamaDirect = "ollama-direct" ToolOpenRouterDirect = "openrouter-direct" ToolLMStudioDirect = "lmstudio-direct" ToolOMLXDirect = "omlx-direct" ToolVersionOllamaDirect = "ollama-direct-v1" ToolVersionOpenRouterDirect = "openrouter-direct-v1" ToolVersionLMStudioDirect = "lmstudio-direct-v1" ToolVersionOMLXDirect = "omlx-direct-v1" )
Variables ¶
This section is empty.
Functions ¶
func CloneAnyMap ¶
CloneAnyMap returns a shallow copy of the input map. Exported so other packages can clone inference parameter maps when building provider-specific request bodies.
func DbrainModelfilePreset ¶
DbrainModelfilePreset returns the sampler values defined in the repo Modelfile. These are the canonical dbrain parity values for local runs.
func ResolveBaseURL ¶ added in v0.8.0
func ResolveBaseURL(opts BaseURLResolveOptions) (string, error)
ResolveBaseURL resolves one provider endpoint without reading API keys, secret references, model strings, or task-specific headers.
Types ¶
type BaseURLResolveOptions ¶ added in v0.8.0
type Capabilities ¶
type Capabilities struct {
Text bool
Images CapabilityStatus
JSONMode CapabilityStatus
ToolCalling CapabilityStatus
ReasoningCtl CapabilityStatus
}
func TextOnlyCapabilities ¶
func TextOnlyCapabilities() Capabilities
type CapabilityStatus ¶
type CapabilityStatus string
const ( CapabilitySupported CapabilityStatus = "supported" CapabilityUnsupported CapabilityStatus = "unsupported" CapabilityModelDependentOrUnverified CapabilityStatus = "model_dependent_or_unverified" )
type HeaderPolicy ¶
type ModelRef ¶
type ModelRef struct {
Original string
Provider Provider
APIModel string
ProviderQualified bool
Spec *ProviderSpec
}
ModelRef is the parsed form of a provider-qualified model string.
func ParseModelRef ¶
type ParamAccounting ¶
type ParamAccounting struct {
Requested map[string]any
Sent map[string]any
Omitted map[string]string
Strictness string
}
ParamAccounting records the requested, sent, and omitted inference parameters for a model call. Requested is the caller's requested shape; Sent is what goes on the wire; Omitted maps requested-but-not-sent keys to a reason.
func AccountParamsForSpec ¶
func AccountParamsForSpec(spec ProviderSpec, requested map[string]any) ParamAccounting
func DbrainParityForSpec ¶
func DbrainParityForSpec(spec ProviderSpec) ParamAccounting
type ParamPolicy ¶
type ParityParams ¶
type ParityParams = ParamAccounting
func DbrainParityForProvider ¶
func DbrainParityForProvider(provider Provider) ParityParams
DbrainParityForProvider returns the dbrain Modelfile parity parameters adjusted for what each provider path can actually accept.
Ollama: all Modelfile sampler values are sent through the native /api/chat options object, so strict parity is achievable.
LM Studio/oMLX/configured local OpenAI-compatible backends: temperature and top_p are sent as standard chat-completions fields. top_k, repeat_penalty, and min_p are omitted until a backend path is verified to accept them. The run is therefore labelled non-strict.
Other providers (including OpenRouter) receive no local parity parameters from this preset.
func EmptyParityParams ¶
func EmptyParityParams() ParityParams
EmptyParityParams is the zero shape used when no parity preset is active.
type PromptPolicy ¶
type PromptPolicy struct {
ParityStatusWithPreset string
}
type Provider ¶
type Provider string
Provider identifies the LLM backend a model string targets.
func EmptyProviderRef ¶
type ProviderOverrides ¶
type ProviderSpec ¶
type ProviderSpec struct {
ID Provider
DisplayName string
Transport Transport
Local bool
DefaultBaseURL string
DefaultAPIKey string
BaseURLEnvKeys []string
APIKeyEnvKeys []string
RequiresAPIKey bool
HeaderPolicy HeaderPolicy
ToolName string
ToolVersion string
ParamPolicy ParamPolicy
PromptPolicy PromptPolicy
ReasoningPolicy ReasoningPolicy
Capabilities Capabilities
ConfigPath []string
}
func BuiltInProviderSpecs ¶
func BuiltInProviderSpecs() []ProviderSpec
type ReasoningPolicy ¶
type ReasoningPolicy struct {
StatusWithDirectCall string
}
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func NewRegistry() Registry
func RegistryForRoot ¶
func (Registry) EmptyProviderRef ¶
func (Registry) ParseModelRef ¶
func (*Registry) Register ¶
func (r *Registry) Register(spec ProviderSpec) error
type ResolveOptions ¶
type Target ¶
type Target struct {
Ref ModelRef
Spec ProviderSpec
BaseURL string
APIKey string
Headers map[string]string
DisplayName string
}
func ResolveTarget ¶
func ResolveTarget(ctx context.Context, opts ResolveOptions) (Target, error)