This commit is contained in:
eweeman
2026-01-14 16:57:36 -08:00
parent 2544e891f8
commit 4a6e2b898f
14 changed files with 343 additions and 136 deletions

View File

@@ -1,29 +1,24 @@
# qdrant_functions.py
# rag/qdrant_functions.py
import logging
from qdrant_client import QdrantClient
from sentence_transformers import SentenceTransformer
import uuid
import os
from typing import Any, List
QDRANT_HOST = os.getenv("QDRANT_HOST", "localhost")
QDRANT_PORT = int(os.getenv("QDRANT_PORT", 6333))
QDRANT_COLLECTION = os.getenv("QDRANT_COLLECTION", "abot-slack")
logger = logging.getLogger(__name__)
client = QdrantClient(host=QDRANT_HOST, port=QDRANT_PORT)
embedding_model = SentenceTransformer("all-MiniLM-L6-v2")
VECTOR_SIZE = 384
def embed_and_store_slack_message(
slack_client: Any,
channel: str,
user: str,
text: str,
ts: str,
bot_user_id: str
) -> None:
"""Embed and store a Slack message in the vector database."""
logger.info(f"RAG insert for message in {channel}: {text[:50]}...")
pass
def ensure_collection():
collections = [c.name for c in client.get_collections().collections]
if QDRANT_COLLECTION not in collections:
client.create_collection(
collection_name=QDRANT_COLLECTION,
vectors_config={
"size": VECTOR_SIZE,
"distance": "Cosine"
}
)
logging.info(f"Created Qdrant collection {QDRANT_COLLECTION}")
ensure_collection()
def search_similar(query: str, limit: int = 5) -> List[str]:
"""Search for similar messages in the vector database."""
logger.info(f"RAG search for: {query[:50]}...")
return [] # Return empty list for now