You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
langchain/libs/experimental/langchain_experimental
刘 方瑞 890ed775a3
Resolve: VectorSearch enabled SQLChain? (#10177)
Squashed from #7454 with updated features

We have separated the `SQLDatabseChain` from `VectorSQLDatabseChain` and
put everything into `experimental/`.

Below is the original PR message from #7454.

-------

We have been working on features to fill up the gap among SQL, vector
search and LLM applications. Some inspiring works like self-query
retrievers for VectorStores (for example
[Weaviate](https://python.langchain.com/en/latest/modules/indexes/retrievers/examples/weaviate_self_query.html)
and
[others](https://python.langchain.com/en/latest/modules/indexes/retrievers/examples/self_query.html))
really turn those vector search databases into a powerful knowledge
base! 🚀🚀

We are thinking if we can merge all in one, like SQL and vector search
and LLMChains, making this SQL vector database memory as the only source
of your data. Here are some benefits we can think of for now, maybe you
have more 👀:

With ALL data you have: since you store all your pasta in the database,
you don't need to worry about the foreign keys or links between names
from other data source.
Flexible data structure: Even if you have changed your schema, for
example added a table, the LLM will know how to JOIN those tables and
use those as filters.
SQL compatibility: We found that vector databases that supports SQL in
the marketplace have similar interfaces, which means you can change your
backend with no pain, just change the name of the distance function in
your DB solution and you are ready to go!

### Issue resolved:
- [Feature Proposal: VectorSearch enabled
SQLChain?](https://github.com/hwchase17/langchain/issues/5122)

### Change made in this PR:
- An improved schema handling that ignore `types.NullType` columns 
- A SQL output Parser interface in `SQLDatabaseChain` to enable Vector
SQL capability and further more
- A Retriever based on `SQLDatabaseChain` to retrieve data from the
database for RetrievalQAChains and many others
- Allow `SQLDatabaseChain` to retrieve data in python native format
- Includes PR #6737 
- Vector SQL Output Parser for `SQLDatabaseChain` and
`SQLDatabaseChainRetriever`
- Prompts that can implement text to VectorSQL
- Corresponding unit-tests and notebook

### Twitter handle: 
- @MyScaleDB

### Tag Maintainer:
Prompts / General: @hwchase17, @baskaryan
DataLoaders / VectorStores / Retrievers: @rlancemartin, @eyurtsev

### Dependencies:
No dependency added
1 year ago
..
autonomous_agents Harrison/string inplace (#10153) 1 year ago
comprehend_moderation Harrison/string inplace (#10153) 1 year ago
cpal Add security notices on PAL and CPAL experimental chains. (#9938) 1 year ago
data_anonymizer Temporarily remove language selection (#10097) 1 year ago
fallacy_removal adding new chain for logical fallacy removal from model output in chain (#9887) 1 year ago
generative_agents Use a submodule for pydantic v1 compat (#9371) 1 year ago
graph_transformers Diffbot Graph Transformer / Neo4j Graph document ingestion (#9979) 1 year ago
llms Use a submodule for pydantic v1 compat (#9371) 1 year ago
pal_chain Add security notices on PAL and CPAL experimental chains. (#9938) 1 year ago
plan_and_execute Use a submodule for pydantic v1 compat (#9371) 1 year ago
prompts
pydantic_v1 `poetry lock` the experimental package. (#9478) 1 year ago
retrievers Resolve: VectorSearch enabled SQLChain? (#10177) 1 year ago
smart_llm Use a submodule for pydantic v1 compat (#9371) 1 year ago
sql Resolve: VectorSearch enabled SQLChain? (#10177) 1 year ago
tot Use a submodule for pydantic v1 compat (#9371) 1 year ago
__init__.py Use a submodule for pydantic v1 compat (#9371) 1 year ago
py.typed Add `py.typed` file to `langchain-experimental`. (#9557) 1 year ago