-
Notifications
You must be signed in to change notification settings - Fork 15.8k
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
refactor langchain.retrievers.self_query
#16115
refactor langchain.retrievers.self_query
#16115
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
23d5299
to
235a9df
Compare
@baskaryan Conflicts resolved. Any comments? |
@baskaryan Hey Bagatur, let me know if you have other plans for extracting community code from |
002095e
to
b54479e
Compare
@efriis Merging conflicts resolved. Please, take a look. |
@baskaryan Please let me know if this PR makes sense. If it makes sense, then I resolve conflicts. I've resolved branch conflicts several times, but nobody has reviewed PR. |
b28dea6
to
580cd70
Compare
@@ -0,0 +1,70 @@ | |||
"""Logic for converting internal query language to a valid AstraDB query.""" |
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.
@@ -1,256 +1,29 @@ | |||
"""LLM Chain for turning a user text query into a structured query.""" | |||
from __future__ import annotations | |||
from typing import Any, List, Optional, Sequence, Union |
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.
We should keep as much of the provider agnostic code in langchain and not move it, so that providers that move to partner packages are able to re-use it without importing from community
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.
@eyurtsev Do you mean to keep the from __future__ import annotations
line?
OK I think this PR is blocked on release 0.2.0 that will break dependency on langchain-community, and will make it possible for langchain-community to import these base chains form The issue is that these are higher order chains and it's not clear that they should live in |
@eyurtsev Do you mean to wait with this PR till the |
Converted to Draft. It could be a part of 0.2.0 |
Re-opened temporarily to make it easier to reference. I'm going to make a similar change, but slightly different name spaces |
This will need to be rebased carefully as there have been changes done to the self query retriever since the beginning of this PR. |
@cbornet yeah was mostly using for reference. @baskaryan doing it here: #20849 @leo-gan / @cbornet, context is that we're in the process of reversing the dependency between community and langchain So langchain-community will start depending on langchain (rather than vice versa). So we'll be doing some acrobatics during the next week or so |
Issue: all classes in
langchain.retrievers.self_query
namespace belong to thecommunity
package.Following issue:
We cannot just move these classes to
community
because of the dependency on the Visitor class and other classes from thelangchain.chains.query_constructor
namespace.What is interesting is that
langchain.chains.query_constructor
artifacts are used ONLY in thelangchain.retrievers.self_query
artifacts.It happens that
langchain.chains.query_constructor
artifacts do not depend on thelangchain.chains
. Thelangchain.chains.query_constructor
is quite independent. Because of that we can movelangchain.chains.query_constructor
underlangchain_core
as thelangchain_core.sql_constructor
The reason for renaming
query_constructor
intosql_constructor
is simple. It IS the SQL constructor. Moreover, thequery_..
is the ambiguous name in the LLM context because we usequery
in retrievers and many other places not as the SQL queries but as the queries in prompts.sql
is unambiguous name here.NOTE: The
langchain.chains.query_constructor.base.load_query_constructor_chain
is not moved! This is the only dependency tochains
. It is not important because Chains will be deprecated soon.