Skip to main content

outfox_openai/spec/shared/
custom_grammar_format_param.rs

1use derive_builder::Builder;
2use serde::{Deserialize, Serialize};
3
4use crate::error::OpenAIError;
5
6#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
7#[serde(rename_all = "lowercase")]
8pub enum GrammarSyntax {
9    Lark,
10    #[default]
11    Regex,
12}
13
14#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default, Builder)]
15#[builder(build_fn(error = "OpenAIError"))]
16pub struct CustomGrammarFormatParam {
17    /// The grammar definition.
18    pub definition: String,
19    /// The syntax of the grammar definition. One of `lark` or `regex`.
20    pub syntax: GrammarSyntax,
21}