use clap::Subcommand;
#[derive(Subcommand)]
#[command(rename_all = "verbatim")]
pub enum GetCommand {
#[command(name = "get")]
Get,
}
#[derive(Subcommand)]
#[command(rename_all = "verbatim")]
pub enum Commands {
#[command(name = "list")]
List,
FunctionExecutionChunk {
#[command(subcommand)]
command: GetCommand,
},
FunctionExecutionTaskChunk {
#[command(subcommand)]
command: GetCommand,
},
Object {
#[command(subcommand)]
command: GetCommand,
},
ReasoningSummaryChunk {
#[command(subcommand)]
command: GetCommand,
},
TaskChunk {
#[command(subcommand)]
command: GetCommand,
},
VectorCompletionTaskChunk {
#[command(subcommand)]
command: GetCommand,
},
}
impl Commands {
pub async fn handle(self, handle: &objectiveai_cli_sdk::output::Handle) -> Result<(), crate::error::Error> {
match self {
Commands::List => {
const NAMES: &[&str] = &["FunctionExecutionChunk", "FunctionExecutionTaskChunk", "Object", "ReasoningSummaryChunk", "TaskChunk", "VectorCompletionTaskChunk"];
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schemas>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schemas {
schemas: NAMES.iter().map(|s| s.to_string()).collect(),
},
},
).emit(handle).await;
Ok(())
}
Commands::FunctionExecutionChunk { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../../../../objectiveai-json-schema/functions.executions.response.streaming.FunctionExecutionChunk.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::FunctionExecutionTaskChunk { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../../../../objectiveai-json-schema/functions.executions.response.streaming.FunctionExecutionTaskChunk.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::Object { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../../../../objectiveai-json-schema/functions.executions.response.streaming.Object.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::ReasoningSummaryChunk { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../../../../objectiveai-json-schema/functions.executions.response.streaming.ReasoningSummaryChunk.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::TaskChunk { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../../../../objectiveai-json-schema/functions.executions.response.streaming.TaskChunk.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
Commands::VectorCompletionTaskChunk { .. } => {
let schema: serde_json::Value = serde_json::from_str(
include_str!("../../../../../../../objectiveai-json-schema/functions.executions.response.streaming.VectorCompletionTaskChunk.json"),
).expect("embedded JSON Schema must parse");
objectiveai_cli_sdk::output::Output::<objectiveai_cli_sdk::output::Schema>::Notification(
objectiveai_cli_sdk::output::Notification {
value: objectiveai_cli_sdk::output::Schema { schema },
},
).emit(handle).await;
Ok(())
}
}
}
}