pub struct ChatCompletionResponse {
pub id: Option<String>,
pub request_id: Option<String>,
pub created: Option<u64>,
pub model: Option<String>,
pub choices: Option<Vec<Choice>>,
pub usage: Option<Usage>,
pub video_result: Option<Vec<VideoResultItem>>,
pub web_search: Option<Vec<WebSearchInfo>>,
pub content_filter: Option<Vec<ContentFilterInfo>>,
pub task_status: Option<TaskStatus>,
}Expand description
Successful business response (HTTP 200, application/json). Notes:
choicesis often a single element in non-stream mode unless explicitly requested otherwise.id/request_idare normalized toStringeven if the server returns numbers.usageis typically present only after completion (not during streaming).
Fields§
§id: Option<String>Task ID
request_id: Option<String>Request ID
created: Option<u64>Request created time, Unix timestamp (seconds)
model: Option<String>Model name
choices: Option<Vec<Choice>>Model response list
usage: Option<Usage>Token usage statistics at the end of the call
video_result: Option<Vec<VideoResultItem>>Video generation results
web_search: Option<Vec<WebSearchInfo>>Information related to web search, returned when using WebSearchToolSchema
content_filter: Option<Vec<ContentFilterInfo>>Content safety related information
task_status: Option<TaskStatus>Processing status of the task. One of: PROCESSING (处理中), SUCCESS (成功), FAIL (失败). Note: When PROCESSING, the final result needs to be retrieved via a subsequent query.
Implementations§
Source§impl ChatCompletionResponse
impl ChatCompletionResponse
Sourcepub fn request_id(&self) -> Option<&str>
pub fn request_id(&self) -> Option<&str>
Request id (normalized to &str).
Sourcepub fn created(&self) -> Option<u64>
pub fn created(&self) -> Option<u64>
Unix timestamp (seconds) at which the request was created.
Sourcepub fn choices(&self) -> Option<&[Choice]>
pub fn choices(&self) -> Option<&[Choice]>
Generated choices (typically one in non-stream mode).
Sourcepub fn video_result(&self) -> Option<&[VideoResultItem]>
pub fn video_result(&self) -> Option<&[VideoResultItem]>
Video generation result items, if any.
Sourcepub fn web_search(&self) -> Option<&[WebSearchInfo]>
pub fn web_search(&self) -> Option<&[WebSearchInfo]>
Web-search citations, if web_search was used.
Sourcepub fn content_filter(&self) -> Option<&[ContentFilterInfo]>
pub fn content_filter(&self) -> Option<&[ContentFilterInfo]>
Content-safety filter results, if any.
Sourcepub fn task_status(&self) -> Option<&TaskStatus>
pub fn task_status(&self) -> Option<&TaskStatus>
Async task status, if this is an async response.
Trait Implementations§
Source§impl Clone for ChatCompletionResponse
impl Clone for ChatCompletionResponse
Source§fn clone(&self) -> ChatCompletionResponse
fn clone(&self) -> ChatCompletionResponse
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more