 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- type GenerateOption
- func WithDebug() GenerateOption
- func WithDraftTokens(n int) GenerateOption
- func WithMaxTokens(n int) GenerateOption
- func WithSeed(seed int) GenerateOption
- func WithStopWords(words ...string) GenerateOption
- func WithTemperature(t float32) GenerateOption
- func WithTopK(k int) GenerateOption
- func WithTopP(p float32) GenerateOption
 
- type Model
- func (m *Model) Close() error
- func (m *Model) Generate(prompt string, opts ...GenerateOption) (string, error)
- func (m *Model) GenerateStream(prompt string, callback func(token string) bool, opts ...GenerateOption) error
- func (m *Model) GenerateWithDraft(prompt string, draft *Model, opts ...GenerateOption) (string, error)
- func (m *Model) GenerateWithDraftStream(prompt string, draft *Model, callback func(token string) bool, ...) error
- func (m *Model) GetEmbeddings(text string) ([]float32, error)
- func (m *Model) Tokenize(text string) ([]int32, error)
 
- type ModelOption
- func WithBatch(size int) ModelOption
- func WithContext(size int) ModelOption
- func WithEmbeddings() ModelOption
- func WithF16Memory() ModelOption
- func WithGPULayers(n int) ModelOption
- func WithMLock() ModelOption
- func WithMMap(enabled bool) ModelOption
- func WithMainGPU(gpu string) ModelOption
- func WithTensorSplit(split string) ModelOption
- func WithThreads(n int) ModelOption
 
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GenerateOption ¶
type GenerateOption func(*generateConfig)
GenerateOption configures text generation
func WithDebug ¶
func WithDebug() GenerateOption
func WithDraftTokens ¶
func WithDraftTokens(n int) GenerateOption
func WithSeed ¶
func WithSeed(seed int) GenerateOption
func WithStopWords ¶
func WithStopWords(words ...string) GenerateOption
func WithTemperature ¶
func WithTemperature(t float32) GenerateOption
func WithTopK ¶
func WithTopK(k int) GenerateOption
func WithTopP ¶
func WithTopP(p float32) GenerateOption
type Model ¶
type Model struct {
	// contains filtered or unexported fields
}
    Model represents a loaded LLAMA model with its context
func LoadModel ¶
func LoadModel(path string, opts ...ModelOption) (*Model, error)
LoadModel loads a GGUF model from the specified path
func (*Model) Generate ¶
func (m *Model) Generate(prompt string, opts ...GenerateOption) (string, error)
Generate generates text from the given prompt
func (*Model) GenerateStream ¶
func (m *Model) GenerateStream(prompt string, callback func(token string) bool, opts ...GenerateOption) error
GenerateStream generates text with streaming output via callback
func (*Model) GenerateWithDraft ¶
func (m *Model) GenerateWithDraft(prompt string, draft *Model, opts ...GenerateOption) (string, error)
GenerateWithDraft performs speculative generation using a draft model
func (*Model) GenerateWithDraftStream ¶
func (m *Model) GenerateWithDraftStream(prompt string, draft *Model, callback func(token string) bool, opts ...GenerateOption) error
GenerateWithDraftStream performs speculative generation with streaming output
func (*Model) GetEmbeddings ¶
GetEmbeddings computes embeddings for the given text
type ModelOption ¶
type ModelOption func(*modelConfig)
ModelOption configures model loading
func WithBatch ¶
func WithBatch(size int) ModelOption
func WithEmbeddings ¶
func WithEmbeddings() ModelOption
func WithF16Memory ¶
func WithF16Memory() ModelOption
func WithGPULayers ¶
func WithGPULayers(n int) ModelOption
func WithMLock ¶
func WithMLock() ModelOption
func WithMMap ¶
func WithMMap(enabled bool) ModelOption
func WithMainGPU ¶
func WithMainGPU(gpu string) ModelOption
func WithTensorSplit ¶
func WithTensorSplit(split string) ModelOption
func WithThreads ¶
func WithThreads(n int) ModelOption
       Directories
      ¶
      Directories
      ¶
    
    | Path | Synopsis | 
|---|---|
| examples
       | |
| 
          
            embedding
            
            command
          
          
         | |
| 
          
            simple
            
            command
          
          
         | |
| 
          
            speculative
            
            command
          
          
         | |
| 
          
            streaming
            
            command
          
          
         | 
 Click to show internal directories. 
   Click to hide internal directories.