modelrepo

package
v1.0.0-rc.13 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 21 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 (
	PromptCacheFieldTools    = "tools"
	PromptCacheFieldSystem   = "system"
	PromptCacheFieldMessages = "messages"
)
View Source
const (
	PromptCacheTTLFiveMinutes = "5m"
	PromptCacheTTLOneHour     = "1h"
)
View Source
const DefaultCallTimeout = 10 * time.Minute
View Source
const MaxInlineAudioBytes = 14 << 20
View Source
const MaxStopSequences = 4
View Source
const ModelResourcePrefix = "models/"
View Source
const ObservedDisplayNameMetaKey = "display_name"
View Source
const ObservedFunctionCallingMetaKey = "function_calling"
View Source
const ScriptedTestBackendType = "scripted-test"

ScriptedTestBackendType is the in-binary test backend: its replies are replayed from a script file, never generated by a model.

View Source
const ToolResultErrorKey = "tool_result_is_error"
View Source
const WAVMimeType = "audio/wav"

Variables

View Source
var (
	ErrAudioNotSupported    = errors.New("model cannot accept audio input")
	ErrUnsupportedAudioMime = errors.New("unsupported audio media type")
	ErrAudioTooLarge        = errors.New("inline audio exceeds the request size limit")
)
View Source
var (
	ErrContextLengthExceeded  = errors.New("request exceeds the model's context window")
	ErrRateLimited            = errors.New("provider rate limit or capacity limit hit")
	ErrModelNotFoundOnBackend = errors.New("backend does not serve the requested model")
	ErrModelAccessDenied      = errors.New("backend denied access to the requested model")
	ErrPaymentRequired        = errors.New("provider account requires payment")
	ErrRequestTooLarge        = errors.New("request exceeds the provider's size limit")
	ErrCredentialsMissing     = errors.New("provider credentials are not configured")
)
View Source
var ErrAutocompleteUnsupported = errors.New("native autocomplete is unavailable; select a FIM-capable connection and model or explicitly configure instructed completion")
View Source
var ErrNextEditUnsupported = errors.New("independent next edit prediction is unavailable for the selected model")
View Source
var ErrNoDialog = errors.New("no dialog behind this provider")
View Source
var ErrNotSupported = errors.New("operation not supported")
View Source
var ErrRefused = errors.New("model refused the request")
View Source
var ErrStreamIdle = errors.New("stream stalled")
View Source
var ErrStreamTruncated = errors.New("stream ended before the provider's terminal marker")
View Source
var ErrUnknownChatDialect = errors.New("unknown chat dialect")
View Source
var SharedHTTPClient = &http.Client{}
View Source
var StreamIdleTimeout = 5 * time.Minute
View Source
var SupportedAudioMimeTypes = map[string]bool{
	"audio/wav":  true,
	"audio/mpeg": true,
	"audio/mp4":  true,
	"audio/ogg":  true,
	"audio/flac": true,
}

Functions

func AudioMimeFromBytes

func AudioMimeFromBytes(data []byte) (mime string, ok bool)

func CanonicalBackendType added in v0.32.0

func CanonicalBackendType(backendType string) string

CanonicalBackendType maps compatibility backend keywords to the implementation type used by the runtime by lowercasing and trimming the input.

func ChatDialectNames

func ChatDialectNames() []string

func ClampMaxOutputTokens added in v0.29.0

func ClampMaxOutputTokens(requested, ceiling int) (int, bool)

func ClampMaxOutputTokensPtr added in v0.29.0

func ClampMaxOutputTokensPtr(tokens *int, ceiling int) *int

func ClassifyProviderError

func ClassifyProviderError(err error, httpStatus int, code, message string) error

func DoWithRetry

func DoWithRetry(ctx context.Context, client *http.Client, build func() (*http.Request, error)) (*http.Response, error)

func GeminiModelSupportsAudio

func GeminiModelSupportsAudio(modelName string) bool

func GeminiModelSupportsVision

func GeminiModelSupportsVision(modelName string) bool

func HasCatalogProvider

func HasCatalogProvider(backendType string) bool

