test_add_documents_with_ids_is_idempotent() — langchain Function Reference
Architecture documentation for the test_add_documents_with_ids_is_idempotent() function in vectorstores.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 61b3053d_a5aa_c68a_9b27_ee6a51c98d1b["test_add_documents_with_ids_is_idempotent()"] 6b7f515d_5b14_acff_3191_2493436e519d["VectorStoreIntegrationTests"] 61b3053d_a5aa_c68a_9b27_ee6a51c98d1b -->|defined in| 6b7f515d_5b14_acff_3191_2493436e519d style 61b3053d_a5aa_c68a_9b27_ee6a51c98d1b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/standard-tests/langchain_tests/integration_tests/vectorstores.py lines 263–287
def test_add_documents_with_ids_is_idempotent(
self, vectorstore: VectorStore
) -> None:
"""Adding by ID should be idempotent.
??? note "Troubleshooting"
If this test fails, check that adding the same document twice with the
same IDs has the same effect as adding it once (i.e., it does not
duplicate the documents).
"""
if not self.has_sync:
pytest.skip("Sync tests not supported.")
documents = [
Document(page_content="foo", metadata={"id": 1}),
Document(page_content="bar", metadata={"id": 2}),
]
vectorstore.add_documents(documents, ids=["1", "2"])
vectorstore.add_documents(documents, ids=["1", "2"])
documents = vectorstore.similarity_search("bar", k=2)
assert documents == [
Document(page_content="bar", metadata={"id": 2}, id="2"),
Document(page_content="foo", metadata={"id": 1}, id="1"),
]
Domain
Subdomains
Source
Frequently Asked Questions
What does test_add_documents_with_ids_is_idempotent() do?
test_add_documents_with_ids_is_idempotent() is a function in the langchain codebase, defined in libs/standard-tests/langchain_tests/integration_tests/vectorstores.py.
Where is test_add_documents_with_ids_is_idempotent() defined?
test_add_documents_with_ids_is_idempotent() is defined in libs/standard-tests/langchain_tests/integration_tests/vectorstores.py at line 263.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free