Skip to main content
Glama

LiveKit RAG Assistant

by THENABILMAN
check_pinecone.py•2.78 kB
""" Check what's actually stored in Pinecone and diagnose search issues """ import os from dotenv import load_dotenv from pinecone import Pinecone from langchain_huggingface import HuggingFaceEmbeddings from langchain_pinecone import Pinecone as LangChainPinecone load_dotenv() PINECONE_API_KEY = os.getenv("PINECONE_API_KEY") PINECONE_INDEX_NAME = os.getenv("PINECONE_INDEX_NAME") or os.getenv("PINECONE_INDEX", "livekit-docs") print("šŸ” Pinecone Diagnostic Check") print("=" * 60) # Connect to Pinecone directly try: pc = Pinecone(api_key=PINECONE_API_KEY) index = pc.Index(PINECONE_INDEX_NAME) # Get index stats stats = index.describe_index_stats() print(f"\nšŸ“Š Index: {PINECONE_INDEX_NAME}") print(f" Namespaces: {stats.get('namespaces', {})}") total_vectors = 0 for ns, ns_stats in stats.get('namespaces', {}).items(): vector_count = ns_stats.get('vector_count', 0) total_vectors += vector_count print(f" - Namespace '{ns}': {vector_count} vectors") print(f"\n šŸ“ˆ Total vectors: {total_vectors}") if total_vectors == 0: print("\nāŒ No vectors found in Pinecone!") print(" Run: python ingest_comprehensive.py") print(" Or: python ingest_from_file.py") else: print(f" āœ… Found {total_vectors} vectors!") except Exception as e: print(f"āŒ Error connecting to Pinecone: {e}") exit(1) print("\n" + "=" * 60) print("šŸ”Ž Testing Search Query") print("=" * 60) try: embeddings = HuggingFaceEmbeddings( model_name="sentence-transformers/all-MiniLM-L6-v2" ) vector_store = LangChainPinecone( index_name=PINECONE_INDEX_NAME, embedding=embeddings ) # Try a simple search test_queries = [ "LiveKit installation", "WebRTC", "server setup", "client SDK", "documentation", ] for query in test_queries: print(f"\nšŸ” Query: '{query}'") try: results = vector_store.similarity_search(query, k=3) print(f" Results: {len(results)} found") if results: for i, doc in enumerate(results, 1): preview = doc.page_content[:80].replace('\n', ' ') print(f" [{i}] {preview}...") if doc.metadata: print(f" Source: {doc.metadata.get('source', 'N/A')}") else: print(" āš ļø No results") except Exception as e: print(f" āŒ Error: {str(e)[:50]}") print("\n" + "=" * 60) print("āœ… Diagnostic check complete!") except Exception as e: print(f"āŒ Search error: {e}")

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/THENABILMAN/THENABILMAN_LiveKit_MCP_Assistant'

If you have feedback or need assistance with the MCP directory API, please join our Discord server