Home / Function/ test_add_by_ids() — langchain Function Reference

test_add_by_ids() — langchain Function Reference

Architecture documentation for the test_add_by_ids() function in test_in_memory.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  7d5e45b7_5659_3e91_bbb7_498e6c78ff8e["test_add_by_ids()"]
  a974d690_d5fa_ba65_671d_ce8278eefe7d["test_in_memory.py"]
  7d5e45b7_5659_3e91_bbb7_498e6c78ff8e -->|defined in| a974d690_d5fa_ba65_671d_ce8278eefe7d
  style 7d5e45b7_5659_3e91_bbb7_498e6c78ff8e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/vectorstores/test_in_memory.py lines 50–62

async def test_add_by_ids() -> None:
    """Test add texts with ids."""
    vectorstore = InMemoryVectorStore(embedding=DeterministicFakeEmbedding(size=6))

    # Check sync version
    ids1 = vectorstore.add_texts(["foo", "bar", "baz"], ids=["1", "2", "3"])
    assert ids1 == ["1", "2", "3"]
    assert sorted(vectorstore.store.keys()) == ["1", "2", "3"]

    # Check async version
    ids2 = await vectorstore.aadd_texts(["foo", "bar", "baz"], ids=["4", "5", "6"])
    assert ids2 == ["4", "5", "6"]
    assert sorted(vectorstore.store.keys()) == ["1", "2", "3", "4", "5", "6"]

Domain

Subdomains

Frequently Asked Questions

What does test_add_by_ids() do?
test_add_by_ids() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/vectorstores/test_in_memory.py.
Where is test_add_by_ids() defined?
test_add_by_ids() is defined in libs/core/tests/unit_tests/vectorstores/test_in_memory.py at line 50.

Analyze Your Own Codebase

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

Try Supermodel Free