Skip to main content

objectiveai_sdk/functions/executions/request/
body.rs

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