pub struct ChatCompletionsRequest {Show 28 fields
pub model: String,
pub messages: Vec<ChatMessage>,
pub max_tokens: Option<u32>,
pub max_completion_tokens: Option<u32>,
pub temperature: Option<f32>,
pub top_p: Option<f32>,
pub top_k: Option<i64>,
pub min_p: Option<f32>,
pub repetition_penalty: Option<f32>,
pub n: Option<u32>,
pub stream: Option<bool>,
pub ignore_eos: Option<bool>,
pub stop: Option<Vec<String>>,
pub presence_penalty: Option<f32>,
pub frequency_penalty: Option<f32>,
pub logit_bias: Option<HashMap<String, f32>>,
pub logprobs: Option<bool>,
pub top_logprobs: Option<u32>,
pub user: Option<String>,
pub seed: Option<u64>,
pub response_format: Option<OpenAiResponseFormat>,
pub tools: Option<Vec<ChatTool>>,
pub tool_choice: Option<ToolChoice>,
pub stream_options: Option<StreamOptions>,
pub functions: Option<Vec<ChatFunction>>,
pub function_call: Option<FunctionCallChoice>,
pub metadata: Option<HashMap<String, Value>>,
pub chat_template_kwargs: Option<HashMap<String, Value>>,
}Expand description
Chat completions request (OpenAI compatible)
Fields§
§model: StringModel to use for completion
messages: Vec<ChatMessage>List of messages
max_tokens: Option<u32>Maximum number of tokens to generate
max_completion_tokens: Option<u32>Newer OpenAI chat field replacing max_tokens for completion budget.
When both are supplied, Ferrum uses this value.
temperature: Option<f32>Temperature for sampling
top_p: Option<f32>Top-p for nucleus sampling
top_k: Option<i64>vLLM-compatible top-k sampling extension. Values -1 and 0
disable top-k filtering.
min_p: Option<f32>vLLM-compatible minimum probability sampling extension. A value of
0 disables minimum-probability filtering.
repetition_penalty: Option<f32>vLLM-compatible repetition penalty extension.
n: Option<u32>Number of completions to generate
stream: Option<bool>Whether to stream responses
ignore_eos: Option<bool>vLLM-compatible extension for benchmark/throughput workloads. When true, Ferrum ignores model EOS tokens and stops only on the requested token budget or explicit user stop sequences.
stop: Option<Vec<String>>Stop sequences
presence_penalty: Option<f32>Presence penalty
frequency_penalty: Option<f32>Frequency penalty
logit_bias: Option<HashMap<String, f32>>Logit bias
logprobs: Option<bool>Return log probabilities. Ferrum rejects this until implemented so clients get an explicit OpenAI-style error instead of silent ignore.
top_logprobs: Option<u32>Number of top log probabilities to return.
user: Option<String>User identifier
seed: Option<u64>Random seed
response_format: Option<OpenAiResponseFormat>Response format constraint (e.g., {"type": "json_object"})
tools: Option<Vec<ChatTool>>OpenAI tool definitions. Function tools are parsed, carried through structured request data, and can shape model-emitted tool-call JSON. Tool execution itself stays caller-owned.
tool_choice: Option<ToolChoice>OpenAI tool selection policy.
stream_options: Option<StreamOptions>Streaming response options.
functions: Option<Vec<ChatFunction>>Legacy OpenAI functions compatibility.
function_call: Option<FunctionCallChoice>Legacy OpenAI function-call selector.
metadata: Option<HashMap<String, Value>>Ferrum extension metadata. Used for opt-in product features such as
metadata.ferrum_session_id when callers prefer body metadata over
the X-Ferrum-Session header.
chat_template_kwargs: Option<HashMap<String, Value>>vLLM-compatible chat-template variables. Ferrum forwards supported values to the model-provided chat template; templates that do not read a variable are unaffected.
Trait Implementations§
Source§impl Clone for ChatCompletionsRequest
impl Clone for ChatCompletionsRequest
Source§fn clone(&self) -> ChatCompletionsRequest
fn clone(&self) -> ChatCompletionsRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more