Public declaration syntax from forge-rs/crates/forge-embed/src/rerank.rs Original source SHA-256: 3492bef99c4c6a876008cb685249e39965975554ce65570ab40f90228a49437d Function bodies and constant values are omitted. This is not the complete implementation. Source line 42 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct RerankResult { /// The original index of this document in the input slice. pub index: usize, /// The relevance score (higher is more relevant). pub score: f64, /// The document text. pub document: String } Source line 92 #[async_trait] pub trait Reranker: Send + Sync { /// Reranks documents by relevance to a query. /// /// # Arguments /// /// * `query` - The query string to rank documents against. /// * `documents` - The documents to rerank. /// * `top_k` - If provided, return only the top K most relevant results. /// /// # Returns /// /// A vector of [`RerankResult`] sorted by descending relevance score. /// /// # Errors /// /// Returns [`ForgeEmbedError`] if the reranking operation fails. async fn rerank( &self, query: &str, documents: &[String], top_k: Option, ) -> Result, ForgeEmbedError>; } Source line 151 pub async fn rerank( provider: &dyn EmbeddingProvider, query: &str, documents: &[String], top_k: Option, ) -> EmbedResult>;