Skip to content

Commit 1c2b9cc

Browse files
authored
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](langchain-ai/langchain-postgres#75) before accepting this PR in langchain.
1 parent 401d469 commit 1c2b9cc

File tree

1 file changed

+2
-1
lines changed
  • libs/langchain/langchain/retrievers/self_query

1 file changed

+2
-1
lines changed

libs/langchain/langchain/retrievers/self_query/base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,12 @@ def _get_builtin_translator(vectorstore: VectorStore) -> Visitor:
170170

171171
try:
172172
from langchain_postgres import PGVector
173+
from langchain_postgres import PGVectorTranslator as NewPGVectorTranslator
173174
except ImportError:
174175
pass
175176
else:
176177
if isinstance(vectorstore, PGVector):
177-
return PGVectorTranslator()
178+
return NewPGVectorTranslator()
178179

179180
raise ValueError(
180181
f"Self query retriever with Vector Store type {vectorstore.__class__}"

0 commit comments

Comments
 (0)