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
2023-09-06 17:08:12 -07:00
..
autonomous_agents Harrison/string inplace (#10153) 2023-09-03 14:25:29 -07:00
comprehend_moderation Harrison/string inplace (#10153) 2023-09-03 14:25:29 -07:00
cpal Add security notices on PAL and CPAL experimental chains. (#9938) 2023-08-29 13:51:56 -04:00
data_anonymizer Temporarily remove language selection (#10097) 2023-09-01 11:30:48 -07:00
fallacy_removal adding new chain for logical fallacy removal from model output in chain (#9887) 2023-09-03 15:44:27 -07:00
generative_agents Use a submodule for pydantic v1 compat (#9371) 2023-08-17 16:35:49 +01:00
graph_transformers Diffbot Graph Transformer / Neo4j Graph document ingestion (#9979) 2023-09-06 13:32:59 -07:00
llms Use a submodule for pydantic v1 compat (#9371) 2023-08-17 16:35:49 +01:00
pal_chain Add security notices on PAL and CPAL experimental chains. (#9938) 2023-08-29 13:51:56 -04:00
plan_and_execute Use a submodule for pydantic v1 compat (#9371) 2023-08-17 16:35:49 +01:00
prompts Harrison/official pre release (#8106) 2023-07-21 18:44:32 -07:00
pydantic_v1 poetry lock the experimental package. (#9478) 2023-08-22 14:09:35 -04:00
retrievers Resolve: VectorSearch enabled SQLChain? (#10177) 2023-09-06 17:08:12 -07:00
smart_llm Use a submodule for pydantic v1 compat (#9371) 2023-08-17 16:35:49 +01:00
sql Resolve: VectorSearch enabled SQLChain? (#10177) 2023-09-06 17:08:12 -07:00
tot Use a submodule for pydantic v1 compat (#9371) 2023-08-17 16:35:49 +01:00
__init__.py Use a submodule for pydantic v1 compat (#9371) 2023-08-17 16:35:49 +01:00
py.typed Add py.typed file to langchain-experimental. (#9557) 2023-08-21 15:37:16 -04:00