cmds

package
v0.2.13 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2023 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HelpersParameterLayer added in v0.1.4

func HelpersParameterLayer() (layers.ParameterLayer, error)

Types

type GeppettoCommand

type GeppettoCommand struct {
	*glazedcmds.CommandDescription
	StepFactory  chat.StepFactory `yaml:"-"` // this is not serialized
	Prompt       string
	Messages     []*geppetto_context.Message
	SystemPrompt string
}

func NewGeppettoCommand added in v0.1.4

func NewGeppettoCommand(
	description *glazedcmds.CommandDescription,
	stepFactory chat.StepFactory,
	options ...GeppettoCommandOption,
) (*GeppettoCommand, error)

func (*GeppettoCommand) RunIntoWriter added in v0.2.4

func (g *GeppettoCommand) RunIntoWriter(
	ctx context.Context,
	parsedLayers map[string]*layers.ParsedParameterLayer,
	ps map[string]interface{},
	w io.Writer,
) error

RunIntoWriter runs the command and writes the output into the given writer. It first:

  • configures the factories with the given parameters (for example to override the temperature or other openai settings)
  • configures the context manager with the configured Messages and SystemPrompt (per default, from the command definition, but can be overloaded through the --system, --message-file and --append-message-file flags)
  • if --print-prompt is given, it prints the prompt and exits

It then instantiates a

type GeppettoCommandDescription

type GeppettoCommandDescription struct {
	Name      string                            `yaml:"name"`
	Short     string                            `yaml:"short"`
	Long      string                            `yaml:"long,omitempty"`
	Flags     []*parameters.ParameterDefinition `yaml:"flags,omitempty"`
	Arguments []*parameters.ParameterDefinition `yaml:"arguments,omitempty"`
	Layers    []layers.ParameterLayer           `yaml:"layers,omitempty"`

	Prompt       string                      `yaml:"prompt,omitempty"`
	Messages     []*geppetto_context.Message `yaml:"messages,omitempty"`
	SystemPrompt string                      `yaml:"system-prompt,omitempty"`
}

type GeppettoCommandLoader

type GeppettoCommandLoader struct {
}

func (*GeppettoCommandLoader) LoadCommandAliasFromYAML

func (g *GeppettoCommandLoader) LoadCommandAliasFromYAML(s io.Reader, options ...alias.Option) ([]*alias.CommandAlias, error)

func (*GeppettoCommandLoader) LoadCommandFromYAML

func (g *GeppettoCommandLoader) LoadCommandFromYAML(
	s io.Reader,
	options ...cmds.CommandDescriptionOption,
) ([]cmds.Command, error)

type GeppettoCommandOption added in v0.2.0

type GeppettoCommandOption func(*GeppettoCommand)

func WithMessages added in v0.2.0

func WithMessages(messages []*geppetto_context.Message) GeppettoCommandOption

func WithPrompt added in v0.2.0

func WithPrompt(prompt string) GeppettoCommandOption

func WithSystemPrompt added in v0.2.0

func WithSystemPrompt(systemPrompt string) GeppettoCommandOption

Jump to

Keyboard shortcuts

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