template

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseStructuredPayload

func ParseStructuredPayload(rendered string, fallbackState map[string]interface{}) (string, string, error)

ParseStructuredPayload parses rendered output that has separate "schema" and "state" envelopes, or treats the full payload as the schema if not wrapped, and normalizes legacy question fields ("name" -> "id", "question"/"prompt" -> "instructions", "items" -> "levels", dict "options" -> list) so that all templates and ad-hoc schemas conform to structured_server.py's parse_schema contract.

Types

type Engine

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

Engine parses and executes Go templates with rich helper functions.

func NewEngine

func NewEngine() *Engine

NewEngine creates a new template engine with default helper functions.

func (*Engine) RenderFile

func (e *Engine) RenderFile(filePath string, data map[string]interface{}) (string, error)

RenderFile loads a template file from disk and executes it with the given data.

func (*Engine) RenderString

func (e *Engine) RenderString(name, tmplStr string, data map[string]interface{}) (string, error)

RenderString parses and executes an in-memory template string.

type StructuredPayload

type StructuredPayload struct {
	Schema json.RawMessage `json:"schema"`
	State  json.RawMessage `json:"state"`
}

StructuredPayload represents the rendered JSON package containing a schema and state.

Jump to

Keyboard shortcuts

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