use objectiveai_sdk::cli::command::python::{Request, Response};
use crate::context::Context;
use crate::error::Error;
pub async fn execute(ctx: &Context, request: Request) -> Result<Response, Error> {
let ctx = ctx.with_no_objectiveai(request.no_objectiveai.unwrap_or(false));
let output: Option<serde_json::Value> = ctx
.python()
.await?
.exec_code(&ctx, &request.code, request.input)
.await?;
Ok(output.unwrap_or(serde_json::Value::Null))
}
pub mod request_schema {
use objectiveai_sdk::cli::command::python as sdk;
use objectiveai_sdk::cli::command::python::request_schema::{Request, Response};
use crate::context::Context;
use crate::error::Error;
pub async fn execute(_ctx: &Context, _request: Request) -> Result<Response, Error> {
Ok(objectiveai_sdk::cli::command::ResponseSchema(schemars::schema_for!(sdk::Request)))
}
}
pub mod response_schema {
use objectiveai_sdk::cli::command::python as sdk;
use objectiveai_sdk::cli::command::python::response_schema::{Request, Response};
use crate::context::Context;
use crate::error::Error;
pub async fn execute(_ctx: &Context, _request: Request) -> Result<Response, Error> {
Ok(objectiveai_sdk::cli::command::ResponseSchema(schemars::schema_for!(sdk::Response)))
}
}