Problem: RAG system is failing because supabase_cl...
# ask-ai
c
Problem: RAG system is failing because supabase_client.client is None when trying to perform vector search. What's Working: • ✅ RAG hook is being called correctly • ✅ Agent is speaking and responding • ✅ Client context is being injected • ✅ Vector service is generating embeddings successfully • ✅ No more 'str' object is not callable errors What's Broken: • ❌ supabase_client.client is None in the RAG manager • ❌ Vector search fails with "Supabase client is None, cannot perform vector search" • ❌ Falls back to keyword search which finds no results • ❌ Agent says "specific details about individual founders are not publicly disclosed" instead of the actual founder info Technical Details: • The SupabaseClient object exists but its internal client attribute is None • This happens after the agent's database connections are initialized but before RAG queries run • The issue is in the database connection lifecycle, not in the RAG logic itself Question for Bot: How do I ensure that supabase_client.client remains valid and not None when the RAG manager tries to use it? The connection is established but becomes invalid before RAG queries execute. The agent is working perfectly now - it's speaking, responding, and the RAG hook is running without errors. The only issue is that the database connection becomes invalid, preventing the RAG system from actually retrieving the knowledge base information.
t
Thanks for reaching out, raj. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
The knowledge base doesn’t have specific details about Supabase integration in the RAG manager. Could you help me understand if this is a custom integration you’ve set up, or if it’s from a particular plugin or example? Also, have you tried any specific steps or configurations so far to tackle the issue? I’m here to help! Sources: Working with plugins | LiveKit Docs | examples/voice_agents/llamaindex-rag/retrieval.py | rag/README.md | agent_extensions/agent_extensions/rag/handler.py
c
Context: We've built a custom RAG (Retrieval-Augmented Generation) system for a LiveKit voice agent that integrates with Supabase for vector search using pgvector. Architecture: • Custom RAG Manager: shared/rag/rag_manager.py - handles knowledge retrieval • Vector Service: Uses Google's gemini-embedding-001 model for embeddings • Database: Supabase with pgvector extension for similarity search • Integration: RAG manager calls supabase_client.client.rpc('match_knowledge_entries', ...) for vector search The Specific Issue: python # This line works - we get the SupabaseClient object supabase_client = <shared.database.supabase_client.SupabaseClient object> # But this line fails - the internal client is None supabase_client.client = None # So this RPC call fails: vector_result = self.client_mgr.supabase_client.client.rpc(...) What We've Tried: 1. ✅ Fixed the 'str' object is not callable error by reverting to direct context injection 2. ✅ Increased RAG timeout from 2s to 5s 3. ✅ Modified RAG manager to initialize its own database connections 4. ✅ Added debug logging to track the issue Current Status: • ✅ Agent is working perfectly (speaking, responding, RAG hook running) • ✅ RAG manager is initialized and methods are callable • ✅ Vector service generates embeddings successfully • ❌ Only issue: supabase_client.client is None when RAG tries to query Question for Bot: The SupabaseClient object exists but its internal client attribute becomes None. This suggests the database connection is being closed or never properly initialized in the SupabaseClient class. How do I ensure that supabase_client.client remains valid for RPC calls? Is this a common issue with custom Supabase integrations in LiveKit agents? Additional Context: We're using the standard supabase-py library, not a custom plugin. The issue appears to be in the database connection lifecycle within our custom RAG manager.
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!