func IsBackendTerminal

func IsBackendTerminal(err error) bool

func IsContextLimitMessage

func IsContextLimitMessage(s string) bool

func IsLocalBackendType added in v0.32.6

func IsLocalBackendType(backendType string) bool

func IsRetryableStreamFailure

func IsRetryableStreamFailure(err error) bool

func IsWAV

func IsWAV(data []byte) bool

func MarkModelAvailable

func MarkModelAvailable(scope, model string)

func MarkModelUnavailable

func MarkModelUnavailable(scope, model string)

func MessagesAudioBytes

func MessagesAudioBytes(messages []Message) (parts int, totalBytes int)

func MessagesHaveAudio

func MessagesHaveAudio(messages []Message) bool

func MessagesHaveImages

func MessagesHaveImages(messages []Message) bool

func MessagesImageCount

func MessagesImageCount(messages []Message) int

func ModelID

func ModelID(name string) string

func NonStreamingContext

func NonStreamingContext(ctx context.Context) (context.Context, context.CancelFunc)

func OpenAIModelSupportsVision

func OpenAIModelSupportsVision(modelName string) bool

func ProviderErrorDetail

func ProviderErrorDetail(body []byte) (code, message string)

func RefuseAudioInput

func RefuseAudioInput(providerType, modelName string, messages []Message) error

func RegisterCatalogProvider

func RegisterCatalogProvider(backendType string, constructor CatalogProviderConstructor)

func RegisterChatDialect

func RegisterChatDialect(dialect ChatDialect)

func RegisterShutdownHook added in v0.32.0

func RegisterShutdownHook(fn func() error)

func RegisterThinkDeclarationRefusal

func RegisterThinkDeclarationRefusal(backendType, reason string)

func RequestedContextLengthFromContext added in v0.33.0

func RequestedContextLengthFromContext(ctx context.Context) int

func ResetUnavailableModels

func ResetUnavailableModels(scope string)

func RetryAfterDelay

func RetryAfterDelay(h http.Header, fallback time.Duration) time.Duration

func RewriteChatBody

func RewriteChatBody(dialect ChatDialect, body []byte, req DialectRequest) ([]byte, error)

func SameModel

func SameModel(a, b string) bool

func SanitizeToolName

func SanitizeToolName(in string) string

SanitizeToolName maps an engine tool name (for example "local_fs.read_file") to the form the provider wire formats accept: ASCII letters, digits, '_' and '-', with leading and trailing '_'/'-' trimmed. Provider codecs apply this rule (plus provider-specific length limits and de-duplication) when they send tools, so a name recorded in a provider continuation is in this space.

func SetupVLLMLocalInstance

func SetupVLLMLocalInstance(ctx context.Context, model string, tag string, toolParser string) (string, testcontainers.Container, func(), error)

func Shutdown added in v0.32.0

func Shutdown() error

func SupportedAudioMimeList

func SupportedAudioMimeList() string

func ThinkDeclarationRefusal

func ThinkDeclarationRefusal(backendType string) (reason string, ok bool)

func UnavailableModels

func UnavailableModels(scope string) []string

func ValidateAudioBytes

func ValidateAudioBytes(providerType, modelName string, messages []Message) error

func ValidateAudioParts

func ValidateAudioParts(providerType, modelName string, messages []Message) error

func WithEmbeddingPurpose

func WithEmbeddingPurpose(ctx context.Context, purpose EmbeddingPurpose) context.Context

func WithIdleTimeout

func WithIdleTimeout(rc io.ReadCloser, idle time.Duration, label string) io.ReadCloser

func WithRequestedContextLength added in v0.33.0

func WithRequestedContextLength(ctx context.Context, contextLength int) context.Context

func WithoutRequestedContextLength

func WithoutRequestedContextLength(ctx context.Context) context.Context

Types

type AudioPart

type AudioPart struct {
	Data     []byte `json:"data"`
	MimeType string `json:"mime_type"`
}

type AutocompleteRequest

