Home / Function/ test_chroma_search_filter() — langchain Function Reference

test_chroma_search_filter() — langchain Function Reference

Architecture documentation for the test_chroma_search_filter() function in test_vectorstores.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  0504d939_df37_0fe7_7c26_e006b8b6abb8["test_chroma_search_filter()"]
  289e5a4f_8e2e_ddb6_af2e_804f91dabdb8["test_vectorstores.py"]
  0504d939_df37_0fe7_7c26_e006b8b6abb8 -->|defined in| 289e5a4f_8e2e_ddb6_af2e_804f91dabdb8
  style 0504d939_df37_0fe7_7c26_e006b8b6abb8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/chroma/tests/integration_tests/test_vectorstores.py lines 228–248

def test_chroma_search_filter() -> None:
    """Test end to end construction and search with metadata filtering."""
    texts = ["far", "bar", "baz"]
    metadatas = [{"first_letter": f"{text[0]}"} for text in texts]
    ids = [f"id_{i}" for i in range(len(texts))]
    docsearch = Chroma.from_texts(
        collection_name="test_collection",
        texts=texts,
        embedding=FakeEmbeddings(),
        metadatas=metadatas,
        ids=ids,
    )
    output1 = docsearch.similarity_search("far", k=1, filter={"first_letter": "f"})
    output2 = docsearch.similarity_search("far", k=1, filter={"first_letter": "b"})
    docsearch.delete_collection()
    assert output1 == [
        Document(page_content="far", metadata={"first_letter": "f"}, id="id_0"),
    ]
    assert output2 == [
        Document(page_content="bar", metadata={"first_letter": "b"}, id="id_1"),
    ]

Domain

Subdomains

Frequently Asked Questions

What does test_chroma_search_filter() do?
test_chroma_search_filter() is a function in the langchain codebase, defined in libs/partners/chroma/tests/integration_tests/test_vectorstores.py.
Where is test_chroma_search_filter() defined?
test_chroma_search_filter() is defined in libs/partners/chroma/tests/integration_tests/test_vectorstores.py at line 228.

Analyze Your Own Codebase

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

Try Supermodel Free