#[non_exhaustive]pub enum OutputSpec {
FreeText,
Json {
schema: Value,
name: String,
strict: bool,
},
ToolCalls,
}Expand description
The shape the answer must have (spec §20.3, §20.4).
Json is what a critical stage asks for. Whether the provider enforces
the schema on the wire or only sees it in a prompt is the difference between
StructuredOutputCapability::NativeJsonSchema
and
PromptOnly;
the router refuses to serve an understanding task with the
latter, and the adapter must never pretend otherwise.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
FreeText
Prose, for a request that needs no document back.
Json
A single JSON document matching schema.
Fields
schema: ValueThe JSON Schema the answer must satisfy. Also the schema
parse_structured validates
against, so it is never merely decorative.
strict: boolWhether the provider must reject non-conforming output rather than
producing a best effort. Adapters that cannot honour strict must
declare a weaker
StructuredOutputCapability.
ToolCalls
One or more tool calls, taken as the answer.
Implementations§
Source§impl OutputSpec
impl OutputSpec
Sourcepub const fn is_structured(&self) -> bool
pub const fn is_structured(&self) -> bool
Returns true when the answer is expected to be JSON.
Trait Implementations§
Source§impl Clone for OutputSpec
impl Clone for OutputSpec
Source§impl Debug for OutputSpec
impl Debug for OutputSpec
Source§impl<'de> Deserialize<'de> for OutputSpec
impl<'de> Deserialize<'de> for OutputSpec
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for OutputSpec
Source§impl PartialEq for OutputSpec
impl PartialEq for OutputSpec
Source§impl Serialize for OutputSpec
impl Serialize for OutputSpec
impl StructuralPartialEq for OutputSpec
Auto Trait Implementations§
impl Freeze for OutputSpec
impl RefUnwindSafe for OutputSpec
impl Send for OutputSpec
impl Sync for OutputSpec
impl Unpin for OutputSpec
impl UnsafeUnpin for OutputSpec
impl UnwindSafe for OutputSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.