Skip to content

Commit

Permalink
langchain[patch]: Support langchain-astradb AstraDBVectorStore in sel…
Browse files Browse the repository at this point in the history
…f-query retriever (#17728)

Co-authored-by: Bagatur <[email protected]>
  • Loading branch information
cbornet and baskaryan authored Feb 22, 2024
1 parent 9775de4 commit 4f88a51
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions libs/langchain/langchain/retrievers/self_query/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def _get_builtin_translator(vectorstore: VectorStore) -> Visitor:
OpenSearchVectorSearch: OpenSearchTranslator,
MongoDBAtlasVectorSearch: MongoDBAtlasTranslator,
}

if isinstance(vectorstore, Qdrant):
return QdrantTranslator(metadata_key=vectorstore.metadata_payload_key)
elif isinstance(vectorstore, MyScale):
Expand All @@ -85,6 +86,14 @@ def _get_builtin_translator(vectorstore: VectorStore) -> Visitor:
elif vectorstore.__class__ in BUILTIN_TRANSLATORS:
return BUILTIN_TRANSLATORS[vectorstore.__class__]()
else:
try:
from langchain_astradb.vectorstores import AstraDBVectorStore

if isinstance(vectorstore, AstraDBVectorStore):
return AstraDBTranslator()
except ImportError:
pass

raise ValueError(
f"Self query retriever with Vector Store type {vectorstore.__class__}"
f" not supported."
Expand Down

0 comments on commit 4f88a51

Please sign in to comment.