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    // --- Caching and retry options ---
17    #[serde(skip_serializing_if = "Option::is_none")]
18    #[schemars(extend("omitempty" = true))]
19    pub retry_token: Option<String>,
20    #[serde(skip_serializing_if = "Option::is_none")]
21    #[schemars(extend("omitempty" = true))]
22    pub from_cache: Option<bool>,
23
24    // --- Reasoning configuration ---
25    #[serde(skip_serializing_if = "Option::is_none")]
26    #[schemars(extend("omitempty" = true))]
27    pub reasoning: Option<super::Reasoning>,
28
29    // --- Core configuration ---
30    #[serde(skip_serializing_if = "Option::is_none")]
31    #[schemars(extend("omitempty" = true))]
32    pub strategy: Option<super::Strategy>,
33    pub input: functions::expression::InputValue,
34    #[serde(skip_serializing_if = "Option::is_none")]
35    #[schemars(extend("omitempty" = true))]
36    pub split: Option<bool>,
37    /// If `true`, invert every output in the streamed response *after* the
38    /// inner function has finished computing — scalar outputs become
39    /// `1 - x`, vector outputs are reversed in place. The expression
40    /// evaluator inside the function still sees the original scores; only
41    /// the chunks delivered to the client (and the aggregated response
42    /// passed to the usage handler) are inverted. Useful when a function
43    /// is naturally written to score "lower is better" but the consumer
44    /// wants "higher is better", or vice versa.
45    #[serde(skip_serializing_if = "Option::is_none")]
46    #[schemars(extend("omitempty" = true))]
47    pub invert: Option<bool>,
48    #[serde(skip_serializing_if = "Option::is_none")]
49    #[schemars(extend("omitempty" = true))]
50    pub provider: Option<agent::completions::request::Provider>,
51    #[serde(skip_serializing_if = "Option::is_none")]
52    #[schemars(extend("omitempty" = true))]
53    pub seed: Option<i64>,
54    #[serde(skip_serializing_if = "Option::is_none")]
55    #[schemars(extend("omitempty" = true))]
56    pub stream: Option<bool>,
57    /// Continuation from a previous completion, as a base64-encoded string.
58    #[serde(skip_serializing_if = "Option::is_none")]
59    #[schemars(extend("omitempty" = true))]
60    pub continuation: Option<String>,
61}
62