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 schemars::JsonSchema;
8use serde::{Deserialize, Serialize};
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(
18    Clone,
19    Copy,
20    Debug,
21    Default,
22    Serialize,
23    Deserialize,
24    PartialEq,
25    Hash,
26    JsonSchema,
27    arbitrary::Arbitrary,
28)]
29#[serde(rename_all = "snake_case")]
30#[schemars(rename = "agent.openrouter.OutputMode")]
31pub enum OutputMode {
32    /// The model is instructed via the prompt to output a specific key.
33    ///
34    /// This is the default and most widely supported mode.
35    #[schemars(title = "Instruction")]
36    #[default]
37    Instruction,
38    /// A JSON schema response format is used with an enum of possible keys.
39    ///
40    /// Requires model support for structured JSON output.
41    #[schemars(title = "JsonSchema")]
42    JsonSchema,
43    /// A forced tool call with an argument schema containing possible keys.
44    ///
45    /// Requires model support for tool/function calling.
46    #[schemars(title = "ToolCall")]
47    ToolCall,
48}