Skip to main content

llama_cpp_bindings/openai/
openai_chat_template_params.rs

1/// Parameters for applying OpenAI-compatible chat templates.
2// This struct mirrors the OpenAI API flags which are inherently boolean.
3#[allow(clippy::struct_excessive_bools)]
4#[derive(Debug, Clone, PartialEq, Eq)]
5pub struct OpenAIChatTemplateParams<'params> {
6    /// OpenAI-compatible messages JSON array.
7    pub messages_json: &'params str,
8    /// Optional OpenAI-compatible tools JSON array.
9    pub tools_json: Option<&'params str>,
10    /// Optional tool choice string.
11    pub tool_choice: Option<&'params str>,
12    /// Optional JSON schema string for tool grammar generation.
13    pub json_schema: Option<&'params str>,
14    /// Optional custom grammar string.
15    pub grammar: Option<&'params str>,
16    /// Optional reasoning format string.
17    pub reasoning_format: Option<&'params str>,
18    /// Optional chat template kwargs JSON object.
19    pub chat_template_kwargs: Option<&'params str>,
20    /// Whether to add the assistant generation prompt.
21    pub add_generation_prompt: bool,
22    /// Whether to render templates with Jinja.
23    pub use_jinja: bool,
24    /// Whether to allow parallel tool calls.
25    pub parallel_tool_calls: bool,
26    /// Whether thinking blocks are enabled.
27    pub enable_thinking: bool,
28    /// Whether to add BOS.
29    pub add_bos: bool,
30    /// Whether to add EOS.
31    pub add_eos: bool,
32    /// Whether to parse tool calls in responses.
33    pub parse_tool_calls: bool,
34}