objectiveai_sdk/functions/
profile.rs1use serde::{Deserialize, Serialize};
8use schemars::JsonSchema;
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(u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result<Self> {
66 Ok(InlineProfile::Tasks(u.arbitrary()?))
69 }
70}
71
72#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, arbitrary::Arbitrary)]
74#[schemars(rename = "functions.InlineTasksProfile")]
75pub struct InlineTasksProfile {
76 pub tasks: Vec<TaskProfile>,
78 #[serde(skip_serializing_if = "Option::is_none")]
81 #[schemars(extend("omitempty" = true))]
82 pub weights: Option<crate::Weights>,
83}
84
85#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
90#[schemars(rename = "functions.RemoteTasksProfile")]
91pub struct RemoteTasksProfile {
92 pub description: String,
94 #[serde(flatten)]
95 #[schemars(schema_with = "crate::flatten_schema::<InlineTasksProfile>")]
96 pub inner: InlineTasksProfile,
97}
98
99#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
103#[serde(untagged)]
104#[schemars(rename = "functions.TaskProfile")]
105pub enum TaskProfile {
106 #[schemars(title = "Remote")]
108 Remote(crate::RemotePath),
109 #[schemars(title = "Inline")]
111 Inline(InlineProfile),
112 #[schemars(title = "Placeholder")]
114 Placeholder {},
115}
116
117impl<'a> arbitrary::Arbitrary<'a> for TaskProfile {
118 fn arbitrary(u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result<Self> {
119 if u.arbitrary().unwrap_or(false) {
122 Ok(TaskProfile::Inline(u.arbitrary()?))
123 } else if u.arbitrary().unwrap_or(false) {
124 Ok(TaskProfile::Remote(u.arbitrary()?))
125 } else {
126 Ok(TaskProfile::Placeholder {})
127 }
128 }
129}