pub enum Grammar {
JsonSchema {
json_schema: Value,
label: Option<String>,
strict: Option<bool>,
},
Regex {
regex: String,
label: Option<String>,
strict: Option<bool>,
},
Ebnf {
ebnf: String,
label: Option<String>,
strict: Option<bool>,
},
}Expand description
A constraint on the shape of the generated text.
Exactly one of the three forms applies; the enum makes that structural rather than a runtime check.
Variants§
JsonSchema
Output must validate against this JSON schema.
Regex
Output must match this regular expression.
Ebnf
Output must parse under this EBNF grammar.
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Grammar
impl<'de> Deserialize<'de> for Grammar
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>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Grammar
Auto Trait Implementations§
impl Freeze for Grammar
impl RefUnwindSafe for Grammar
impl Send for Grammar
impl Sync for Grammar
impl Unpin for Grammar
impl UnsafeUnpin for Grammar
impl UnwindSafe for Grammar
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
Mutably borrows from an owned value. Read more