mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-15 17:33:53 +00:00
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.
This commit is contained in:
parent
401d469a92
commit
1c2b9cc9ab
@ -170,11 +170,12 @@ def _get_builtin_translator(vectorstore: VectorStore) -> Visitor:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
from langchain_postgres import PGVector
|
from langchain_postgres import PGVector
|
||||||
|
from langchain_postgres import PGVectorTranslator as NewPGVectorTranslator
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
if isinstance(vectorstore, PGVector):
|
if isinstance(vectorstore, PGVector):
|
||||||
return PGVectorTranslator()
|
return NewPGVectorTranslator()
|
||||||
|
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
f"Self query retriever with Vector Store type {vectorstore.__class__}"
|
f"Self query retriever with Vector Store type {vectorstore.__class__}"
|
||||||
|
Loading…
Reference in New Issue
Block a user