type AutocompleteRequest struct {
	Prefix        string
	Suffix        string
	MaxTokens     int
	Temperature   float64
	TopP          float64
	Seed          int
	SessionKey    string
	StopSequences []string
	MinTokens     int
}

func (AutocompleteRequest) Validate

func (r AutocompleteRequest) Validate() error

type AutocompleteResult

type AutocompleteResult struct {
	Text         string
	FinishReason string
	Usage        *TokenUsage
}

type AvailabilityScoper

type AvailabilityScoper interface {
	AvailabilityScope() string
}

type BackendSpec

type BackendSpec struct {
	Type    string
	BaseURL string
	APIKey  string
}

type CacheHints

type CacheHints struct {
	SessionKey       string
	StableSystem     bool
	StableTools      bool
	StableHistoryLen int
	TTL              time.Duration
}

type CachePolicyCatalog

type CachePolicyCatalog interface {
	CachePolicy() ModelCachePolicy
}

type CapabilityConfig

type CapabilityConfig struct {
	CompletionMode   string
	FIMFormat        string
	CanAutocomplete  bool
	NextEditFormat   string
	CanNextEdit      bool
	ContextLength    int
	MaxOutputTokens  int
	CanChat          bool
	CanEmbed         bool
	CanStream        bool
	CanPrompt        bool
	CanThink         bool
	CanVision        bool
	CanAudio         bool
	AudioExtension   bool
	SessionExtension bool
	ThinkingTypes    *ThinkingTypes
	Dialect          string
	PromptCache      *PromptCacheContract
}

type CatalogFactory

type CatalogFactory interface {
	NewCatalogProvider(spec BackendSpec, opts ...CatalogOption) (CatalogProvider, error)
}

func DefaultCatalogFactory

func DefaultCatalogFactory() CatalogFactory

type CatalogOption

type CatalogOption func(*CatalogOptions)

func WithCatalogAuthorizer

func WithCatalogAuthorizer(authorize func(context.Context) (http.Header, error)) CatalogOption

func WithCatalogHTTPClient

func WithCatalogHTTPClient(client *http.Client) CatalogOption

func WithCatalogTracker

func WithCatalogTracker(tracker libtracker.ActivityTracker) CatalogOption

type CatalogOptions

type CatalogOptions struct {
	Authorize  func(context.Context) (http.Header, error)
	HTTPClient *http.Client
	Tracker    libtracker.ActivityTracker
}

type CatalogProvider

type CatalogProvider interface {
	Type() string
	ListModels(ctx context.Context) ([]ObservedModel, error)
	ProviderFor(model ObservedModel) Provider
}

func NewCatalogProvider

func NewCatalogProvider(spec BackendSpec, opts ...CatalogOption) (CatalogProvider, error)

type CatalogProviderConstructor

type CatalogProviderConstructor func(spec BackendSpec, opts CatalogOptions) (CatalogProvider, error)

type ChatArgument

type ChatArgument interface {
	Apply(config *ChatConfig)
}

func WithCacheHints

func WithCacheHints(hints CacheHints) ChatArgument

func WithMaxTokens

func WithMaxTokens(tokens int) ChatArgument

func WithParallelToolCalls

func WithParallelToolCalls(enabled bool) ChatArgument

func WithResponseFormat

func WithResponseFormat(format ResponseFormat) ChatArgument

func WithSeed

func WithSeed(seed int) ChatArgument

func WithStopSequences

func WithStopSequences(sequences ...string) ChatArgument

func WithTemperature

func WithTemperature(temp float64) ChatArgument

func WithTool

func WithTool(tool Tool) ChatArgument

func WithToolChoice

func WithToolChoice(choice ToolChoice) ChatArgument

func WithTools

func WithTools(tools ...Tool) ChatArgument

func WithTopP

func WithTopP(p float64) ChatArgument

type ChatConfig

