LocalAI/core
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
..
application feat: disable force eviction (#7725) 2025-12-25 14:26:18 +01:00
backend fix(llama.cpp/mmproj): fix loading mmproj in nested sub-dirs different from model path (#7832) 2026-01-02 20:17:30 +01:00
cli feat(api): Allow tracing of requests and responses (#7609) 2025-12-29 11:06:06 +01:00
clients feat(store): add Golang client (#1977) 2024-04-16 15:54:14 +02:00
config fix: propagate validation errors (#7787) 2025-12-30 09:54:27 +01:00
dependencies_manager fix: be consistent in downloading files, check for scanner errors (#3108) 2024-08-02 20:06:25 +02:00
explorer chore(refactor): move logging to common package based on slog (#7668) 2025-12-21 19:33:13 +01:00
gallery fix: add nil checks before mergo.Merge to prevent panic in gallery model installation (#7785) 2025-12-30 09:51:45 +01:00
http feat(function): Add tool streaming, XML Tool Call Parsing Support (#7865) 2026-01-05 18:25:40 +01:00
p2p chore(refactor): move logging to common package based on slog (#7668) 2025-12-21 19:33:13 +01:00
schema feat(UI): image generation improvements (#7804) 2025-12-31 21:59:46 +01:00
services chore(refactor): move logging to common package based on slog (#7668) 2025-12-21 19:33:13 +01:00
startup chore(refactor): move logging to common package based on slog (#7668) 2025-12-21 19:33:13 +01:00
templates chore(refactor): move logging to common package based on slog (#7668) 2025-12-21 19:33:13 +01:00