The API Reranker Clients subsystem is primarily encapsulated within the rerankers.models.api_rankers module, specifically the api_rankers.py file. This module is responsible for handling all interactions with external reranking APIs, including request formatting, execution, and response parsing.
Components
rank
The primary public interface for performing a full reranking operation by orchestrating the entire process of payload formatting, API request execution, and response parsing. It acts as a facade for the complex API interaction logic.
Referenced Source Code
score
A public interface providing a more granular method to obtain a single reranking score for a given query-document pair from an external API. It leverages the same underlying formatting and parsing mechanisms as rank.
Referenced Source Code
_format_payload
An internal helper component responsible for transforming the internal data structures (query, documents) into the specific request format (e.g., JSON) required by the target external reranking API. It ensures compatibility with various API specifications.
Referenced Source Code
_parse_response
An internal helper component that handles the deserialization and initial interpretation of the raw API response received from external reranking services. It converts the external API's response into a usable internal representation.
Referenced Source Code
_get_score
A specialized internal helper component, called by _parse_response, designed specifically to extract the numerical reranking score from the parsed API response data. It isolates the logic for score retrieval.