type ChatConfig struct {
	Temperature       *float64        `json:"temperature,omitempty"`
	MaxTokens         *int            `json:"max_tokens,omitempty"`
	TopP              *float64        `json:"top_p,omitempty"`
	Seed              *int            `json:"seed,omitempty"`
	Tools             []Tool          `json:"tools,omitempty"`
	Think             *string         `json:"think,omitempty"`
	StopSequences     []string        `json:"stop_sequences,omitempty"`
	ToolChoice        *ToolChoice     `json:"tool_choice,omitempty"`
	ParallelToolCalls *bool           `json:"parallel_tool_calls,omitempty"`
	Format            *ResponseFormat `json:"response_format,omitempty"`
	Shift             *bool           `json:"shift,omitempty"`
	Truncate          *bool           `json:"truncate,omitempty"`
	CacheHints        *CacheHints     `json:"-"`
}

func (*ChatConfig) Validate

func (c *ChatConfig) Validate() error

type ChatDialect

type ChatDialect interface {
	Name() string
	DocURL() string
	RewriteBody(body map[string]any, req DialectRequest) error
	OwnsReasoning() bool
	ThinkingMember(req DialectRequest) string
	WireAssistantMessage(content, thinking string) (WireMessage, error)
}

func ChatDialectFor

func ChatDialectFor(name string) (ChatDialect, error)

func MustChatDialectFor

func MustChatDialectFor(name string) ChatDialect

type ChatResult

type ChatResult struct {
	Message      Message
	ToolCalls    []ToolCall
	Usage        *TokenUsage
	FinishReason string
	Refusal      string
}

type Continuation

type Continuation struct {
	Provider string          `json:"provider"`
	Model    string          `json:"model"`
	Items    json.RawMessage `json:"items"`
}

type DialectRequest

type DialectRequest struct {
	Think      *string
	Tools      bool
	CacheHints *CacheHints
	Thinking   *ThinkingTypes
}

func (DialectRequest) AllowsEffort

func (r DialectRequest) AllowsEffort(wire string) bool

func (DialectRequest) ThinkLevel

func (r DialectRequest) ThinkLevel() (string, error)

type EmbeddingPurpose

type EmbeddingPurpose string
const (
	EmbeddingDocument EmbeddingPurpose = "document"
	EmbeddingQuery    EmbeddingPurpose = "query"
)

func EmbeddingPurposeFromContext

func EmbeddingPurposeFromContext(ctx context.Context) EmbeddingPurpose

type FunctionTool

type FunctionTool struct {
	Name        string      `json:"name"`
	Description string      `json:"description,omitempty"`
	Parameters  interface{} `json:"parameters,omitempty"`
}

type HTTPError

type HTTPError struct {
	StatusCode int
	Code       string
	Message    string
	RequestID  string
}

func (*HTTPError) Error

func (e *HTTPError) Error() string

type ImagePart

type ImagePart struct {
	Data     []byte `json:"data"`
	MimeType string `json:"mime_type"`
}

type LLMAutocompleteClient

type LLMAutocompleteClient interface {
	Autocomplete(context.Context, AutocompleteRequest) (AutocompleteResult, error)
}

type LLMChatClient

type LLMChatClient interface {
	Chat(ctx context.Context, messages []Message, args ...ChatArgument) (ChatResult, error)
}

type LLMEmbedClient

type LLMEmbedClient interface {
	Embed(ctx context.Context, prompt string) ([]float64, error)
}

type LLMNextEditClient

type LLMNextEditClient interface {
	NextEdit(context.Context, NextEditRequest) (NextEditResult, error)
}

type LLMPromptExecClient

type LLMPromptExecClient interface {
	Prompt(ctx context.Context, systemInstruction string, temperature float32, prompt string, args ...PromptArgument) (string, *TokenUsage, error)
}

type LLMStreamClient

type LLMStreamClient interface {
	Stream(ctx context.Context, messages []Message, args ...ChatArgument) (<-chan *StreamParcel, error)
}

type Message

type Message struct {
	Continuation *Continuation `json:"continuation,omitempty"`
	Role         string        `json:"role"`
	Content      string        `json:"content"`
	Images       []ImagePart   `json:"images,omitempty"`
	Audio        []AudioPart   `json:"audio,omitempty"`
	Thinking     string        `json:"thinking,omitempty"`
	Refusal      string        `json:"refusal,omitempty"`

	ToolCalls       []ToolCall `json:"tool_calls,omitempty"`
	ToolCallID      string     `json:"tool_call_id,omitempty"`
	ToolResultError bool       `json:"tool_result_error,omitempty"`
}

