tools

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2025 License: MIT Imports: 10 Imported by: 1

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(templateToProcess *gotmpl.Template) (*Parser, error)

NewParser creates a new tool call parser from a template. It extracts the tool call format, prefix, and field names from the template to use for parsing tool calls from model output.

Returns an error if the template does not contain valid tool call formatting.

func (*Parser) Add

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

Add processes a string input to parse tool calls and content. It handles prefix detection and JSON parsing to extract tool calls.

Returns:

  • tools: Any parsed tool calls
  • content: Non-tool call content

Jump to

Keyboard shortcuts

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