llms

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: May 24, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTemperature = 0.0
View Source
const InvalidLLMModelError = "llm model is not set or is invalid"
View Source
const OpenAIAPIKeyNotSetError = "ZEP_OPENAI_API_KEY is not set" //nolint:gosec

Variables

View Source
var MaxLLMTokensMap = map[string]int{
	"gpt-3.5-turbo":     4096,
	"gpt-3.5-turbo0301": 8192,
	"gpt-4":             8192,
}
View Source
var ValidLLMMap = map[string]bool{
	"gpt-3.5-turbo":     true,
	"gpt-3.5-turbo0301": true,
	"gpt-4":             true,
}

Functions

func EmbedMessages

func EmbedMessages(
	ctx context.Context,
	appState *models.AppState,
	text []string,
) ([]openai.Embedding, error)

func GetLLMModelName

func GetLLMModelName(cfg *config.Config) (string, error)

func GetTokenCount

func GetTokenCount(text string) (int, error)

func NewOpenAIRetryClient added in v0.4.6

func NewOpenAIRetryClient(cfg *config.Config) *openairetryclient.OpenAIRetryClient

func RunChatCompletion

func RunChatCompletion(
	ctx context.Context,
	appState *models.AppState,
	summaryMaxTokens int,
	prompt string,
) (resp openai.ChatCompletionResponse, err error)

Types

type LLMError

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

func NewLLMError

func NewLLMError(message string, originalError error) *LLMError

func (*LLMError) Error

func (e *LLMError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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