ds_api/raw/response/non_streaming/
chat_completion_response.rs1use serde::Deserialize;
2
3use super::{choice::Choice, object_type::ObjectType, usage::Usage};
4use crate::raw::Model;
5
6#[derive(Debug, Deserialize)]
7pub struct ChatCompletionResponse {
8 pub id: String,
9 pub choices: Vec<Choice>,
10 pub created: u64,
11 pub model: Model,
12 pub system_fingerprint: String,
13 #[serde(rename = "object")]
14 pub object: ObjectType,
15 pub usage: Usage,
16}
17
18impl ChatCompletionResponse {
19 pub fn content(&self) -> Option<&str> {
20 self.choices.first()?.message.content.as_deref()
21 }
22}