diff --git a/phi/knowledge/langchain.py b/phi/knowledge/langchain.py index 5e64a1a45..18ba9940a 100644 --- a/phi/knowledge/langchain.py +++ b/phi/knowledge/langchain.py @@ -17,7 +17,7 @@ def search(self, query: str, num_documents: Optional[int] = None) -> List[Docume """Returns relevant documents matching the query""" try: - from langchain_core.vectorstores import VectorStoreRetriever + from langchain_core.retrievers import BaseRetriever from langchain_core.documents import Document as LangChainDocument except ImportError: raise ImportError( @@ -34,8 +34,8 @@ def search(self, query: str, num_documents: Optional[int] = None) -> List[Docume logger.error("No retriever provided") return [] - if not isinstance(self.retriever, VectorStoreRetriever): - raise ValueError(f"Retriever is not of type VectorStoreRetriever: {self.retriever}") + if not isinstance(self.retriever, BaseRetriever): + raise ValueError(f"Retriever is not of type BaseRetriever: {self.retriever}") _num_documents = num_documents or self.num_documents logger.debug(f"Getting {_num_documents} relevant documents for query: {query}")