thinking

package
v0.34.1 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2026 License: MIT Imports: 4 Imported by: 1

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.

func TemplateSupportsThinking added in v0.34.1

func TemplateSupportsThinking(chatTemplate string) bool

TemplateSupportsThinking reports whether a raw model chat template declares thinking output. It recognizes templates that emit paired think tags and templates that strip prior tagged reasoning; templates using a separate reasoning_content field are not treated as tagged-thinking templates.

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

Jump to

Keyboard shortcuts

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