discord-rag-memory-bot / scratch /debug_thala_query.py
arka7's picture
Deploy Discord RAG Bot with Gradio Dashboard
8442ef1
Raw History Blame Contribute Delete
1.04 kB
import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
import asyncio
from services import MistralEmbeddingService, SQLiteVectorStoreService
from database.database import init_db, get_db_session
from database.repository import DiscordRAGRepository
from utils.logger import logger
async def debug_thala():
init_db()
embedder = MistralEmbeddingService()
vector_db = SQLiteVectorStoreService()
query = "what kind of person is @thalacool"
q_vecs = await embedder.get_embeddings([query])
q_vec = q_vecs[0]
# Run general search
results = await vector_db.search_similar(q_vec, top_k=250, channel_id=817421565183918089)
logger.info(f"Retrieved {len(results)} matches.")
# Let's inspect the top 15 matches content and author
for i, (_, score, meta) in enumerate(results[:15], 1):
logger.info(f"[{i}] Score: {score:.4f} | @{meta['author']} in #{meta['channel']}: {meta['content']}")
if __name__ == "__main__":
asyncio.run(debug_thala())