test_inmemory_mmr() — langchain Function Reference
Architecture documentation for the test_inmemory_mmr() function in test_in_memory.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD e8196cf1_f26b_1988_d0fc_74bdbb8e113a["test_inmemory_mmr()"] a974d690_d5fa_ba65_671d_ce8278eefe7d["test_in_memory.py"] e8196cf1_f26b_1988_d0fc_74bdbb8e113a -->|defined in| a974d690_d5fa_ba65_671d_ce8278eefe7d style e8196cf1_f26b_1988_d0fc_74bdbb8e113a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/vectorstores/test_in_memory.py lines 65–83
async def test_inmemory_mmr() -> None:
"""Test MMR search."""
texts = ["foo", "foo", "fou", "foy"]
docsearch = await InMemoryVectorStore.afrom_texts(
texts, DeterministicFakeEmbedding(size=6)
)
# make sure we can k > docstore size
output = docsearch.max_marginal_relevance_search("foo", k=10, lambda_mult=0.1)
assert len(output) == len(texts)
assert output[0] == _any_id_document(page_content="foo")
assert output[1] == _any_id_document(page_content="fou")
# Check async version
output = await docsearch.amax_marginal_relevance_search(
"foo", k=10, lambda_mult=0.1
)
assert len(output) == len(texts)
assert output[0] == _any_id_document(page_content="foo")
assert output[1] == _any_id_document(page_content="fou")
Domain
Subdomains
Source
Frequently Asked Questions
What does test_inmemory_mmr() do?
test_inmemory_mmr() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/vectorstores/test_in_memory.py.
Where is test_inmemory_mmr() defined?
test_inmemory_mmr() is defined in libs/core/tests/unit_tests/vectorstores/test_in_memory.py at line 65.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free