cmds

package
v0.4.11 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2024 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const GeppettoHelpersSlug = "geppetto-helpers"

Variables

This section is empty.

Functions

func BuildCobraCommandWithGeppettoMiddlewares

func BuildCobraCommandWithGeppettoMiddlewares(
	cmd cmds.Command,
	options ...cli.CobraParserOption,
) (*cobra.Command, error)

func CreateGeppettoLayers

func CreateGeppettoLayers(stepSettings *settings.StepSettings) ([]layers.ParameterLayer, error)

func GetCobraCommandGeppettoMiddlewares

func GetCobraCommandGeppettoMiddlewares(
	commandSettings *cli.GlazedCommandSettings,
	cmd *cobra.Command,
	args []string,
) ([]middlewares.Middleware, error)

func LoadConfig

func LoadConfig() (*settings.StepSettings, error)

func LoadConfigFromSettings

func LoadConfigFromSettings(settings_ cli.GlazedCommandSettings) (*settings.StepSettings, error)

LoadConfigFromSettings loads the geppetto step settings from the given profile and config file.

func NewHelpersParameterLayer

func NewHelpersParameterLayer() (layers.ParameterLayer, error)

Types

type GeppettoCommand

type GeppettoCommand struct {
	*glazedcmds.CommandDescription `yaml:",inline"`
	StepSettings                   *settings.StepSettings  `yaml:"stepSettings,omitempty"`
	Prompt                         string                  `yaml:"prompt,omitempty"`
	Messages                       []*conversation.Message `yaml:"messages,omitempty"`
	SystemPrompt                   string                  `yaml:"system-prompt,omitempty"`
}

func NewGeppettoCommand

func NewGeppettoCommand(
	description *glazedcmds.CommandDescription,
	settings *settings.StepSettings,
	options ...GeppettoCommandOption,
) (*GeppettoCommand, error)

func (*GeppettoCommand) InitializeContextManager

func (g *GeppettoCommand) InitializeContextManager(
	contextManager conversation.Manager,
	helperSettings *HelpersSettings,
	ps map[string]interface{},
) error

func (*GeppettoCommand) Run

func (g *GeppettoCommand) Run(
	ctx context.Context,
	step steps.Step[conversation.Conversation, string],
	contextManager conversation.Manager,
	helpersSettings *HelpersSettings,
	ps map[string]interface{},
) (steps.StepResult[string], error)

func (*GeppettoCommand) RunIntoWriter

func (g *GeppettoCommand) RunIntoWriter(
	ctx context.Context,
	parsedLayers *layers.ParsedLayers,
	w io.Writer,
) error

RunIntoWriter runs the command and writes the output into the given writer.

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     []*conversation.Message `yaml:"messages,omitempty"`
	SystemPrompt string                  `yaml:"system-prompt,omitempty"`
}

type GeppettoCommandLoader

type GeppettoCommandLoader struct {
}

func (*GeppettoCommandLoader) IsFileSupported

func (g *GeppettoCommandLoader) IsFileSupported(f fs.FS, fileName string) bool

func (*GeppettoCommandLoader) LoadCommands

func (scl *GeppettoCommandLoader) LoadCommands(
	f fs.FS, entryName string,
	options []cmds.CommandDescriptionOption,
	aliasOptions []alias.Option,
) ([]cmds.Command, error)

type GeppettoCommandOption

type GeppettoCommandOption func(*GeppettoCommand)

func WithMessages

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

func WithPrompt

func WithPrompt(prompt string) GeppettoCommandOption

func WithSystemPrompt

func WithSystemPrompt(systemPrompt string) GeppettoCommandOption

type HelpersSettings

type HelpersSettings struct {
	PrintPrompt                 bool                   `glazed.parameter:"print-prompt"`
	System                      string                 `glazed.parameter:"system"`
	AppendMessageFile           string                 `glazed.parameter:"append-message-file"`
	MessageFile                 string                 `glazed.parameter:"message-file"`
	AutomaticallyContinueInChat bool                   `glazed.parameter:"chat"`
	Interactive                 bool                   `glazed.parameter:"interactive"`
	ForceInteractive            bool                   `glazed.parameter:"force-interactive"`
	Images                      []*parameters.FileData `glazed.parameter:"images"`
}

Jump to

Keyboard shortcuts

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