indent

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultParseIntentSystemPromptTemplate = `` /* 1477-byte string literal not displayed */

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

Variables

This section is empty.

Functions

This section is empty.

Types

type FailbackCommandParser

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

func NewFailbackCommandParser

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

func (*FailbackCommandParser[T]) RecognizerIntent

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

type Intent

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

type LocalIntentRecognizer

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

func NewLocalIntentRecognizer

func NewLocalIntentRecognizer[T any]() *LocalIntentRecognizer[T]

func (*LocalIntentRecognizer[T]) RecognizerIntent

func (p *LocalIntentRecognizer[T]) RecognizerIntent(ctx context.Context, req *types.ToolRequest[T]) (Intent, error)

type ParserOption

type ParserOption[T any] func(*intentParserOptions[T])

func WithIntentPromptBuilder

func WithIntentPromptBuilder[T any](promptBuilder PromptBuilder[T]) ParserOption[T]

func WithIntentSystemPromptTemplate

func WithIntentSystemPromptTemplate[T any](systemPromptTemplate string) ParserOption[T]

type PromptBuilder

type PromptBuilder[T any] func(systemPrompt string) func(ctx context.Context, req *types.ToolRequest[T]) ([]*schema.Message, error)

type Recognizer

type Recognizer[T any] interface {
	RecognizerIntent(ctx context.Context, req *types.ToolRequest[T]) (Intent, error)
}

type ToolBasedIntentRecognizer

type ToolBasedIntentRecognizer[T any] struct {
	Chain *structured.Chain[*types.ToolRequest[T], parseCommandInput]
}

func NewToolBasedIntentRecognizer

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

func (*ToolBasedIntentRecognizer[T]) RecognizerIntent

func (p *ToolBasedIntentRecognizer[T]) RecognizerIntent(ctx context.Context, req *types.ToolRequest[T]) (Intent, error)

Jump to

Keyboard shortcuts

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