LocalAI/pkg
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
..
audio feat: Realtime API support reboot (#5392) 2025-05-25 22:25:05 +02:00
concurrency chore: update jobresult_test.go (#4124) 2024-11-12 08:52:18 +01:00
downloader chore(refactor): move logging to common package based on slog (#7668) 2025-12-21 19:33:13 +01:00
functions feat(function): Add tool streaming, XML Tool Call Parsing Support (#7865) 2026-01-05 18:25:40 +01:00
grpc feat: respect context and add request cancellation (#7187) 2025-11-09 18:19:19 +01:00
huggingface-api feat(hf-api): return files in nested directories (#7396) 2025-11-30 09:06:54 +01:00
langchain feat(llama.cpp): do not specify backends to autoload and add llama.cpp variants (#2232) 2024-05-04 17:56:12 +02:00
model feat: disable force eviction (#7725) 2025-12-25 14:26:18 +01:00
oci feat(ui): allow to cancel ops (#7264) 2025-11-13 18:41:47 +01:00
signals chore: update cogito and simplify MCP logics (#6413) 2025-10-09 12:36:45 +02:00
sound feat: Realtime API support reboot (#5392) 2025-05-25 22:25:05 +02:00
store chore: fix go.mod module (#2635) 2024-06-23 08:24:36 +00:00
system chore(refactor): move logging to common package based on slog (#7668) 2025-12-21 19:33:13 +01:00
utils chore(refactor): move logging to common package based on slog (#7668) 2025-12-21 19:33:13 +01:00
xio feat(ui): allow to cancel ops (#7264) 2025-11-13 18:41:47 +01:00
xsync chore: fix go.mod module (#2635) 2024-06-23 08:24:36 +00:00
xsysinfo fix(amd-gpu): correctly show total and used vram (#7761) 2025-12-29 07:57:07 +01:00