pub struct KnowledgeSearchRequest {
pub body: KnowledgeSearchBody,
}Expand description
Request for semantic retrieval across one or more knowledge bases.
Fields§
§body: KnowledgeSearchBodyJSON body sent to the retrieval endpoint.
Implementations§
Source§impl KnowledgeSearchRequest
impl KnowledgeSearchRequest
Sourcepub fn new(knowledge_id: impl Into<String>, query: impl Into<String>) -> Self
pub fn new(knowledge_id: impl Into<String>, query: impl Into<String>) -> Self
Create a search request targeting one knowledge base.
Sourcepub fn with_knowledge_ids(self, knowledge_ids: Vec<String>) -> Self
pub fn with_knowledge_ids(self, knowledge_ids: Vec<String>) -> Self
Replace the knowledge-base selection.
Sourcepub fn with_document_ids(self, document_ids: Vec<String>) -> Self
pub fn with_document_ids(self, document_ids: Vec<String>) -> Self
Restrict retrieval to selected documents.
Sourcepub fn with_request_id(self, request_id: impl Into<String>) -> Self
pub fn with_request_id(self, request_id: impl Into<String>) -> Self
Set a caller-generated request identifier.
Sourcepub fn with_top_k(self, top_k: u32) -> Self
pub fn with_top_k(self, top_k: u32) -> Self
Set the requested maximum number of final matches.
Sourcepub fn with_top_n(self, top_n: u32) -> Self
pub fn with_top_n(self, top_n: u32) -> Self
Set the number of candidates recalled before reranking.
Sourcepub fn with_recall_method(self, method: KnowledgeRecallMethod) -> Self
pub fn with_recall_method(self, method: KnowledgeRecallMethod) -> Self
Select the retrieval strategy.
Sourcepub fn with_recall_ratio(self, ratio: u8) -> Self
pub fn with_recall_ratio(self, ratio: u8) -> Self
Set the vector-search weight for mixed retrieval.
Sourcepub fn with_reranking(self, enabled: bool, model: KnowledgeRerankModel) -> Self
pub fn with_reranking(self, enabled: bool, model: KnowledgeRerankModel) -> Self
Configure reranking and its model.
Sourcepub fn with_score_threshold(self, threshold: f64) -> Self
pub fn with_score_threshold(self, threshold: f64) -> Self
Set the minimum relevance score sent as fractional_threshold.
Sourcepub async fn send_via(
&self,
client: &ZaiClient,
) -> ZaiResult<KnowledgeSearchResponse>
pub async fn send_via( &self, client: &ZaiClient, ) -> ZaiResult<KnowledgeSearchResponse>
Validate and send the search request.
Auto Trait Implementations§
impl Freeze for KnowledgeSearchRequest
impl RefUnwindSafe for KnowledgeSearchRequest
impl Send for KnowledgeSearchRequest
impl Sync for KnowledgeSearchRequest
impl Unpin for KnowledgeSearchRequest
impl UnsafeUnpin for KnowledgeSearchRequest
impl UnwindSafe for KnowledgeSearchRequest
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