LocalAI/core
Richard Palethorpe 5195062e12
fix(realtime): Include noAction function in prompt template and handle tool_choice (#8372)
The realtime endpoint was not passing the noAction "answer" function to the
model in the prompt template, causing the model to always call user-provided
tools even when a direct response was appropriate.

Root cause:
- User tools were added to the funcs list
- TemplateMessages() was called to generate the prompt
- noAction function was only added AFTER templating
- This meant the prompt didn't include the "answer" function, even though
  the grammar did

Fix:
- Move noAction function creation before TemplateMessages() call so it's
  included in both the prompt and grammar
- Add proper tool_choice parameter handling to support "auto", "required",
  "none", and specific function selection
- Match behavior of the standard chat endpoint

💘 Generated with Crush

Assisted-by: Claude Sonnet 4.5 via Crush <crush@charm.land>

Signed-off-by: Richard Palethorpe <io@richiejp.com>
2026-02-03 14:30:37 +01:00
..
application feat: disable force eviction (#7725) 2025-12-25 14:26:18 +01:00
backend feat(whisperx): add whisperx backend for transcription with speaker diarization (#8299) 2026-02-02 16:33:12 +01:00
cli feat(api): Add transcribe response format request parameter & adjust STT backends (#8318) 2026-02-01 17:33:17 +01:00
clients feat(store): add Golang client (#1977) 2024-04-16 15:54:14 +02:00
config fix: drop gguf VRAM estimation (now redundant) (#8325) 2026-02-01 17:33:28 +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 feat: Filter backend gallery by system capabilities (#7950) 2026-01-10 23:34:01 +01:00
http fix(realtime): Include noAction function in prompt template and handle tool_choice (#8372) 2026-02-03 14:30:37 +01:00
p2p chore(refactor): move logging to common package based on slog (#7668) 2025-12-21 19:33:13 +01:00
schema feat(whisperx): add whisperx backend for transcription with speaker diarization (#8299) 2026-02-02 16:33:12 +01:00
services chore(refactor): move logging to common package based on slog (#7668) 2025-12-21 19:33:13 +01:00
startup feat(api): Add transcribe response format request parameter & adjust STT backends (#8318) 2026-02-01 17:33:17 +01:00
templates chore(refactor): move logging to common package based on slog (#7668) 2025-12-21 19:33:13 +01:00