template

package
v0.0.0-...-e1ffba4 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func Identifiers

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

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

func (*Template) Execute

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

func (*Template) String

func (t *Template) String() string

func (*Template) Subtree

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

func (*Template) Vars

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

type Values

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
}