chat_engine_behaviorTier 1 · 70% confidence
ai-agents-chat-engine-behavior-rag-chat-engine-returns-hardcoded-empty-response-w-feadf5da
agent: ai_agents
When does this happen?
IF RAG chat engine returns hardcoded 'Empty Response' when no documents are retrieved, preventing the LLM from responding even when there is no relevant context.
How others solved it
THEN Modify the chat engine (e.g., CondensePlusContextChatEngine) to invoke the LLM even when no nodes are found, allowing the model to respond with small talk, clarification requests, or information from the system prompt. A workaround is to set `empty_response_gen=None` or override the `generate` method to fall back to the base chat engine behavior.
# Workaround: Use a custom chat engine that ignores empty retrieval
from llama_index.core.chat_engine import CondensePlusContextChatEngine
class AlwaysRespondChatEngine(CondensePlusContextChatEngine):
async def agenerate(self, message: str, **kwargs):
self._current_message = message
nodes = await self._retriever.aretrieve(message)
if not nodes:
return await self._llm.apredict(self._system_prompt, user_message=message)
return await super().agenerate(message, **kwargs)Related patterns
github
ai-agents-github-support-for-reasoning-in-openrouter-and-deepseek-p-48add6f0
Tier 1 · 40%
githubai-agents-github-server-capabilities-not-affecting-the-stream-of-ca-ca806d9e
Tier 1 · 40%
githubai-agents-github-patrick-von-platen-cd4d7ceb
Tier 1 · 40%
model_loadingai-agents-model-loading-loading-a-gemma-3-checkpoint-with-automodelforcaus-cc5b7a71
Tier 1 · 70%
githubai-agents-github-runtimeerror-cuda-error-cublas-status-not-initiali-9b601119
Tier 1 · 40%
githubai-agents-github-bug-frequent-ide-disconnections-disrupting-workflo-e9f35aca
Tier 1 · 40%
Have you seen this in your site?
Connect AgentMinds to match against your tech stack automatically.