Skip to main content

async_openai/types/skills/
skill.rs

1use serde::{Deserialize, Serialize};
2
3use crate::types::InputSource;
4
5/// Reference a skill by ID when providing it to a tool or container.
6#[derive(Debug, Deserialize, Serialize, Clone, PartialEq)]
7pub struct SkillReferenceParam {
8    /// The ID of the skill to reference.
9    pub skill_id: String,
10    /// An optional specific version to use.
11    #[serde(skip_serializing_if = "Option::is_none")]
12    pub version: Option<String>,
13}
14
15/// The source for an inline skill (base64-encoded zip archive).
16#[derive(Debug, Deserialize, Serialize, Clone, PartialEq)]
17pub struct InlineSkillSourceParam {
18    /// The media type. Always `"application/zip"`.
19    pub media_type: String,
20    /// The base64-encoded skill data.
21    pub data: String,
22}
23
24/// An inline skill definition provided directly in a request.
25#[derive(Debug, Deserialize, Serialize, Clone, PartialEq)]
26pub struct InlineSkillParam {
27    /// The name of the skill.
28    pub name: String,
29    /// The description of the skill.
30    pub description: String,
31    /// The inline source for the skill.
32    pub source: InlineSkillSourceParam,
33}
34
35/// Represents a skill object.
36#[derive(Debug, Deserialize, Serialize, Clone, PartialEq)]
37pub struct SkillResource {
38    /// Unique identifier for the skill.
39    pub id: String,
40    /// The object type, which is always `skill`.
41    pub object: String,
42    /// Name of the skill.
43    pub name: String,
44    /// Description of the skill.
45    pub description: String,
46    /// Unix timestamp (in seconds) for when the skill was created.
47    pub created_at: u64,
48    /// Default version for the skill.
49    pub default_version: String,
50    /// Latest version for the skill.
51    pub latest_version: String,
52}
53
54/// List of skills.
55#[derive(Debug, Deserialize, Serialize, Clone, PartialEq)]
56pub struct SkillListResource {
57    /// The object type, which is always `list`.
58    pub object: String,
59    /// A list of skill objects.
60    pub data: Vec<SkillResource>,
61    /// The ID of the first item in the list.
62    pub first_id: Option<String>,
63    /// The ID of the last item in the list.
64    pub last_id: Option<String>,
65    /// Whether there are more items available.
66    pub has_more: bool,
67}
68
69/// Request to create a skill by uploading files.
70#[derive(Debug, Default, Clone, PartialEq)]
71pub struct CreateSkillRequest {
72    /// Skill files to upload (directory upload) or a single zip file.
73    pub files: Vec<InputSource>,
74}
75
76/// Request to update the default version pointer for a skill.
77#[derive(Debug, Clone, PartialEq, Serialize)]
78pub struct SetDefaultSkillVersionRequest {
79    /// The skill version number to set as default.
80    pub default_version: String,
81}
82
83/// Confirmation of skill deletion.
84#[derive(Debug, Deserialize, Serialize, Clone, PartialEq)]
85pub struct DeletedSkillResource {
86    /// The object type, which is always `skill.deleted`.
87    pub object: String,
88    /// Whether the skill was deleted.
89    pub deleted: bool,
90    /// The skill ID.
91    pub id: String,
92}
93
94/// Represents a skill version object.
95#[derive(Debug, Deserialize, Serialize, Clone, PartialEq)]
96pub struct SkillVersionResource {
97    /// The object type, which is always `skill.version`.
98    pub object: String,
99    /// Unique identifier for the skill version.
100    pub id: String,
101    /// Identifier of the skill for this version.
102    pub skill_id: String,
103    /// Version number for this skill.
104    pub version: String,
105    /// Unix timestamp (in seconds) for when the skill version was created.
106    pub created_at: u64,
107    /// Name of the skill version.
108    pub name: String,
109    /// Description of the skill version.
110    pub description: String,
111}
112
113/// List of skill versions.
114#[derive(Debug, Deserialize, Serialize, Clone, PartialEq)]
115pub struct SkillVersionListResource {
116    /// The object type, which is always `list`.
117    pub object: String,
118    /// A list of skill version objects.
119    pub data: Vec<SkillVersionResource>,
120    /// The ID of the first item in the list.
121    pub first_id: Option<String>,
122    /// The ID of the last item in the list.
123    pub last_id: Option<String>,
124    /// Whether there are more items available.
125    pub has_more: bool,
126}
127
128/// Request to create a new skill version by uploading files.
129#[derive(Debug, Default, Clone, PartialEq)]
130pub struct CreateSkillVersionRequest {
131    /// Skill files to upload (directory upload) or a single zip file.
132    pub files: Vec<InputSource>,
133    /// Whether to set this version as the default.
134    pub default: Option<bool>,
135}
136
137/// Confirmation of skill version deletion.
138#[derive(Debug, Deserialize, Serialize, Clone, PartialEq)]
139pub struct DeletedSkillVersionResource {
140    /// The object type, which is always `skill.version.deleted`.
141    pub object: String,
142    /// Whether the skill version was deleted.
143    pub deleted: bool,
144    /// The skill version ID.
145    pub id: String,
146    /// The deleted skill version number.
147    pub version: String,
148}