langchain/libs/core/langchain_core
Eugene Yurtsev 6f08e11d7c
core[minor]: add upsert, streaming_upsert, aupsert, astreaming_upsert methods to the VectorStore abstraction (#23774)
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>
2024-07-05 12:21:40 -04:00
..
_api infra: update mypy 1.10, ruff 0.5 (#23721) 2024-07-03 10:33:27 -07:00
beta core: Updated docstring for Context class (#19079) 2024-03-18 21:15:14 -07:00
callbacks core[patch]: callbacks docstrings (#23375) 2024-06-26 17:11:06 -04:00
document_loaders infra: update mypy 1.10, ruff 0.5 (#23721) 2024-07-03 10:33:27 -07:00
documents infra: update mypy 1.10, ruff 0.5 (#23721) 2024-07-03 10:33:27 -07:00
embeddings infra: update mypy 1.10, ruff 0.5 (#23721) 2024-07-03 10:33:27 -07:00
example_selectors core: docstrings example_selectors (#23542) 2024-06-26 17:10:40 -04:00
indexing core[minor]: add upsert, streaming_upsert, aupsert, astreaming_upsert methods to the VectorStore abstraction (#23774) 2024-07-05 12:21:40 -04:00
language_models core[patch]: Fix logic in BaseChatModel that processes the llm string that is used as a key for caching chat models responses (#23842) 2024-07-03 16:23:55 -04:00
load infra: update mypy 1.10, ruff 0.5 (#23721) 2024-07-03 10:33:27 -07:00
messages core[minor]: update conversion utils to handle RemoveMessage (#23840) 2024-07-03 16:13:31 -04:00
output_parsers core[patch]: docstrings output_parsers (#23825) 2024-07-03 14:27:40 -04:00
outputs core: docstrings outputs (#23889) 2024-07-05 12:18:17 -04:00
prompts core: docstrings prompts (#23890) 2024-07-05 12:17:52 -04:00
pydantic_v1 multiple: get rid of pyproject extras (#22581) 2024-06-06 15:45:22 -07:00
runnables core[patch]: Fix typo in docstring (graphm -> graph) (#23910) 2024-07-05 16:20:33 +00:00
tracers infra: update mypy 1.10, ruff 0.5 (#23721) 2024-07-03 10:33:27 -07:00
utils core[minor]: add upsert, streaming_upsert, aupsert, astreaming_upsert methods to the VectorStore abstraction (#23774) 2024-07-05 12:21:40 -04:00
__init__.py core[patch], community[patch]: mark runnable context, lc load as beta (#15603) 2024-01-05 17:54:26 -05:00
agents.py core[patch]: docstrings agents (#23502) 2024-06-26 17:50:48 -04:00
caches.py core[minor]: Add maxsize for InMemoryCache (#23405) 2024-07-01 14:21:21 -04:00
chat_history.py core: chat_* docstrings (#23412) 2024-06-27 17:29:38 -04:00
chat_loaders.py core: chat_* docstrings (#23412) 2024-06-27 17:29:38 -04:00
chat_sessions.py core: chat_* docstrings (#23412) 2024-06-27 17:29:38 -04:00
env.py core[patch]: update langchain-core runtime library name (#14884) 2023-12-20 14:35:48 -08:00
exceptions.py core[patch]: docstrings agents (#23502) 2024-06-26 17:50:48 -04:00
globals.py core[patch]: docstrings agents (#23502) 2024-06-26 17:50:48 -04:00
memory.py core[patch]: docstrings agents (#23502) 2024-06-26 17:50:48 -04:00
prompt_values.py core[patch]: docstrings agents (#23502) 2024-06-26 17:50:48 -04:00
py.typed core[minor], langchain[patch], experimental[patch]: Added missing py.typed to langchain_core (#14143) 2023-12-01 19:15:23 -08:00
retrievers.py core[patch]: docstrings agents (#23502) 2024-06-26 17:50:48 -04:00
stores.py core[patch]: docstrings agents (#23502) 2024-06-26 17:50:48 -04:00
structured_query.py infra: update mypy 1.10, ruff 0.5 (#23721) 2024-07-03 10:33:27 -07:00
sys_info.py docs: modules descriptions (#17844) 2024-02-21 15:58:21 -08:00
tools.py infra: update mypy 1.10, ruff 0.5 (#23721) 2024-07-03 10:33:27 -07:00
vectorstores.py core[minor]: add upsert, streaming_upsert, aupsert, astreaming_upsert methods to the VectorStore abstraction (#23774) 2024-07-05 12:21:40 -04:00