You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
LangChainKnowledgeBase works great when you already have a LangChain-based retrieval setup that uses vectorstores, but when you want something more basic, like a TFIDFRetriever, you cannot use it because of an instance check.
raiseValueError(f"Retriever is not of type VectorStoreRetriever: {self.retriever}")
Looking at the source of VectorStoreRetriever, it doesn't override the invoke method, which is the only one the LangChainKnowledgeBase uses (here specifically).
After some manual testing for confirmation, I believe it would be best to relax the check to BaseRetriever instead, which defines/implements1 the required invoke method. What do you think? :)
Footnotes
technically, it's already defined by Runnable, but I would argue it makes much more sense semantically to do an instance check on BaseRetriever. ↩
The text was updated successfully, but these errors were encountered:
The following snippet does not work and throws the above mentioned ValueError. This is despite that fact that it would work perfectly fine and traditional retrieval methods that aren't based on vector stores are just as valid in that scenario.
LangChainKnowledgeBase
works great when you already have a LangChain-based retrieval setup that uses vectorstores, but when you want something more basic, like aTFIDFRetriever
, you cannot use it because of an instance check.phidata/phi/knowledge/langchain.py
Lines 37 to 38 in 3a39189
Looking at the source of
VectorStoreRetriever
, it doesn't override theinvoke
method, which is the only one theLangChainKnowledgeBase
uses (here specifically).After some manual testing for confirmation, I believe it would be best to relax the check to
BaseRetriever
instead, which defines/implements1 the requiredinvoke
method. What do you think? :)Footnotes
technically, it's already defined by
Runnable
, but I would argue it makes much more sense semantically to do an instance check onBaseRetriever
. ↩The text was updated successfully, but these errors were encountered: