common

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const AnswerReset = "reset"

Variables

This section is empty.

Functions

func BuildEnvVariable

func BuildEnvVariable(name string) string

func BuildEnvVariablePrefix

func BuildEnvVariablePrefix(name string) (ret string)

Types

type ChatOptions

type ChatOptions struct {
	Model            string
	Temperature      float64
	TopP             float64
	PresencePenalty  float64
	FrequencyPenalty float64
	Raw              bool
}

type ChatRequest

type ChatRequest struct {
	ContextName      string
	SessionName      string
	PatternName      string
	PatternVariables map[string]string
	Message          string
}

type Configurable

type Configurable struct {
	Settings
	SetupQuestions

	Label         string
	EnvNamePrefix string

	ConfigureCustom func() error
}

func (*Configurable) AddSetting

func (o *Configurable) AddSetting(name string, required bool) (ret *Setting)

func (*Configurable) AddSetupQuestion

func (o *Configurable) AddSetupQuestion(name string, required bool) (ret *SetupQuestion)

func (*Configurable) AddSetupQuestionCustom

func (o *Configurable) AddSetupQuestionCustom(name string, required bool, question string) (ret *SetupQuestion)

func (*Configurable) Configure

func (o *Configurable) Configure() (err error)

func (*Configurable) GetName

func (o *Configurable) GetName() string

func (*Configurable) Setup

func (o *Configurable) Setup() (err error)

func (*Configurable) SetupFillEnvFileContent

func (o *Configurable) SetupFillEnvFileContent(fileEnvFileContent *bytes.Buffer)

func (*Configurable) SetupOrSkip

func (o *Configurable) SetupOrSkip() (err error)

type Message

type Message struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

func NormalizeMessages

func NormalizeMessages(msgs []*Message, defaultUserMessage string) (ret []*Message)

NormalizeMessages remove empty messages and ensure messages order user-assist-user

type Setting

type Setting struct {
	EnvVariable string
	Value       string
	Required    bool
}

func NewSetting

func NewSetting(envVariable string, required bool) *Setting

func (*Setting) Configure

func (o *Setting) Configure() error

func (*Setting) FillEnvFileContent

func (o *Setting) FillEnvFileContent(buffer *bytes.Buffer)

func (*Setting) IsDefined

func (o *Setting) IsDefined() bool

func (*Setting) IsValid

func (o *Setting) IsValid() bool

func (*Setting) IsValidErr

func (o *Setting) IsValidErr() (err error)

func (*Setting) Print

func (o *Setting) Print()

type Settings

type Settings []*Setting

func (Settings) Configure

func (o Settings) Configure() (err error)

func (Settings) FillEnvFileContent

func (o Settings) FillEnvFileContent(buffer *bytes.Buffer)

func (Settings) IsConfigured

func (o Settings) IsConfigured() (ret bool)

type SetupQuestion

type SetupQuestion struct {
	*Setting
	Question string
}

func (*SetupQuestion) Ask

func (o *SetupQuestion) Ask(label string) (err error)

func (*SetupQuestion) OnAnswer

func (o *SetupQuestion) OnAnswer(answer string) (err error)

type SetupQuestions

type SetupQuestions []*SetupQuestion

func (SetupQuestions) Ask

func (o SetupQuestions) Ask(label string) (err error)

Jump to

Keyboard shortcuts

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