Versions in this module Expand all Collapse all v0 v0.1.1 Dec 19, 2023 Changes in this version + const DELIMITER + const RoleAssistant + const RoleObservation + const RoleSystem + const RoleUser + const TypeCode + const TypeFunction + type ChatMessage struct + Content string + Role string + ToolCalls []*ToolCallMessage + func NewAssistantMsg(input string, modelType string) *ChatMessage + func NewObservationMsg(content string) *ChatMessage + func NewSystemMsg(content string) *ChatMessage + func NewUserMsg(content string) *ChatMessage type Chatglm + func (llm *Chatglm) ModelType() string + type CodeMessage struct + Input string + type FunctionMessage struct + Arguments string + Name string + type ToolCallMessage struct + Code *CodeMessage + Function *FunctionMessage + Type string v0.1.0 Nov 26, 2023 Changes in this version + type Chatglm struct + func New(model string) (*Chatglm, error) + func (llm *Chatglm) Chat(history []string, opts ...GenerationOption) (string, error) + func (llm *Chatglm) Embeddings(text string, opts ...GenerationOption) ([]int, error) + func (llm *Chatglm) Free() + func (llm *Chatglm) Generate(prompt string, opts ...GenerationOption) (string, error) + func (llm *Chatglm) StreamChat(history []string, opts ...GenerationOption) (string, error) + func (llm *Chatglm) StreamGenerate(prompt string, opts ...GenerationOption) (string, error) + type GenerationOption func(g *GenerationOptions) + func SetDoSample(doSample bool) GenerationOption + func SetMaxContextLength(maxContextLength int) GenerationOption + func SetMaxLength(maxLength int) GenerationOption + func SetNumThreads(numThreads int) GenerationOption + func SetRepetitionPenalty(repetitionPenalty float32) GenerationOption + func SetStreamCallback(callback func(string) bool) GenerationOption + func SetTemperature(temperature float32) GenerationOption + func SetTopK(topK int) GenerationOption + func SetTopP(topP float32) GenerationOption + type GenerationOptions struct + DoSample bool + MaxContextLength int + MaxLength int + NumThreads int + RepetitionPenalty float32 + StreamCallback func(string) bool + Temperature float32 + TopK int + TopP float32 + var DefaultGenerationOptions GenerationOptions = GenerationOptions{ ... } + func NewGenerationOptions(opts ...GenerationOption) *GenerationOptions