Home / Function/ test_add_documents_with_ids_is_idempotent_async() — langchain Function Reference

test_add_documents_with_ids_is_idempotent_async() — langchain Function Reference

Architecture documentation for the test_add_documents_with_ids_is_idempotent_async() function in vectorstores.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  4f79974d_1aaa_a730_b561_32f597aef3c1["test_add_documents_with_ids_is_idempotent_async()"]
  6b7f515d_5b14_acff_3191_2493436e519d["VectorStoreIntegrationTests"]
  4f79974d_1aaa_a730_b561_32f597aef3c1 -->|defined in| 6b7f515d_5b14_acff_3191_2493436e519d
  style 4f79974d_1aaa_a730_b561_32f597aef3c1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/standard-tests/langchain_tests/integration_tests/vectorstores.py lines 616–640

    async def test_add_documents_with_ids_is_idempotent_async(
        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_async:
            pytest.skip("Async tests not supported.")

        documents = [
            Document(page_content="foo", metadata={"id": 1}),
            Document(page_content="bar", metadata={"id": 2}),
        ]
        await vectorstore.aadd_documents(documents, ids=["1", "2"])
        await vectorstore.aadd_documents(documents, ids=["1", "2"])
        documents = await vectorstore.asimilarity_search("bar", k=2)
        assert documents == [
            Document(page_content="bar", metadata={"id": 2}, id="2"),
            Document(page_content="foo", metadata={"id": 1}, id="1"),
        ]

Subdomains

Frequently Asked Questions

What does test_add_documents_with_ids_is_idempotent_async() do?
test_add_documents_with_ids_is_idempotent_async() 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_async() defined?
test_add_documents_with_ids_is_idempotent_async() is defined in libs/standard-tests/langchain_tests/integration_tests/vectorstores.py at line 616.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free