14 lines
564 B
Python
14 lines
564 B
Python
from langchain_qdrant import QdrantStore
|
|
from langchain_ollama import OllamaEmbeddings
|
|
|
|
class QdrantStore:
|
|
def __init__(self, url="http://localhost:6333", collection_name="rag_collection"):
|
|
self.client = QdrantStore(url=url, collection_name=collection_name)
|
|
self.embeddings = OllamaEmbeddings(model="nomic-embed-text")
|
|
|
|
def add_documents(self, docs):
|
|
self.client.add_documents(docs, embeddings=self.embeddings)
|
|
|
|
def search(self, query, limit=5):
|
|
return self.client.search(query, limit=limit, embeddings=self.embeddings)
|