cmds

package
v0.4.12 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 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 added in v0.4.0

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

func CreateGeppettoLayers added in v0.4.0

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

func GetCobraCommandGeppettoMiddlewares added in v0.4.0

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

func NewHelpersParameterLayer added in v0.2.15

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 added in v0.1.4

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

func (*GeppettoCommand) InitializeContextManager added in v0.2.24

func (g *GeppettoCommand) InitializeContextManager(
	contextManager conversation.Manager,
	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 added in v0.2.4

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 added in v0.2.26

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

func (*GeppettoCommandLoader) LoadCommands added in v0.2.26

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

type GeppettoCommandOption added in v0.2.0

type GeppettoCommandOption func(*GeppettoCommand)

func WithMessages added in v0.2.0

func WithMessages(messages []*conversation.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

type HelpersSettings added in v0.3.0

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"`
	Chat              bool   `glazed.parameter:"chat"`
	Interactive       bool   `glazed.parameter:"interactive"`
}

Jump to

Keyboard shortcuts

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