ds-api 0.10.7

A Rust client library for the DeepSeek API with support for chat completions, streaming, and tools
Documentation
use serde::Deserialize;

use super::{choice::Choice, object_type::ObjectType, usage::Usage};
use crate::raw::Model;

#[derive(Debug, Deserialize)]
pub struct ChatCompletionResponse {
    pub id: String,
    pub choices: Vec<Choice>,
    pub created: u64,
    pub model: Model,
    #[serde(default)]
    pub system_fingerprint: Option<String>,
    #[serde(rename = "object")]
    pub object: ObjectType,
    pub usage: Usage,
}

impl ChatCompletionResponse {
    pub fn content(&self) -> Option<&str> {
        self.choices.first()?.message.content.as_deref()
    }
}