Skip to main content

Module xml_tool_injector

Module xml_tool_injector 

Source
Expand description

XML tool definition injection for instruction-tuned models.

Models that lack native tool calling support can still use tools by having the tool definitions injected into the system prompt as XML. The model is then instructed to emit <tool_call> blocks that the super::tool_extractor can parse from the streaming text output.

Functionsยง

inject_tools_into_system_prompt
Inject XML tool definitions into the system prompt of an super::LlmRequest.
tools_to_xml
Convert OpenAI-format tool definitions to an XML block suitable for system prompt injection.