fix(classifier): wrap sync generate() in asyncio.to_thread() — remove broken await on non-coroutine

This commit is contained in:
Bernd (Hermes)
2026-06-19 19:53:59 +02:00
parent ac1751e9ce
commit 2599a574e1
+2 -3
View File
@@ -488,8 +488,7 @@ class IntentClassifier:
Intent-Kategorien. Uses ``LLMClient.generate()`` for free-form
output. Used by the router for LLM_ROOM_PROMPT.
Uses ``asyncio.to_thread()`` because ``LLMClient.generate()`` is
synchronous.
Wraps synchronous OllamaLLMClient.generate() in asyncio.to_thread().
Args:
prompt: The complete prompt to send.
@@ -497,10 +496,10 @@ class IntentClassifier:
Returns:
The LLM's response text (stripped), or None on failure.
"""
import asyncio
try:
if not self._llm_client or not self._llm_enabled:
return None
import asyncio
return await asyncio.to_thread(self._llm_client.generate, prompt)
except Exception as e:
logger.warning("LLM raw call failed: %s", e)