Versions in this module Expand all Collapse all v1 v1.18.0 Aug 11, 2023 v1.9.9 Oct 24, 2023 Changes in this version + const DefaultOpenAIModel + const DefaultOpenAIModelTokenLimit + func GetCacheKey(provider string, sEnc string) string + func NumTokensFromMessages(messages []openai.ChatCompletionMessage, model string) (num_tokens int, err error) + func NumTokensFromPrompt(prompt string, model string) (num_tokens int, err error) + type ILLM interface + Configure func(config LLMConfig) error + GetCompletion func(ctx context.Context, prompt string, options ...ParamOption) (string, error) + GetName func() string + Parse func(ctx context.Context, prompt string, cache cache.ICache, options ...ParamOption) (string, error) + func NewClient(provider string) (ILLM, error) + type LLMConfig struct + APIType string + BaseURL string + Model string + Name string + Proxy string + Token string + func (p *LLMConfig) GetAPIType() string + func (p *LLMConfig) GetBaseURL() string + func (p *LLMConfig) GetModel() string + func (p *LLMConfig) GetName() string + func (p *LLMConfig) GetProxy() string + func (p *LLMConfig) GetToken() string + type OpenAIClient struct + func (a *OpenAIClient) GetName() string + func (a *OpenAIClient) Parse(ctx context.Context, prompt string, cache cache.ICache, options ...ParamOption) (string, error) + func (c *OpenAIClient) Configure(config LLMConfig) error + func (c *OpenAIClient) GetCompletion(ctx context.Context, prompt string, options ...ParamOption) (string, error) + type ParamOption func(*ParamOptions) + func WithLogitBias(logitBias map[string]int) ParamOption + func WithMaxTokens(maxTokens int) ParamOption + func WithModel(model string) ParamOption + func WithOptions(options ParamOptions) ParamOption + func WithStopWords(stopWords []string) ParamOption + func WithTemperature(temperature float32) ParamOption + type ParamOptions struct + LogitBias map[string]int + MaxTokens int + Model string + StopWords []string + Temperature float32 + func ValidOptions(options ParamOptions) ParamOptions Other modules containing this package github.com/koderover/zadig/v2