Pluggability of Vector Store
Understanding the Base Interface:
Method/Property
Description
Required/Optional
Implementation
from vectorstores.base import BaseVectorStore
class YourVectorStoreClass(BaseVectorStore):
def get_client(self):
# Implement logic to retrieve the client for your vector store backend
pass
def chunk_list(self, document_list, chunk_size):
# Optional: Implement logic to chunk documents into batches
pass
def add_documents(self, documents, fresh_collection: bool = False):
# Implement logic to generate embedding, add documents to your vector store and return document IDs
pass
def similarity_search_with_score(self, query, collection_name: str, k: int = 20):
#Args:
#query: The query string to search for.
#collection_name: Name of the collection within the vector store to search in.
#k: The maximum number of documents to fetch from the vector store (default: 20).
# Implement logic to perform a similarity search and return results with scores
passConfiguration
Example Usage
Adding/Appending Documents
Querying Documents
Last updated