pub struct RerankBody {
pub model: RerankModel,
pub query: String,
pub documents: Vec<String>,
pub top_n: Option<usize>,
pub return_documents: Option<bool>,
pub return_raw_scores: Option<bool>,
pub request_id: Option<String>,
pub user_id: Option<String>,
}Expand description
Request body for rerank API
Fields§
§model: RerankModel模型编码,默认为 rerank
query: String查询文本(最大长度 4096 字符)
documents: Vec<String>候选文本数组(最多 128 条,单条最大 4096 字符)
top_n: Option<usize>返回得分最高的前 n 条,默认 0 返回所有
return_documents: Option<bool>是否返回原始文本,默认 false
return_raw_scores: Option<bool>是否返回原始分数,默认 false
request_id: Option<String>客户端请求ID
user_id: Option<String>终端用户ID
Implementations§
Source§impl RerankBody
impl RerankBody
pub fn new( model: RerankModel, query: impl Into<String>, documents: Vec<String>, ) -> Self
pub fn with_top_n(self, n: usize) -> Self
pub fn with_return_documents(self, v: bool) -> Self
pub fn with_return_raw_scores(self, v: bool) -> Self
pub fn with_request_id(self, v: impl Into<String>) -> Self
pub fn with_user_id(self, v: impl Into<String>) -> Self
Sourcepub fn validate_constraints(&self) -> ZaiResult<()>
pub fn validate_constraints(&self) -> ZaiResult<()>
Optional runtime validation for constraints expressed in the docs
Trait Implementations§
Source§impl Clone for RerankBody
impl Clone for RerankBody
Source§fn clone(&self) -> RerankBody
fn clone(&self) -> RerankBody
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RerankBody
impl Debug for RerankBody
Auto Trait Implementations§
impl Freeze for RerankBody
impl RefUnwindSafe for RerankBody
impl Send for RerankBody
impl Sync for RerankBody
impl Unpin for RerankBody
impl UnsafeUnpin for RerankBody
impl UnwindSafe for RerankBody
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