prompts

package
v0.1.17 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultResolver

func DefaultResolver(prompt string, data map[string]any) (string, error)

Types

type PromptLoader

type PromptLoader interface {
	// LoadPrompt loads the prompt from the source and returns it as string
	LoadPrompt(ctx context.Context) (string, error)
}

type PromptOption

type PromptOption func(*SimplePrompt)

func WithResolver

func WithResolver(resolverFn PromptResolverFn) PromptOption

type PromptResolverFn

type PromptResolverFn func(string, map[string]any) (string, error)

type SimplePrompt

type SimplePrompt struct {
	// contains filtered or unexported fields
}

func New

func New(prompt string, opts ...PromptOption) *SimplePrompt

func NewWithLoader

func NewWithLoader(loader PromptLoader, opts ...PromptOption) *SimplePrompt

func (*SimplePrompt) GetPrompt

func (sp *SimplePrompt) GetPrompt(ctx context.Context, data map[string]any) (string, error)

type StringLoader

type StringLoader struct {
	String string
}

func NewStringLoader

func NewStringLoader(str string) *StringLoader

func (*StringLoader) LoadPrompt

func (sl *StringLoader) LoadPrompt(ctx context.Context) (string, error)

Jump to

Keyboard shortcuts

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