mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-01 20:49:17 +00:00
This PR rolls out part of the new proposed interface for vectorstores (https://github.com/langchain-ai/langchain/pull/23544) to existing store implementations. The PR makes the following changes: 1. Adds standard upsert, streaming_upsert, aupsert, astreaming_upsert methods to the vectorstore. 2. Updates `add_texts` and `aadd_texts` to be non required with a default implementation that delegates to `upsert` and `aupsert` if those have been implemented. The original `add_texts` and `aadd_texts` methods are problematic as they spread object specific information across document and **kwargs. (e.g., ids are not a part of the document) 3. Adds a default implementation to `add_documents` and `aadd_documents` that delegates to `upsert` and `aupsert` respectively. 4. Adds standard unit tests to verify that a given vectorstore implements a correct read/write API. A downside of this implementation is that it creates `upsert` with a very similar signature to `add_documents`. The reason for introducing `upsert` is to: * Remove any ambiguities about what information is allowed in `kwargs`. Specifically kwargs should only be used for information common to all indexed data. (e.g., indexing timeout). *Allow inheriting from an anticipated generalized interface for indexing that will allow indexing `BaseMedia` (i.e., allow making a vectorstore for images/audio etc.) `add_documents` can be deprecated in the future in favor of `upsert` to make sure that users have a single correct way of indexing content. --------- Co-authored-by: ccurme <chester.curme@gmail.com> |
||
---|---|---|
.. | ||
agent_toolkits | ||
agents | ||
callbacks | ||
chains | ||
chat_loaders | ||
chat_message_histories | ||
chat_models | ||
cross_encoders | ||
data | ||
docstore | ||
document_compressors | ||
document_loaders | ||
document_transformers | ||
embeddings | ||
evaluation | ||
examples | ||
graphs | ||
imports | ||
indexes | ||
llms | ||
load | ||
query_constructors | ||
retrievers | ||
storage | ||
tools | ||
utilities | ||
utils | ||
vectorstores | ||
__init__.py | ||
conftest.py | ||
test_cache.py | ||
test_dependencies.py | ||
test_document_transformers.py | ||
test_imports.py | ||
test_sql_database_schema.py | ||
test_sql_database.py | ||
test_sqlalchemy.py |