Skip to main content

objectiveai_sdk/functions/executions/request/
body.rs

1use crate::{agent, functions};
2use schemars::JsonSchema;
3use serde::{Deserialize, Serialize};
4
5/// Parameters for creating a function execution.
6#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
7#[schemars(
8    rename = "functions.executions.request.FunctionExecutionCreateParams"
9)]
10pub struct FunctionExecutionCreateParams {
11    /// The function to execute (inline definition or remote path).
12    pub function: functions::FullInlineFunctionOrRemoteCommitOptional,
13    /// The profile to use (inline definition or remote path).
14    pub profile: functions::InlineProfileOrRemoteCommitOptional,
15
16    // --- Reasoning configuration ---
17    #[serde(skip_serializing_if = "Option::is_none")]
18    #[schemars(extend("omitempty" = true))]
19    pub reasoning: Option<super::Reasoning>,
20
21    // --- Core configuration ---
22    #[serde(skip_serializing_if = "Option::is_none")]
23    #[schemars(extend("omitempty" = true))]
24    pub strategy: Option<super::Strategy>,
25    pub input: functions::expression::InputValue,
26    #[serde(skip_serializing_if = "Option::is_none")]
27    #[schemars(extend("omitempty" = true))]
28    pub split: Option<bool>,
29    /// If `true`, invert every output in the streamed response *after* the
30    /// inner function has finished computing — scalar outputs become
31    /// `1 - x`, vector outputs are reversed in place. The expression
32    /// evaluator inside the function still sees the original scores; only
33    /// the chunks delivered to the client (and the aggregated response
34    /// passed to the usage handler) are inverted. Useful when a function
35    /// is naturally written to score "lower is better" but the consumer
36    /// wants "higher is better", or vice versa.
37    #[serde(skip_serializing_if = "Option::is_none")]
38    #[schemars(extend("omitempty" = true))]
39    pub invert: Option<bool>,
40    #[serde(skip_serializing_if = "Option::is_none")]
41    #[schemars(extend("omitempty" = true))]
42    pub provider: Option<agent::completions::request::Provider>,
43    #[serde(skip_serializing_if = "Option::is_none")]
44    #[schemars(extend("omitempty" = true))]
45    pub seed: Option<i64>,
46    #[serde(skip_serializing_if = "Option::is_none")]
47    #[schemars(extend("omitempty" = true))]
48    pub stream: Option<bool>,
49    /// Continuation from a previous completion, as a base64-encoded string.
50    #[serde(skip_serializing_if = "Option::is_none")]
51    #[schemars(extend("omitempty" = true))]
52    pub continuation: Option<String>,
53}
54