thinking

package
v0.0.0-...-6e6905b Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InferTags

func InferTags(t *template.Template) (string, string)

InferTags uses a heuristic to infer the tags that surround thinking traces: We look for a range node that iterates over "Messages" and then look for a reference to "Thinking" like `{{.Thinking}}`. We then go up to the nearest ListNode and take the first and last TextNodes as the opening and closing tags.

Types

type Parser

type Parser struct {
	OpeningTag string
	ClosingTag string
	// contains filtered or unexported fields
}

func (*Parser) AddContent

func (s *Parser) AddContent(content string) (string, string)

AddContent returns the thinking content and the non-thinking content that should be immediately sent to the user. It will internally buffer if it needs to see more raw content to disambiguate