Skip to main content

objectiveai_sdk/cli/command/functions/executions/
mod.rs

1pub mod create;
2
3#[derive(clap::Subcommand)]
4pub enum Command {
5    Create {
6        #[command(subcommand)]
7        command: create::Command,
8    },
9}
10
11/// Single-subcommand tier: plain aliases instead of one-variant
12/// wrapper enums. No aggregate schema exists at this level — schema
13/// references pass straight through to the child, and the wire shape
14/// is unchanged (`#[serde(untagged)]` made the wrapper invisible
15/// anyway).
16pub type Request = create::Request;
17pub type ResponseItem = create::ResponseItem;
18
19impl TryFrom<Command> for Request {
20    type Error = crate::cli::command::FromArgsError;
21    fn try_from(command: Command) -> Result<Self, Self::Error> {
22        match command {
23            Command::Create { command } => create::Request::try_from(command),
24        }
25    }
26}
27
28#[cfg(feature = "cli-executor")]
29pub async fn execute<E: crate::cli::command::CommandExecutor>(
30    executor: &E,
31    request: Request,
32    agent_arguments: Option<&crate::cli::command::AgentArguments>,
33) -> Result<
34    std::pin::Pin<Box<dyn futures::Stream<Item = Result<ResponseItem, E::Error>> + Send>>,
35    E::Error,
36> {
37    create::execute(executor, request, agent_arguments).await
38}
39
40#[cfg(feature = "cli-executor")]
41pub async fn execute_jq<E: crate::cli::command::CommandExecutor>(
42    executor: &E,
43    request: Request,
44    jq: String,
45    agent_arguments: Option<&crate::cli::command::AgentArguments>,
46) -> Result<
47    std::pin::Pin<Box<dyn futures::Stream<Item = Result<serde_json::Value, E::Error>> + Send>>,
48    E::Error,
49> {
50    create::execute_jq(executor, request, jq, agent_arguments).await
51}