type MockChatClient

type MockChatClient struct {
	// contains filtered or unexported fields
}

func (*MockChatClient) Chat

func (m *MockChatClient) Chat(ctx context.Context, messages []Message, opts ...ChatArgument) (ChatResult, error)

func (*MockChatClient) Close

func (m *MockChatClient) Close() error

type MockEmbedClient

type MockEmbedClient struct {
	// contains filtered or unexported fields
}

func (*MockEmbedClient) Close

func (m *MockEmbedClient) Close() error

func (*MockEmbedClient) Embed

func (m *MockEmbedClient) Embed(ctx context.Context, prompt string) ([]float64, error)

type MockPromptClient

type MockPromptClient struct {
	// contains filtered or unexported fields
}

func (*MockPromptClient) Close

func (m *MockPromptClient) Close() error

func (*MockPromptClient) Prompt

func (m *MockPromptClient) Prompt(ctx context.Context, systemInstruction string, temperature float32, prompt string, args ...PromptArgument) (string, *TokenUsage, error)

type MockProvider

type MockProvider struct {
	ID                  string
	Name                string
	ContextLength       int
	MaxOutputTokens     int
	CanChatFlag         bool
	CanEmbedFlag        bool
	CanStreamFlag       bool
	CanPromptFlag       bool
	CanAutocompleteFlag bool
	CanNextEditFlag     bool
	CanVisionFlag       bool
	CanAudioFlag        bool
	Backends            []string
}

func (*MockProvider) CanAudio

func (m *MockProvider) CanAudio() bool

func (*MockProvider) CanAutocomplete

func (m *MockProvider) CanAutocomplete() bool

func (*MockProvider) CanChat

func (m *MockProvider) CanChat() bool

func (*MockProvider) CanEmbed

func (m *MockProvider) CanEmbed() bool

func (*MockProvider) CanNextEdit

func (m *MockProvider) CanNextEdit() bool

func (*MockProvider) CanPrompt

func (m *MockProvider) CanPrompt() bool

func (*MockProvider) CanStream

func (m *MockProvider) CanStream() bool

func (*MockProvider) CanThink

func (m *MockProvider) CanThink() bool

func (*MockProvider) CanVision

func (m *MockProvider) CanVision() bool

func (*MockProvider) GetAutocompleteConnection

func (m *MockProvider) GetAutocompleteConnection(context.Context, string) (LLMAutocompleteClient, error)

func (*MockProvider) GetBackendIDs

func (m *MockProvider) GetBackendIDs() []string

func (*MockProvider) GetChatConnection

func (m *MockProvider) GetChatConnection(ctx context.Context, backendID string) (LLMChatClient, error)

func (*MockProvider) GetContextLength

func (m *MockProvider) GetContextLength() int

func (*MockProvider) GetEmbedConnection

func (m *MockProvider) GetEmbedConnection(ctx context.Context, backendID string) (LLMEmbedClient, error)

func (*MockProvider) GetID

func (m *MockProvider) GetID() string

func (*MockProvider) GetMaxOutputTokens added in v0.29.0

func (m *MockProvider) GetMaxOutputTokens() int

func (*MockProvider) GetNextEditConnection

func (m *MockProvider) GetNextEditConnection(context.Context, string) (LLMNextEditClient, error)

func (*MockProvider) GetPromptConnection

func (m *MockProvider) GetPromptConnection(ctx context.Context, backendID string) (LLMPromptExecClient, error)

func (*MockProvider) GetStreamConnection

func (m *MockProvider) GetStreamConnection(ctx context.Context, backendID string) (LLMStreamClient, error)

func (*MockProvider) GetType

func (m *MockProvider) GetType() string

func (*MockProvider) ModelName

func (m *MockProvider) ModelName() string

type MockStreamClient

type MockStreamClient struct {
	// contains filtered or unexported fields
}

