-
Notifications
You must be signed in to change notification settings - Fork 17.9k
langchain[minor]: Add pgvector to list of supported vectorstores in self query retriever #22678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
eyurtsev
merged 1 commit into
langchain-ai:master
from
pprados:pprados/fix_self_query_with_pgvector
Jun 10, 2024
Merged
langchain[minor]: Add pgvector to list of supported vectorstores in self query retriever #22678
eyurtsev
merged 1 commit into
langchain-ai:master
from
pprados:pprados/fix_self_query_with_pgvector
Jun 10, 2024
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
eyurtsev
approved these changes
Jun 10, 2024
eyurtsev
approved these changes
Jun 10, 2024
@@ -168,6 +168,14 @@ def _get_builtin_translator(vectorstore: VectorStore) -> Visitor: | |||
if isinstance(vectorstore, Chroma): | |||
return ChromaTranslator() | |||
|
|||
try: | |||
from langchain_postgres import PGVector |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(not related to your PR) The try and except here is very odd -- we can just pull the package name from the vectorstore instance itself (via .class)
pprados
added a commit
to pprados/langchain
that referenced
this pull request
Jun 11, 2024
…elf query retriever (langchain-ai#22678) The fact that we outsourced pgvector to another project has an unintended effect. The mapping dictionary found by `_get_builtin_translator()` cannot recognize the new version of pgvector because it comes from another package. `SelfQueryRetriever` no longer knows `PGVector`. I propose to fix this by creating a global dictionary that can be populated by various database implementations. Thus, importing `langchain_postgres` will allow the registration of the `PGvector` mapping. But for the moment I'm just adding a lazy import Furthermore, the implementation of _get_builtin_translator() reconstructs the BUILTIN_TRANSLATORS variable with each invocation, which is not very efficient. A global map would be an optimization. - **Twitter handle:** pprados @eyurtsev, can you review this PR? And unlock the PR [Add async mode for pgvector](langchain-ai/langchain-postgres#32) and PR [community[minor]: Add SQL storage implementation](langchain-ai#22207)? Are you in favour of a global dictionary-based implementation of Translator?
hinthornw
pushed a commit
that referenced
this pull request
Jun 20, 2024
…elf query retriever (#22678) The fact that we outsourced pgvector to another project has an unintended effect. The mapping dictionary found by `_get_builtin_translator()` cannot recognize the new version of pgvector because it comes from another package. `SelfQueryRetriever` no longer knows `PGVector`. I propose to fix this by creating a global dictionary that can be populated by various database implementations. Thus, importing `langchain_postgres` will allow the registration of the `PGvector` mapping. But for the moment I'm just adding a lazy import Furthermore, the implementation of _get_builtin_translator() reconstructs the BUILTIN_TRANSLATORS variable with each invocation, which is not very efficient. A global map would be an optimization. - **Twitter handle:** pprados @eyurtsev, can you review this PR? And unlock the PR [Add async mode for pgvector](langchain-ai/langchain-postgres#32) and PR [community[minor]: Add SQL storage implementation](#22207)? Are you in favour of a global dictionary-based implementation of Translator?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
🤖:bug
Related to a bug, vulnerability, unexpected error with an existing feature
lgtm
PR looks good. Use to confirm that a PR is ready for merging.
🔌: postgres
Related to postgres integrations
Ɑ: retriever
Related to retriever module
size:XS
This PR changes 0-9 lines, ignoring generated files.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Thank you for contributing to LangChain!
langchain: "package: description"
PR message:
Description:
The fact that we outsourced pgvector to another project has an unintended effect. The mapping dictionary found by
_get_builtin_translator()
cannot recognize the new version of pgvector because it comes from another package.SelfQueryRetriever
no longer knowsPGVector
.I propose to fix this by creating a global dictionary that can be populated by various database implementations. Thus, importing
langchain_postgres
will allow the registration of thePGvector
mapping.But for the moment I'm just adding a lazy import
Furthermore, the implementation of _get_builtin_translator() reconstructs the BUILTIN_TRANSLATORS variable with each invocation, which is not very efficient. A global map would be an optimization.
@eyurtsev, can you review this PR? And unlock the PR Add async mode for pgvector and PR community[minor]: Add SQL storage implementation?
Are you in favour of a global dictionary-based implementation of Translator?