use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct RankingOptions {
#[serde(rename = "ranker", skip_serializing_if = "Option::is_none")]
pub ranker: Option<models::RankerVersionType>,
#[serde(rename = "score_threshold", skip_serializing_if = "Option::is_none")]
pub score_threshold: Option<f64>,
#[serde(rename = "hybrid_search", skip_serializing_if = "Option::is_none")]
pub hybrid_search: Option<Box<models::HybridSearchOptions>>,
}
impl RankingOptions {
pub fn new() -> RankingOptions {
RankingOptions {
ranker: None,
score_threshold: None,
hybrid_search: None,
}
}
}
impl std::fmt::Display for RankingOptions {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match serde_json::to_string(self) {
Ok(s) => write!(f, "{}", s),
Err(_) => Err(std::fmt::Error),
}
}
}