Skip to main content

openai_tools/models/
response.rs

1//! OpenAI Models API Response Types
2//!
3//! This module defines the response structures for the OpenAI Models API.
4
5use serde::{Deserialize, Serialize};
6
7/// Response structure for listing all available models.
8///
9/// Contains a list of model objects that are currently available.
10#[derive(Debug, Clone, Serialize, Deserialize)]
11pub struct ModelsListResponse {
12    /// Object type, always "list"
13    pub object: String,
14    /// Array of model objects
15    pub data: Vec<Model>,
16}
17
18/// Represents an OpenAI model.
19///
20/// Contains basic information about a model including its ID, creation time,
21/// and ownership details.
22#[derive(Debug, Clone, Serialize, Deserialize)]
23pub struct Model {
24    /// The model identifier, which can be referenced in the API endpoints
25    pub id: String,
26    /// Object type, always "model"
27    pub object: String,
28    /// Unix timestamp (in seconds) when the model was created
29    pub created: i64,
30    /// The organization that owns the model
31    pub owned_by: String,
32}
33
34/// Response structure for model deletion.
35///
36/// Returned when a fine-tuned model is successfully deleted.
37#[derive(Debug, Clone, Serialize, Deserialize)]
38pub struct DeleteResponse {
39    /// The model identifier that was deleted
40    pub id: String,
41    /// Object type, always "model"
42    pub object: String,
43    /// Whether the model was successfully deleted
44    pub deleted: bool,
45}