Home / Function/ test_get_combined_score() — langchain Function Reference

test_get_combined_score() — langchain Function Reference

Architecture documentation for the test_get_combined_score() function in test_time_weighted_retriever.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  fe3d0c26_923f_3801_6751_1e93b6471082["test_get_combined_score()"]
  3ccece1f_f844_33e7_bdea_1996eb777e35["test_time_weighted_retriever.py"]
  fe3d0c26_923f_3801_6751_1e93b6471082 -->|defined in| 3ccece1f_f844_33e7_bdea_1996eb777e35
  style fe3d0c26_923f_3801_6751_1e93b6471082 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/tests/unit_tests/retrievers/test_time_weighted_retriever.py lines 99–117

def test_get_combined_score(
    time_weighted_retriever: TimeWeightedVectorStoreRetriever,
) -> None:
    document = Document(
        page_content="Test document",
        metadata={"last_accessed_at": datetime(2023, 4, 14, 12, 0)},
    )
    vector_salience = 0.7
    expected_hours_passed = 2.5
    current_time = datetime(2023, 4, 14, 14, 30)
    combined_score = time_weighted_retriever._get_combined_score(
        document,
        vector_salience,
        current_time,
    )
    expected_score = (
        1.0 - time_weighted_retriever.decay_rate
    ) ** expected_hours_passed + vector_salience
    assert combined_score == pytest.approx(expected_score)

Domain

Subdomains

Frequently Asked Questions

What does test_get_combined_score() do?
test_get_combined_score() is a function in the langchain codebase, defined in libs/langchain/tests/unit_tests/retrievers/test_time_weighted_retriever.py.
Where is test_get_combined_score() defined?
test_get_combined_score() is defined in libs/langchain/tests/unit_tests/retrievers/test_time_weighted_retriever.py at line 99.

Analyze Your Own Codebase

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

Try Supermodel Free