chat

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GPT3Dot5Turbo     = "gpt-3.5-turbo"
	GPT3Dot5Turbo0301 = "gpt-3.5-turbo-0301"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

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

type ParameterLayer

type ParameterLayer struct {
	*layers.ParameterLayerImpl `yaml:",inline"`
}

func NewParameterLayer

func NewParameterLayer(options ...layers.ParameterLayerOptions) (*ParameterLayer, error)

type Step

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

func NewStep

func NewStep(settings *StepSettings) *Step

func (*Step) GetOutput

func (s *Step) GetOutput() <-chan helpers.Result[string]

func (*Step) GetState

func (s *Step) GetState() interface{}

func (*Step) IsFinished

func (s *Step) IsFinished() bool

func (*Step) Run

func (s *Step) Run(ctx context.Context, messages []Message) error

type StepFactory

type StepFactory struct {
	ClientSettings *openai.ClientSettings `yaml:"client,omitempty"`
	StepSettings   *StepSettings          `yaml:"chat-completion,omitempty"`
}

func NewStepFactory

func NewStepFactory(
	clientSettings *openai.ClientSettings,
	stepSettings *StepSettings,
) *StepFactory

func (*StepFactory) NewStep

func (csf *StepFactory) NewStep() (steps.Step[[]Message, string], error)

func (*StepFactory) UpdateFromParameters

func (csf *StepFactory) UpdateFromParameters(ps map[string]interface{}) error

type StepSettings

type StepSettings struct {
	ClientSettings *openai.ClientSettings `yaml:"client,omitempty"`

	Engine *string `yaml:"engine,omitempty" glazed.parameter:"openai-engine"`

	MaxResponseTokens *int `yaml:"max_response_tokens,omitempty" glazed.parameter:"openai-max-response-tokens"`

	// TopP to use
	TopP *float64 `yaml:"top_p,omitempty" glazed.parameter:"openai-top-p"`
	// Sampling temperature to use
	Temperature *float64 `yaml:"temperature,omitempty" glazed.parameter:"openai-temperature"`
	// How many choice to create for each prompt
	N *int `yaml:"n" glazed.parameter:"openai-n"`
	// Up to 4 sequences where the API will stop generating tokens. Response will not contain the stop sequence.
	Stop []string `yaml:"stop,omitempty" glazed.parameter:"openai-stop"`
	// PresencePenalty to use
	PresencePenalty *float64 `yaml:"presence_penalty,omitempty" glazed.parameter:"openai-presence-penalty"`
	// FrequencyPenalty to use
	FrequencyPenalty *float64 `yaml:"frequency_penalty,omitempty" glazed.parameter:"openai-frequency-penalty"`
	// LogitBias to use
	// TODO(manuel, 2023-03-28) Properly load logit bias
	// See https://github.com/go-go-golems/geppetto/issues/48
	LogitBias map[string]string `yaml:"logit_bias,omitempty" glazed.parameter:"openai-logit-bias"`

	Stream bool `yaml:"stream,omitempty" glazed.parameter:"openai-stream"`
}

func NewStepSettings

func NewStepSettings() *StepSettings

func NewStepSettingsFromParameters

func NewStepSettingsFromParameters(ps map[string]interface{}) (*StepSettings, error)

func (*StepSettings) Clone

func (s *StepSettings) Clone() *StepSettings

type StepState

type StepState int
const (
	StepNotStarted StepState = iota
	StepRunning
	StepFinished
	StepClosed
)

Jump to

Keyboard shortcuts

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