feat: implement models endpoint
This commit is contained in:
43
src/openai/models.rs
Normal file
43
src/openai/models.rs
Normal file
@@ -0,0 +1,43 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// The object type, which is always "model".
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum ModelObject {
|
||||
Model,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct Model<Id> {
|
||||
/// The model identifier, which can be referenced in the API endpoints.
|
||||
pub id: Id,
|
||||
|
||||
/// The Unix timestamp (in seconds) when the model was created.
|
||||
pub created: i64,
|
||||
|
||||
/// The object type, which is always "model".
|
||||
pub object: ModelObject,
|
||||
|
||||
/// The organization that owns the model.
|
||||
pub owned_by: String,
|
||||
|
||||
/// The date when the model will shut down, or null if not announced.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub shutdown_date: Option<String>,
|
||||
}
|
||||
|
||||
/// The object type, which is always "list".
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum ListObject {
|
||||
List,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct ListModelsResponse<Id> {
|
||||
/// The list of currently available models.
|
||||
pub data: Vec<Model<Id>>,
|
||||
|
||||
/// The object type, which is always "list".
|
||||
pub object: ListObject,
|
||||
}
|
||||
Reference in New Issue
Block a user