fix: force JSON output for Ollama intent classification; fix attachment detection
- ollama_backend: add format='json' for 'master' and receipt_parser callers so llama3.1:8b returns valid JSON instead of plain English - ab_ai_mail: add debug logging to trace attachment_ids from Discuss; handle file-only messages and clarification look-back flow Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -24,6 +24,11 @@ class OllamaBackend:
|
||||
kwargs = {'model': self._model, 'messages': messages}
|
||||
if tools:
|
||||
kwargs['tools'] = tools
|
||||
# Force structured JSON output for callers that parse JSON responses.
|
||||
# Without this llama3.1:8b returns plain English instead of JSON.
|
||||
_JSON_CALLERS = {'master', 'expenses_agent_receipt_parser'}
|
||||
if caller in _JSON_CALLERS and not tools:
|
||||
kwargs['format'] = 'json'
|
||||
client = ollama.AsyncClient(host=self._url)
|
||||
try:
|
||||
response = await asyncio.wait_for(client.chat(**kwargs), timeout=self._timeout)
|
||||
|
||||
Reference in New Issue
Block a user