fix(classifier): wrap sync generate() in asyncio.to_thread() — remove broken await on non-coroutine
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user