progress
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user