objectiveai-cli 2.0.5

ObjectiveAI command-line interface and embeddable library
// THIS FILE IS AUTO-GENERATED. DO NOT EDIT.
// Generated by objectiveai-cli-builder from objectiveai-json-schema/.

pub mod streaming;
pub mod unary;

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,
    #[command(name = "streaming")]
    Streaming {
        #[command(subcommand)]
        command: streaming::Commands,
    },
    #[command(name = "unary")]
    Unary {
        #[command(subcommand)]
        command: unary::Commands,
    },
    AssistantRole {
        #[command(subcommand)]
        command: GetCommand,
    },
    CompletionTokensDetails {
        #[command(subcommand)]
        command: GetCommand,
    },
    CostDetails {
        #[command(subcommand)]
        command: GetCommand,
    },
    FinishReason {
        #[command(subcommand)]
        command: GetCommand,
    },
    Logprob {
        #[command(subcommand)]
        command: GetCommand,
    },
    Logprobs {
        #[command(subcommand)]
        command: GetCommand,
    },
    PromptTokensDetails {
        #[command(subcommand)]
        command: GetCommand,
    },
    ToolResponse {
        #[command(subcommand)]
        command: GetCommand,
    },
    ToolRole {
        #[command(subcommand)]
        command: GetCommand,
    },
    TopLogprob {
        #[command(subcommand)]
        command: GetCommand,
    },
    UpstreamUsage {
        #[command(subcommand)]
        command: GetCommand,
    },
    Usage {
        #[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] = &["streaming", "unary", "AssistantRole", "CompletionTokensDetails", "CostDetails", "FinishReason", "Logprob", "Logprobs", "PromptTokensDetails", "ToolResponse", "ToolRole", "TopLogprob", "UpstreamUsage", "Usage"];
                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::Streaming { command } => command.handle(handle).await,
            Commands::Unary { command } => command.handle(handle).await,
            Commands::AssistantRole { .. } => {
                let schema: serde_json::Value = serde_json::from_str(
                    include_str!("../../../../../../objectiveai-json-schema/agent.completions.response.AssistantRole.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::CompletionTokensDetails { .. } => {
                let schema: serde_json::Value = serde_json::from_str(
                    include_str!("../../../../../../objectiveai-json-schema/agent.completions.response.CompletionTokensDetails.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::CostDetails { .. } => {
                let schema: serde_json::Value = serde_json::from_str(
                    include_str!("../../../../../../objectiveai-json-schema/agent.completions.response.CostDetails.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::FinishReason { .. } => {
                let schema: serde_json::Value = serde_json::from_str(
                    include_str!("../../../../../../objectiveai-json-schema/agent.completions.response.FinishReason.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::Logprob { .. } => {
                let schema: serde_json::Value = serde_json::from_str(
                    include_str!("../../../../../../objectiveai-json-schema/agent.completions.response.Logprob.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::Logprobs { .. } => {
                let schema: serde_json::Value = serde_json::from_str(
                    include_str!("../../../../../../objectiveai-json-schema/agent.completions.response.Logprobs.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::PromptTokensDetails { .. } => {
                let schema: serde_json::Value = serde_json::from_str(
                    include_str!("../../../../../../objectiveai-json-schema/agent.completions.response.PromptTokensDetails.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::ToolResponse { .. } => {
                let schema: serde_json::Value = serde_json::from_str(
                    include_str!("../../../../../../objectiveai-json-schema/agent.completions.response.ToolResponse.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::ToolRole { .. } => {
                let schema: serde_json::Value = serde_json::from_str(
                    include_str!("../../../../../../objectiveai-json-schema/agent.completions.response.ToolRole.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::TopLogprob { .. } => {
                let schema: serde_json::Value = serde_json::from_str(
                    include_str!("../../../../../../objectiveai-json-schema/agent.completions.response.TopLogprob.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::UpstreamUsage { .. } => {
                let schema: serde_json::Value = serde_json::from_str(
                    include_str!("../../../../../../objectiveai-json-schema/agent.completions.response.UpstreamUsage.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::Usage { .. } => {
                let schema: serde_json::Value = serde_json::from_str(
                    include_str!("../../../../../../objectiveai-json-schema/agent.completions.response.Usage.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(())
            }
        }
    }
}