From 21dfa840de0b59d1cfb71d7122427dfcda9b8482 Mon Sep 17 00:00:00 2001 From: fynnfluegge Date: Sun, 16 Feb 2025 09:59:26 +0100 Subject: [PATCH] fix: vector cache generation --- codeqai/vector_store.py | 2 +- tests/vector_store_test.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/codeqai/vector_store.py b/codeqai/vector_store.py index 497abb2..6a18cfc 100644 --- a/codeqai/vector_store.py +++ b/codeqai/vector_store.py @@ -56,7 +56,7 @@ def index_documents(self, documents: list[Document]): index_to_docstore_id = self.db.index_to_docstore_id for i in range(len(documents)): document = self.db.docstore.search(index_to_docstore_id[i]) - if document and document is type(Document): + if document and isinstance(document, Document): # Check if the document is already present in the vector cache # if yes, then add the vector id to the vector cache entry if self.vector_cache.get(document.metadata["filename"]): diff --git a/tests/vector_store_test.py b/tests/vector_store_test.py index 0a21470..918c703 100644 --- a/tests/vector_store_test.py +++ b/tests/vector_store_test.py @@ -2,7 +2,7 @@ import pytest from langchain.schema import Document -from langchain_community.embeddings import FakeEmbeddings +from langchain_core.embeddings import FakeEmbeddings from codeqai.cache import get_cache_path from codeqai.vector_store import VectorStore