pub struct Models<'a> { /* private fields */ }Expand description
Models resource for reranking operations
Implementations§
Source§impl<'a> Models<'a>
 
impl<'a> Models<'a>
Sourcepub async fn rerank(
    &self,
    query: impl Into<String>,
    documents: Vec<RerankDocument>,
    model_id: Option<String>,
    top_k: Option<u32>,
) -> Result<RerankResponse>
 
pub async fn rerank( &self, query: impl Into<String>, documents: Vec<RerankDocument>, model_id: Option<String>, top_k: Option<u32>, ) -> Result<RerankResponse>
Rerank documents based on relevance to a query
§Arguments
- query- The query to rank documents against
- documents- List of documents to rerank
- model_id- Optional model ID (defaults to best available model)
- top_k- Optional number of top results to return
§Example
let client = Client::from_env()?;
let documents = vec![
    RerankDocument {
        id: "doc1".to_string(),
        text: "Rust is a systems programming language".to_string(),
    },
    RerankDocument {
        id: "doc2".to_string(),
        text: "Python is a high-level programming language".to_string(),
    },
];
 
let response = client.models().rerank(
    "systems programming",
    documents,
    None,
    None,
).await?;Auto Trait Implementations§
impl<'a> Freeze for Models<'a>
impl<'a> !RefUnwindSafe for Models<'a>
impl<'a> Send for Models<'a>
impl<'a> Sync for Models<'a>
impl<'a> Unpin for Models<'a>
impl<'a> !UnwindSafe for Models<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more