LocalAI/core/http
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
..
endpoints feat(function): Add tool streaming, XML Tool Call Parsing Support (#7865) 2026-01-05 18:25:40 +01:00
middleware feat(api): Allow tracing of requests and responses (#7609) 2025-12-29 11:06:06 +01:00
routes fix: Highly inconsistent agent response to cogito agent calling MCP server - Body "Invalid http method" (#7790) 2026-01-03 15:43:23 +01:00
static fix(chat/ui): record model name in history for consistency (#7845) 2026-01-03 18:05:33 +01:00
views fix(chat/ui): record model name in history for consistency (#7845) 2026-01-03 18:05:33 +01:00
app.go chore(logging): be consistent and do not emit logs from echo (#7710) 2025-12-24 09:22:27 +01:00
app_test.go chore(refactor): move logging to common package based on slog (#7668) 2025-12-21 19:33:13 +01:00
explorer.go chore(refactor): move logging to common package based on slog (#7668) 2025-12-21 19:33:13 +01:00
http_suite_test.go fix(llama-cpp): correctly calculate embeddings (#6259) 2025-09-13 23:11:54 +02:00
openai_mapping_test.go feat(api): OpenAI video create enpoint integration (#6777) 2025-10-27 10:06:57 +01:00
openai_videos_test.go feat: migrate to echo and enable cancellation of non-streaming requests (#7270) 2025-11-14 22:57:53 +01:00
render.go feat: migrate to echo and enable cancellation of non-streaming requests (#7270) 2025-11-14 22:57:53 +01:00