func (*MockStreamClient) Close

func (m *MockStreamClient) Close() error

func (*MockStreamClient) Stream

func (m *MockStreamClient) Stream(ctx context.Context, messages []Message, args ...ChatArgument) (<-chan *StreamParcel, error)

type ModelCachePolicy

type ModelCachePolicy struct {
	Healthy time.Duration
	Empty   time.Duration
	Error   time.Duration
}

type NextEditRequest

type NextEditRequest struct {
	Input       modelcontract.NextEditInput
	MaxTokens   int
	Temperature float64
	TopP        float64
	Seed        int
	SessionKey  string
}

func (NextEditRequest) Validate

func (r NextEditRequest) Validate() error

type NextEditResult

type NextEditResult struct {
	Edits        []modelcontract.TextEdit
	FinishReason string
	Usage        *TokenUsage
}

type ObservedModel

type ObservedModel struct {
	Name          string
	ContextLength int
	ModifiedAt    time.Time
	Size          int64
	Digest        string
	CapabilityConfig
	Meta map[string]string
}

func WithoutUnavailableModels

func WithoutUnavailableModels(scope string, models []ObservedModel) []ObservedModel

type PromptArgument

type PromptArgument interface {
	Apply(*PromptConfig)
}

type PromptCacheContract

type PromptCacheContract struct {
	Fields []string `json:"fields,omitempty"`
	TTLs   []string `json:"ttls,omitempty"`
}

func (*PromptCacheContract) SupportsField

func (c *PromptCacheContract) SupportsField(field string) bool

func (*PromptCacheContract) SupportsTTL

func (c *PromptCacheContract) SupportsTTL(ttl string) bool

type PromptConfig

type PromptConfig struct {
	MaxTokens *int
}

func PromptConfigFromArgs

func PromptConfigFromArgs(args ...PromptArgument) (*PromptConfig, error)

type Provider

type Provider interface {
	GetBackendIDs() []string
	ModelName() string
	GetID() string
	GetType() string
	GetContextLength() int
	GetMaxOutputTokens() int
	CanChat() bool
	CanEmbed() bool
	CanStream() bool
	CanPrompt() bool
	CanAutocomplete() bool
	CanNextEdit() bool
	CanThink() bool
	CanVision() bool
	CanAudio() bool
	GetChatConnection(ctx context.Context, backendID string) (LLMChatClient, error)
	GetPromptConnection(ctx context.Context, backendID string) (LLMPromptExecClient, error)
	GetAutocompleteConnection(ctx context.Context, backendID string) (LLMAutocompleteClient, error)
	GetNextEditConnection(ctx context.Context, backendID string) (LLMNextEditClient, error)
	GetEmbedConnection(ctx context.Context, backendID string) (LLMEmbedClient, error)
	GetStreamConnection(ctx context.Context, backendID string) (LLMStreamClient, error)
}

type ProviderError

type ProviderError struct {
	StatusCode int
	Code       string
	Message    string
	RequestID  string
	// contains filtered or unexported fields
}

func (*ProviderError) Error

func (e *ProviderError) Error() string

func (*ProviderError) Unwrap

func (e *ProviderError) Unwrap() error

type RefusalError

type RefusalError struct {
	Provider string
	Code     string
	Text     string
}

func (*RefusalError) Error

func (e *RefusalError) Error() string

func (*RefusalError) Unwrap

func (e *RefusalError) Unwrap() error

type ResponseFormat

type ResponseFormat struct {
	Mode   ResponseFormatMode
	Name   string
	Schema any
	Strict bool
}

func (ResponseFormat) Validate

func (f ResponseFormat) Validate() error

type ResponseFormatMode

type ResponseFormatMode string
const (
	ResponseFormatText       ResponseFormatMode = "text"
	ResponseFormatJSONObject ResponseFormatMode = "json_object"
	ResponseFormatJSONSchema ResponseFormatMode = "json_schema"
)

type StreamAssembler

type StreamAssembler struct {
	// contains filtered or unexported fields
}

func NewStreamAssembler

