core[minor]: Update pgvector transalor for langchain_postgres (#23217)

The SelfQuery PGVectorTranslator is not correct. The operator is "eq"
and not "$eq".
This patch use a new version of PGVectorTranslator from
langchain_postgres.

It's necessary to release a new version of langchain_postgres (see
[here](https://github.com/langchain-ai/langchain-postgres/pull/75)
before accepting this PR in langchain.
pull/23263/head
Philippe PRADOS 3 months ago committed by GitHub
parent 401d469a92
commit 1c2b9cc9ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -170,11 +170,12 @@ def _get_builtin_translator(vectorstore: VectorStore) -> Visitor:
try:
from langchain_postgres import PGVector
from langchain_postgres import PGVectorTranslator as NewPGVectorTranslator
except ImportError:
pass
else:
if isinstance(vectorstore, PGVector):
return PGVectorTranslator()
return NewPGVectorTranslator()
raise ValueError(
f"Self query retriever with Vector Store type {vectorstore.__class__}"

Loading…
Cancel
Save