LocalAI/core/http/endpoints
Ettore Di Giacinto 21c84f432f
feat(function): Add tool streaming, XML Tool Call Parsing Support (#7865)
* feat(function): Add XML Tool Call Parsing Support

Extend the function parsing system in LocalAI to support XML-style tool calls, similar to how JSON tool calls are currently parsed. This will allow models that return XML format (like <tool_call><function=name><parameter=key>value</parameter></function></tool_call>) to be properly parsed alongside text content.

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* thinking before tool calls, more strict support for corner cases with no tools

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* Support streaming tools

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* Iterative JSON

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* Iterative parsing

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* Consume JSON marker

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* Fixup

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* add tests

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* Fix pending TODOs

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* Don't run other parsing with ParseRegex

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

---------

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-01-05 18:25:40 +01:00
..
elevenlabs chore(refactor): move logging to common package based on slog (#7668) 2025-12-21 19:33:13 +01:00
explorer feat: migrate to echo and enable cancellation of non-streaming requests (#7270) 2025-11-14 22:57:53 +01:00
jina chore(refactor): move logging to common package based on slog (#7668) 2025-12-21 19:33:13 +01:00
localai fix: Highly inconsistent agent response to cogito agent calling MCP server - Body "Invalid http method" (#7790) 2026-01-03 15:43:23 +01:00
mcp chore(refactor): move logging to common package based on slog (#7668) 2025-12-21 19:33:13 +01:00
openai feat(function): Add tool streaming, XML Tool Call Parsing Support (#7865) 2026-01-05 18:25:40 +01:00