func NewStreamAssembler(providerType, modelName string) *StreamAssembler

func (*StreamAssembler) Consume

func (a *StreamAssembler) Consume(p *StreamParcel) error

func (*StreamAssembler) Result

func (a *StreamAssembler) Result() (StreamResult, error)

type StreamParcel

type StreamParcel struct {
	Data     string
	Thinking string
	ToolCall *ToolCallDelta
	Usage    *TokenUsage
	Terminal *StreamTerminal
	Error    error
}

type StreamResult

type StreamResult struct {
	Continuation *Continuation
	Content      string
	Thinking     string
	ToolCalls    []ToolCall
	FinishReason string
	Refusal      string
	StopSequence string
	Usage        *TokenUsage
	Violations   []string
}

type StreamTerminal

type StreamTerminal struct {
	Continuation *Continuation
	FinishReason string
	Usage        *TokenUsage
	Refusal      string
	StopSequence string
	Terminated   bool
}

type ThinkingTypes

type ThinkingTypes struct {
	Adaptive     bool     `json:"adaptive"`
	Enabled      bool     `json:"enabled"`
	Disabled     bool     `json:"disabled"`
	EffortLevels []string `json:"effortLevels,omitempty"`
}

func (*ThinkingTypes) Controls

func (t *ThinkingTypes) Controls() bool

func (*ThinkingTypes) SupportsEffort

func (t *ThinkingTypes) SupportsEffort(level string) bool

func (*ThinkingTypes) Validate

func (t *ThinkingTypes) Validate() error

type TokenUsage

type TokenUsage struct {
	PromptTokens     int
	CompletionTokens int
	ThinkingTokens   int
	TotalTokens      int
	CacheReadTokens  int
	CacheWriteTokens int
}

func (*TokenUsage) Merge

func (u *TokenUsage) Merge(src *TokenUsage)

type Tool

type Tool struct {
	Type     string        `json:"type"`
	Function *FunctionTool `json:"function,omitempty"`
}

type ToolCall

type ToolCall struct {
	ID       string `json:"id,omitempty"`
	Type     string `json:"type"`
	Function struct {
		Name      string `json:"name"`
		Arguments string `json:"arguments"`
	} `json:"function"`
	ProviderMeta map[string]string `json:"provider_meta,omitempty"`
	ArgsMissing  bool              `json:"-"`
}

type ToolCallDelta

type ToolCallDelta struct {
	Index        int
	ID           string
	Type         string
	Name         string
	ArgsFragment string
	ArgsReplace  bool
	ProviderMeta map[string]string
}

type ToolChoice

type ToolChoice struct {
	Mode ToolChoiceMode
	Tool string
}

func (ToolChoice) Validate

func (t ToolChoice) Validate() error

type ToolChoiceMode

type ToolChoiceMode string
const (
	ToolChoiceAuto     ToolChoiceMode = "auto"
	ToolChoiceNone     ToolChoiceMode = "none"
	ToolChoiceRequired ToolChoiceMode = "required"
)

type UnsupportedDialectLevelError

type UnsupportedDialectLevelError struct {
	Dialect string
	Level   string
}

func (*UnsupportedDialectLevelError) Error

type WireMessage

type WireMessage map[string]any

type WithPromptMaxTokens

type WithPromptMaxTokens int

func (WithPromptMaxTokens) Apply

func (w WithPromptMaxTokens) Apply(config *PromptConfig)

type WithShift

type WithShift struct{}

func (WithShift) Apply

func (WithShift) Apply(cfg *ChatConfig)

type WithThink

type WithThink string

func (WithThink) Apply

func (w WithThink) Apply(cfg *ChatConfig)

Directories

Path Synopsis
codec
Package modeldconn is the runtime's client seam to the modeld / embedded daemon: it resolves the current lease leader (via modeldprobe), dials it over the gRPC transport, and opens sessions.
Package modeldconn is the runtime's client seam to the modeld / embedded daemon: it resolves the current lease leader (via modeldprobe), dials it over the gRPC transport, and opens sessions.

Jump to

Keyboard shortcuts

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