langchain/libs/community/tests/unit_tests/vectorstores
Jael Gu a1aa3a657c
community[patch]: Milvus supports add & delete texts by ids (#16256)
# Description

To support [langchain
indexing](https://python.langchain.com/docs/modules/data_connection/indexing)
as requested by users, vectorstore Milvus needs to support:
- document addition by id (`add_documents` method with `ids` argument)
- delete by id (`delete` method with `ids` argument)

Example usage:

```python
from langchain.indexes import SQLRecordManager, index
from langchain.schema import Document
from langchain_community.vectorstores import Milvus
from langchain_openai import OpenAIEmbeddings

collection_name = "test_index"
embedding = OpenAIEmbeddings()
vectorstore = Milvus(embedding_function=embedding, collection_name=collection_name)

namespace = f"milvus/{collection_name}"
record_manager = SQLRecordManager(
    namespace, db_url="sqlite:///record_manager_cache.sql"
)
record_manager.create_schema()

doc1 = Document(page_content="kitty", metadata={"source": "kitty.txt"})
doc2 = Document(page_content="doggy", metadata={"source": "doggy.txt"})

index(
    [doc1, doc1, doc2],
    record_manager,
    vectorstore,
    cleanup="incremental",  # None, "incremental", or "full"
    source_id_key="source",
)
```

# Fix issues

Fix https://github.com/milvus-io/milvus/issues/30112

---------

Signed-off-by: Jael Gu <mengjia.gu@zilliz.com>
Co-authored-by: Bagatur <baskaryan@gmail.com>
2024-01-29 11:19:50 -08:00
..
redis community[major], core[patch], langchain[patch], experimental[patch]: Create langchain-community (#14463) 2023-12-11 13:53:30 -08:00
__init__.py community[major], core[patch], langchain[patch], experimental[patch]: Create langchain-community (#14463) 2023-12-11 13:53:30 -08:00
test_databricks_vector_search.py community[major], core[patch], langchain[patch], experimental[patch]: Create langchain-community (#14463) 2023-12-11 13:53:30 -08:00
test_elasticsearch.py community[patch]: ElasticsearchStore: add relevance function selector (#16378) 2024-01-22 11:52:20 -07:00
test_faiss.py community[patch]: add skipped test for inner product normalization (#14989) 2024-01-18 23:03:15 -08:00
test_hanavector.py community[minor]: VectorStore integration for SAP HANA Cloud Vector Engine (#16514) 2024-01-24 14:05:07 -08:00
test_imports.py community[major], core[patch], langchain[patch], experimental[patch]: Create langchain-community (#14463) 2023-12-11 13:53:30 -08:00
test_indexing_docs.py community[patch]: Milvus supports add & delete texts by ids (#16256) 2024-01-29 11:19:50 -08:00
test_neo4j.py Fix RRF and lucene escape characters for neo4j vector store (#14646) 2023-12-13 09:09:50 -08:00
test_pgvector.py refactor: enable connection pool usage in PGVector (#11514) 2023-12-28 15:07:16 -08:00
test_public_api.py community: Added integrations for ThirdAI's NeuralDB with Retriever and VectorStore frameworks (#15280) 2024-01-29 08:35:42 -08:00
test_sklearn.py community[major], core[patch], langchain[patch], experimental[patch]: Create langchain-community (#14463) 2023-12-11 13:53:30 -08:00
test_utils.py community[major], core[patch], langchain[patch], experimental[patch]: Create langchain-community (#14463) 2023-12-11 13:53:30 -08:00