template

package
v0.12.9 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2025 License: MIT Imports: 15 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultTemplate, _ = Parse("{{ .Prompt }}")

Functions

func Identifiers added in v0.2.6

func Identifiers(n parse.Node) ([]string, error)

Identifiers walks the node tree returning any identifiers it finds along the way

func Named

func Named(s string) (*named, error)

Types

type Template

type Template struct {
	*template.Template
	// contains filtered or unexported fields
}

func Parse

func Parse(s string) (*Template, error)

func (*Template) Contains added in v0.11.1

func (t *Template) Contains(s string) bool

func (*Template) Execute added in v0.2.2

func (t *Template) Execute(w io.Writer, v Values) error

func (*Template) String

func (t *Template) String() string

func (*Template) Subtree added in v0.2.6

func (t *Template) Subtree(fn func(parse.Node) bool) *template.Template

func (*Template) Vars

func (t *Template) Vars() ([]string, error)

type Values added in v0.2.2

type Values struct {
	Messages []api.Message
	api.Tools
	Prompt string
	Suffix string
	Think  bool
	// ThinkLevel contains the thinking level if Think is true and a string value was provided
	ThinkLevel string
	// whether or not the user explicitly set the thinking flag (vs. it being
	// implicitly false). Templates can't see whether `Think` is nil
	IsThinkSet bool
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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