Self query retriever with Vector Store type Elasticsearch not supported. #18976
-
Checked other resources
Commit to Help
Example Codefrom langchain.schema import Document
from langchain_elasticsearch import ElasticsearchStore
from langchain.retrievers.self_query.base import SelfQueryRetriever
from langchain.chains.query_constructor.base import AttributeInfo
from langchain_community.llms import Ollama
llm = Ollama(model="llama2",base_url='url')
retriever = SelfQueryRetriever.from_llm(
llm, vectorstore, document_content_description, metadata_field_info, verbose=True
) DescriptionI am trying a retrieval query on Elasticsearch as a vector store. Embeddings and metadata are already stored in an elastic index, but I am facing an Error.
System Info$pip freeze|grep langchain |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 1 reply
-
Hey @hussnainahmed, great to see you diving into the depths of LangChain again! Hope you're doing fantastic. Based on the information you've provided and the context from the LangChain repository, it seems like you're encountering a The def _get_builtin_translator(vectorstore: VectorStore) -> Visitor:
"""Get the translator class corresponding to the vector store class."""
BUILTIN_TRANSLATORS: Dict[Type[VectorStore], Type[Visitor]] = {
AstraDB: AstraDBTranslator,
PGVector: PGVectorTranslator,
Pinecone: PineconeTranslator,
Chroma: ChromaTranslator,
DashVector: DashvectorTranslator,
Dingo: DingoDBTranslator,
Weaviate: WeaviateTranslator,
Vectara: VectaraTranslator,
Qdrant: QdrantTranslator,
MyScale: MyScaleTranslator,
DeepLake: DeepLakeTranslator,
ElasticsearchStore: ElasticsearchTranslator,
Milvus: MilvusTranslator,
SupabaseVectorStore: SupabaseVectorTranslator,
TimescaleVector: TimescaleVectorTranslator,
OpenSearchVectorSearch: OpenSearchTranslator,
MongoDBAtlasVectorSearch: MongoDBAtlasTranslator,
}
if isinstance(vectorstore, Qdrant):
return QdrantTranslator(metadata_key=vectorstore.metadata_payload_key)
elif isinstance(vectorstore, MyScale):
return MyScaleTranslator(metadata_key=vectorstore.metadata_column)
elif isinstance(vectorstore, Redis):
return RedisTranslator.from_vectorstore(vectorstore)
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."
) (Source: libs/langchain/langchain/retrievers/self_query/base.py) From the code, we can see that
Given the provided context, the mapping between I hope this helps! If you have any more questions or need further clarification, feel free to ask. Sources
|
Beta Was this translation helpful? Give feedback.
-
@hussnainahmed from langchain_community.vectorstores.elasticsearch import ElasticsearchStore |
Beta Was this translation helpful? Give feedback.
-
I had the same issue with pinecone. It turned out that if I import PineconeVectorStore as follows: |
Beta Was this translation helpful? Give feedback.
-
Do we have any idea when this will be fixed ? |
Beta Was this translation helpful? Give feedback.
-
cc @joemcelroy |
Beta Was this translation helpful? Give feedback.
-
This was fixed here: #19907 so in the next LangChain release @hussnainahmed's issue should disappear because it will be possible to use an |
Beta Was this translation helpful? Give feedback.
@hussnainahmed
Try to change your ElastisearchStore import to :