Home / Function/ test_chroma_with_relevance_score_custom_normalization_fn() — langchain Function Reference

test_chroma_with_relevance_score_custom_normalization_fn() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/partners/chroma/tests/integration_tests/test_vectorstores.py lines 537–557

def test_chroma_with_relevance_score_custom_normalization_fn() -> None:
    """Test searching with relevance score and custom normalization function."""
    texts = ["foo", "bar", "baz"]
    metadatas = [{"page": str(i)} for i in range(len(texts))]
    ids = [f"id_{i}" for i in range(len(texts))]
    docsearch = Chroma.from_texts(
        collection_name="test1_collection",
        texts=texts,
        embedding=FakeEmbeddings(),
        metadatas=metadatas,
        ids=ids,
        relevance_score_fn=lambda d: d * 0,
        collection_metadata={"hnsw:space": "l2"},
    )
    output = docsearch.similarity_search_with_relevance_scores("foo", k=3)
    docsearch.delete_collection()
    assert output == [
        (Document(page_content="foo", metadata={"page": "0"}, id="id_0"), 0.0),
        (Document(page_content="bar", metadata={"page": "1"}, id="id_1"), 0.0),
        (Document(page_content="baz", metadata={"page": "2"}, id="id_2"), 0.0),
    ]

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free