pub struct AssistantInvokeRequest {
pub assistant_id: AssistantId,
pub conversation_id: Option<String>,
pub model: AssistantModel,
pub messages: Vec<AssistantMessage>,
pub stream: bool,
pub request_id: Option<String>,
pub user_id: Option<String>,
pub do_sample: Option<bool>,
pub attachments: Option<Vec<Map<String, Value>>>,
pub metadata: Option<Map<String, Value>>,
pub extra_parameters: Option<AssistantExtraParameters>,
}Expand description
Invoke an assistant.
Fields§
§assistant_id: AssistantIdAssistant identifier.
conversation_id: Option<String>Existing conversation identifier, when continuing a conversation.
model: AssistantModelAssistant model. This required field is always serialized.
messages: Vec<AssistantMessage>User messages. The frozen schema requires at least one item.
stream: boolStreaming flag. The JSON-only send_via path requires this to remain
false and serializes it explicitly because the server default is true.
request_id: Option<String>Caller-provided request identifier (6..=64 characters).
user_id: Option<String>End-user identifier (6..=128 characters).
do_sample: Option<bool>Whether sampling is enabled.
attachments: Option<Vec<Map<String, Value>>>Open attachment objects from the upstream schema.
metadata: Option<Map<String, Value>>Open metadata map (additionalProperties: true).
extra_parameters: Option<AssistantExtraParameters>Typed assistant-specific parameters.
Implementations§
Source§impl AssistantInvokeRequest
impl AssistantInvokeRequest
Sourcepub fn new(assistant_id: AssistantId, messages: Vec<AssistantMessage>) -> Self
pub fn new(assistant_id: AssistantId, messages: Vec<AssistantMessage>) -> Self
Create an invocation with all OpenAPI-required fields.
Sourcepub fn with_conversation_id(self, conversation_id: impl Into<String>) -> Self
pub fn with_conversation_id(self, conversation_id: impl Into<String>) -> Self
Continue an existing conversation.
Sourcepub fn with_model(self, model: AssistantModel) -> Self
pub fn with_model(self, model: AssistantModel) -> Self
Select the assistant model.
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 the caller-provided request identifier.
Sourcepub fn with_user_id(self, user_id: impl Into<String>) -> Self
pub fn with_user_id(self, user_id: impl Into<String>) -> Self
Set the end-user identifier.
Sourcepub fn with_sampling(self, enabled: bool) -> Self
pub fn with_sampling(self, enabled: bool) -> Self
Select the sampling behavior.
Sourcepub fn with_attachments(self, attachments: Vec<Map<String, Value>>) -> Self
pub fn with_attachments(self, attachments: Vec<Map<String, Value>>) -> Self
Set attachment objects.
Sourcepub fn with_metadata(self, metadata: Map<String, Value>) -> Self
pub fn with_metadata(self, metadata: Map<String, Value>) -> Self
Set open metadata fields.
Sourcepub fn with_extra_parameters(self, parameters: AssistantExtraParameters) -> Self
pub fn with_extra_parameters(self, parameters: AssistantExtraParameters) -> Self
Set typed assistant-specific parameters.
Sourcepub async fn send_via(
&self,
client: &ZaiClient,
) -> ZaiResult<AssistantInvokeResponse>
pub async fn send_via( &self, client: &ZaiClient, ) -> ZaiResult<AssistantInvokeResponse>
Send the request through client.
Trait Implementations§
Source§impl Clone for AssistantInvokeRequest
impl Clone for AssistantInvokeRequest
Source§fn clone(&self) -> AssistantInvokeRequest
fn clone(&self) -> AssistantInvokeRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more