Skip to main content

objectiveai_sdk/agent/openrouter/
output_mode.rs

1//! Output mode configuration for vector completions.
2//!
3//! The output mode determines how the LLM is constrained to select from
4//! a set of predefined responses during vector completion. This setting
5//! is **only used for vector completions** and is ignored for agent completions.
6
7use serde::{Deserialize, Serialize};
8use schemars::JsonSchema;
9
10/// The method used to constrain LLM output to valid response keys.
11///
12/// In vector completions, the model must select from a predefined set of
13/// responses. This enum controls *how* that constraint is enforced.
14///
15/// **Note:** This setting is only relevant for vector completions and is
16/// completely ignored for agent completions.
17#[derive(Clone, Copy, Debug, Default, Serialize, Deserialize, PartialEq, Hash, JsonSchema, arbitrary::Arbitrary)]
18#[serde(rename_all = "snake_case")]
19#[schemars(rename = "agent.openrouter.OutputMode")]
20pub enum OutputMode {
21    /// The model is instructed via the prompt to output a specific key.
22    ///
23    /// This is the default and most widely supported mode.
24    #[schemars(title = "Instruction")]
25    #[default]
26    Instruction,
27    /// A JSON schema response format is used with an enum of possible keys.
28    ///
29    /// Requires model support for structured JSON output.
30    #[schemars(title = "JsonSchema")]
31    JsonSchema,
32    /// A forced tool call with an argument schema containing possible keys.
33    ///
34    /// Requires model support for tool/function calling.
35    #[schemars(title = "ToolCall")]
36    ToolCall,
37}
38