Versions in this module Expand all Collapse all v1 v1.0.3 Dec 11, 2025 v1.0.2 Dec 11, 2025 v1.0.1 Dec 11, 2025 v1.0.0 Dec 11, 2025 Changes in this version + const Version + var AutoConfig autoConfig + var AutoModelForCausalLM autoModelForCausalLM + var AutoTokenizer autoTokenizer + func EnsureONNXRuntimeSharedLib() (string, error) + func HFHubDownload(repoID, filename string) (string, error) + func HFHubEnsureFiles(repoID string, files []string) (map[string]string, error) + func HFHubEnsureOptionalFiles(repoID string, files []string) (map[string]string, error) + type ChatMessage struct + Content string + Name string + Role MessageRole + ToolCallID string + type Config struct + func (c *Config) BOS_TOKEN_ID() int64 + func (c *Config) ConvLCache() int + func (c *Config) EOS_TOKEN_ID() int64 + func (c *Config) HiddenSize() int + func (c *Config) LayerTypes() []string + func (c *Config) ModelType() string + func (c *Config) NumAttentionHeads() int + func (c *Config) NumHiddenLayers() int + func (c *Config) NumKeyValueHeads() int + func (c *Config) PAD_TOKEN_ID() int64 + func (c *Config) Raw() map[string]any + func (c *Config) StopStrings() []string + func (c *Config) VocabSize() int + type GenerationOptions struct + DoSample bool + MaxNewTokens int + StopSequences []string + Streamer func(ev PipelineStreamEvent) bool + type Generator func(messages []ChatMessage, options map[string]any) ([]map[string]any, error) + func Pipeline(task string, modelID string, options map[string]any) (Generator, error) + type IOPreset int + const IOPresetAuto + const IOPresetLFM2 + const IOPresetSimpleCausal + type MessageRole string + const RoleAssistant + const RoleSystem + const RoleTool + const RoleUser + type ModelForCausalLM struct + func (m *ModelForCausalLM) Generate(tokenizer *Tokenizer, inputIDs [][]int64, attentionMask [][]int64, ...) ([][]int64, error) + type PipelineStreamEvent struct + DeltaText string + Done bool + FullText string + Step int + TokenID int64 + type Tokenizer struct + func (t *Tokenizer) BatchDecode(batch [][]int64) ([]string, error) + func (t *Tokenizer) Decode(ids []int64) (string, error) + func (t *Tokenizer) Encode(text string, addSpecialTokens bool) ([]int64, error) + func (t *Tokenizer) EncodeChat(messages []ChatMessage) (inputIDs [][]int64, attentionMask [][]int64, promptLen int, rawText string, ...) + func (t *Tokenizer) Info() string + type ToolDefinition struct + Description string + Name string + Parameters ToolParameter + type ToolParameter struct + Description string + Enum []string + Properties map[string]ToolParameter + Required []string + Type string