objectiveai_sdk/functions/
profile.rs1use schemars::JsonSchema;
8use serde::{Deserialize, Serialize};
9
10#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
13#[serde(untagged)]
14#[schemars(rename = "functions.InlineProfileOrRemoteCommitOptional")]
15pub enum InlineProfileOrRemoteCommitOptional {
16 #[schemars(title = "Inline")]
17 Inline(InlineProfile),
18 #[schemars(title = "Remote")]
19 Remote(crate::RemotePathCommitOptional),
20}
21
22#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
27#[serde(untagged)]
28#[schemars(rename = "functions.Profile")]
29pub enum Profile {
30 #[schemars(title = "Remote")]
32 Remote(RemoteProfile),
33 #[schemars(title = "Inline")]
35 Inline(InlineProfile),
36}
37
38#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
40#[serde(untagged)]
41#[schemars(rename = "functions.RemoteProfile")]
42pub enum RemoteProfile {
43 #[schemars(title = "Tasks")]
45 Tasks(RemoteTasksProfile),
46 #[schemars(title = "Auto")]
48 Auto(crate::swarm::RemoteSwarmBase),
49}
50
51#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
53#[serde(untagged)]
54#[schemars(rename = "functions.InlineProfile")]
55pub enum InlineProfile {
56 #[schemars(title = "Tasks")]
58 Tasks(InlineTasksProfile),
59 #[schemars(title = "Auto")]
61 Auto(crate::swarm::InlineSwarmBase),
62}
63
64impl<'a> arbitrary::Arbitrary<'a> for InlineProfile {
65 fn arbitrary(
66 u: &mut arbitrary::Unstructured<'a>,
67 ) -> arbitrary::Result<Self> {
68 Ok(InlineProfile::Tasks(u.arbitrary()?))
71 }
72}
73
74#[derive(
76 Debug,
77 Clone,
78 PartialEq,
79 Serialize,
80 Deserialize,
81 JsonSchema,
82 arbitrary::Arbitrary,
83)]
84#[schemars(rename = "functions.InlineTasksProfile")]
85pub struct InlineTasksProfile {
86 pub tasks: Vec<TaskProfile>,
88 #[serde(skip_serializing_if = "Option::is_none")]
91 #[schemars(extend("omitempty" = true))]
92 pub weights: Option<crate::Weights>,
93}
94
95#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
100#[schemars(rename = "functions.RemoteTasksProfile")]
101pub struct RemoteTasksProfile {
102 pub description: String,
104 #[serde(flatten)]
105 #[schemars(schema_with = "crate::flatten_schema::<InlineTasksProfile>")]
106 pub inner: InlineTasksProfile,
107}
108
109#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
113#[serde(untagged)]
114#[schemars(rename = "functions.TaskProfile")]
115pub enum TaskProfile {
116 #[schemars(title = "Remote")]
118 Remote(crate::RemotePath),
119 #[schemars(title = "Inline")]
121 Inline(InlineProfile),
122 #[schemars(title = "Placeholder")]
124 Placeholder {},
125}
126
127impl<'a> arbitrary::Arbitrary<'a> for TaskProfile {
128 fn arbitrary(
129 u: &mut arbitrary::Unstructured<'a>,
130 ) -> arbitrary::Result<Self> {
131 if u.arbitrary().unwrap_or(false) {
134 Ok(TaskProfile::Inline(u.arbitrary()?))
135 } else if u.arbitrary().unwrap_or(false) {
136 Ok(TaskProfile::Remote(u.arbitrary()?))
137 } else {
138 Ok(TaskProfile::Placeholder {})
139 }
140 }
141}