command

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultParseCommandSystemPromptTemplate = `` /* 1475-byte string literal not displayed */

DefaultParseCommandSystemPromptTemplate is the default system prompt template used by ToolBasedCommandParser. The template may contain a single "%s" placeholder for the tool name.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command string
const (
	Cancel    Command = "cancel"
	Confirm   Command = "confirm"
	Edit      Command = "edit"
	DoNothing Command = "do_nothing"
)

type FailbackCommandParser

type FailbackCommandParser[T any] struct {
	// contains filtered or unexported fields
}

func NewFailbackCommandParser

func NewFailbackCommandParser[T any](parsers ...Parser[T]) *FailbackCommandParser[T]

func (*FailbackCommandParser[T]) ParseCommand

func (p *FailbackCommandParser[T]) ParseCommand(ctx context.Context, req *types.ToolRequest[T]) (Command, error)

type LocalCommandParser

type LocalCommandParser[T any] struct {
	CancelKeywords  []string
	ConfirmKeywords []string
}

func NewLocalCommandParser

func NewLocalCommandParser[T any]() *LocalCommandParser[T]

func (*LocalCommandParser[T]) ParseCommand

func (p *LocalCommandParser[T]) ParseCommand(ctx context.Context, req *types.ToolRequest[T]) (Command, error)

type Parser

type Parser[T any] interface {
	ParseCommand(ctx context.Context, req *types.ToolRequest[T]) (Command, error)
}

type ParserOption added in v0.0.2

type ParserOption func(*commandParserOptions)

func WithCommandSystemPrompt added in v0.0.2

func WithCommandSystemPrompt(systemPrompt string) ParserOption

WithCommandSystemPrompt overrides the system prompt used by ToolBasedCommandParser.

func WithCommandSystemPromptTemplate added in v0.0.2

func WithCommandSystemPromptTemplate(systemPromptTemplate string) ParserOption

WithCommandSystemPromptTemplate overrides the system prompt template used by ToolBasedCommandParser. If the template contains "%s", it will be formatted with the tool name.

type ToolBasedCommandParser

type ToolBasedCommandParser[T any] struct {
	// contains filtered or unexported fields
}

func NewToolBasedCommandParser

func NewToolBasedCommandParser[T any](chatModel model.ToolCallingChatModel, opts ...ParserOption) (*ToolBasedCommandParser[T], error)

func (*ToolBasedCommandParser[T]) ParseCommand

func (p *ToolBasedCommandParser[T]) ParseCommand(ctx context.Context, req *types.ToolRequest[T]) (Command, error)

Jump to

Keyboard shortcuts

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