#[non_exhaustive]pub enum OutputFormat {
Json,
JsonSchema {
name: Option<String>,
schema: Value,
strict: Option<bool>,
},
}Expand description
A PORTABLE structured-output intent — one canonical knob every structured-output-
capable dialect spells differently, lifted out of extra so each adapter owns its
projection (the same rule as ToolChoice/reasoning). Internally tagged on type
({"type":"json"} / {"type":"json_schema",...}), so it rides the wire and config
the same way. name/strict feed only the dialects whose wire has them (OpenAI);
Anthropic/Google/Ollama read only schema (providers.md §6).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Json
Plain JSON mode: valid JSON with no schema. OpenAI json_object, Google
responseMimeType alone, Ollama format:"json"; Anthropic has no schemaless
mode → a documented narrowing (omit, providers.md §6).
JsonSchema
JSON constrained to schema. name labels the schema where the dialect
requires one (OpenAI); strict toggles strict adherence where the wire has it.
Trait Implementations§
Source§impl Clone for OutputFormat
impl Clone for OutputFormat
Source§fn clone(&self) -> OutputFormat
fn clone(&self) -> OutputFormat
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more