add vector_store
This commit is contained in:
@@ -0,0 +1,13 @@
|
|||||||
|
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)
|
||||||
Reference in New Issue
Block a user