mirror of
https://github.com/hwchase17/langchain
synced 2024-11-18 09:25:54 +00:00
langchain[patch]: Support langchain-astradb AstraDBVectorStore in self-query retriever (#17728)
Co-authored-by: Bagatur <baskaryan@gmail.com>
This commit is contained in:
parent
9775de46cc
commit
4f88a5130e
@ -76,6 +76,7 @@ def _get_builtin_translator(vectorstore: VectorStore) -> Visitor:
|
|||||||
OpenSearchVectorSearch: OpenSearchTranslator,
|
OpenSearchVectorSearch: OpenSearchTranslator,
|
||||||
MongoDBAtlasVectorSearch: MongoDBAtlasTranslator,
|
MongoDBAtlasVectorSearch: MongoDBAtlasTranslator,
|
||||||
}
|
}
|
||||||
|
|
||||||
if isinstance(vectorstore, Qdrant):
|
if isinstance(vectorstore, Qdrant):
|
||||||
return QdrantTranslator(metadata_key=vectorstore.metadata_payload_key)
|
return QdrantTranslator(metadata_key=vectorstore.metadata_payload_key)
|
||||||
elif isinstance(vectorstore, MyScale):
|
elif isinstance(vectorstore, MyScale):
|
||||||
@ -85,6 +86,14 @@ def _get_builtin_translator(vectorstore: VectorStore) -> Visitor:
|
|||||||
elif vectorstore.__class__ in BUILTIN_TRANSLATORS:
|
elif vectorstore.__class__ in BUILTIN_TRANSLATORS:
|
||||||
return BUILTIN_TRANSLATORS[vectorstore.__class__]()
|
return BUILTIN_TRANSLATORS[vectorstore.__class__]()
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
|
from langchain_astradb.vectorstores import AstraDBVectorStore
|
||||||
|
|
||||||
|
if isinstance(vectorstore, AstraDBVectorStore):
|
||||||
|
return AstraDBTranslator()
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
f"Self query retriever with Vector Store type {vectorstore.__class__}"
|
f"Self query retriever with Vector Store type {vectorstore.__class__}"
|
||||||
f" not supported."
|
f" not supported."
|
||||||
|
Loading…
Reference in New Issue
Block a user