tools

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: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Parser

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

func NewParser

func NewParser(tmpl *template.Template, tools []api.Tool) *Parser

NewParser creates a new tool call parser from a model's chat template and a list of provided tools.

func NewParserWithTag

func NewParserWithTag(tools []api.Tool, tag string) *Parser

func (*Parser) Add

func (p *Parser) Add(s string) (calls []api.ToolCall, content string)

Add processes a string input to parse tool calls and content that should be sent back to the user.

func (*Parser) Content

func (p *Parser) Content() string

Content returns any remaining content that should be sent to the user. This should be the empty string string unless the tag is { or [ and a tool call was not found

func (*Parser) GetBuffer

func (p *Parser) GetBuffer() []byte