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 ¶
NewParser creates a new tool call parser from a model's chat template and a list of provided tools.
func (*Parser) Add ¶
Add processes a string input to parse tool calls and content that should be sent back to the user.
func (*Parser) Content ¶ added in v0.9.1
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) PreservedTokens ¶
PreservedTokens returns the token strings that should be preserved during llama-server detokenization so the parser can still observe its opening tag. Some templates glue a special token directly to plain JSON punctuation, e.g. "[TOOL_CALLS][", where only the leading special token can be stripped by the detokenizer. In those cases we preserve just the leading special token while still parsing against the full tag.