Home / Function/ _get_combined_score() — langchain Function Reference

_get_combined_score() — langchain Function Reference

Architecture documentation for the _get_combined_score() function in time_weighted_retriever.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  de9ececd_a24c_a706_c8b7_9e9cc434d9ae["_get_combined_score()"]
  57cc5b02_6622_339b_0806_ef06db1bc8c7["TimeWeightedVectorStoreRetriever"]
  de9ececd_a24c_a706_c8b7_9e9cc434d9ae -->|defined in| 57cc5b02_6622_339b_0806_ef06db1bc8c7
  35a5a812_9087_0a29_b7c9_ebcab9fe35fa["_get_rescored_docs()"]
  35a5a812_9087_0a29_b7c9_ebcab9fe35fa -->|calls| de9ececd_a24c_a706_c8b7_9e9cc434d9ae
  06a8e211_07ff_e5fa_7350_c1174a255930["_document_get_date()"]
  de9ececd_a24c_a706_c8b7_9e9cc434d9ae -->|calls| 06a8e211_07ff_e5fa_7350_c1174a255930
  d1bd6e3c_8025_6ecd_ce6e_d1deea9cc917["_get_hours_passed()"]
  de9ececd_a24c_a706_c8b7_9e9cc434d9ae -->|calls| d1bd6e3c_8025_6ecd_ce6e_d1deea9cc917
  style de9ececd_a24c_a706_c8b7_9e9cc434d9ae fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/retrievers/time_weighted_retriever.py lines 64–81

    def _get_combined_score(
        self,
        document: Document,
        vector_relevance: float | None,
        current_time: datetime.datetime,
    ) -> float:
        """Return the combined score for a document."""
        hours_passed = _get_hours_passed(
            current_time,
            self._document_get_date("last_accessed_at", document),
        )
        score = (1.0 - self.decay_rate) ** hours_passed
        for key in self.other_score_keys:
            if key in document.metadata:
                score += document.metadata[key]
        if vector_relevance is not None:
            score += vector_relevance
        return score

Domain

Subdomains

Frequently Asked Questions

What does _get_combined_score() do?
_get_combined_score() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/retrievers/time_weighted_retriever.py.
Where is _get_combined_score() defined?
_get_combined_score() is defined in libs/langchain/langchain_classic/retrievers/time_weighted_retriever.py at line 64.
What does _get_combined_score() call?
_get_combined_score() calls 2 function(s): _document_get_date, _get_hours_passed.
What calls _get_combined_score()?
_get_combined_score() is called by 1 function(s): _get_rescored_docs.

Analyze Your Own Codebase

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

Try Supermodel Free