pub struct CompletionOptions {Show 19 fields
pub api_key: Option<String>,
pub api_base: Option<String>,
pub tools: Option<Vec<Tool>>,
pub tool_choice: Option<ToolChoice>,
pub temperature: Option<f32>,
pub top_p: Option<f32>,
pub max_tokens: Option<u32>,
pub n: Option<u32>,
pub stop: Option<StopSequence>,
pub presence_penalty: Option<f32>,
pub frequency_penalty: Option<f32>,
pub seed: Option<i64>,
pub user: Option<String>,
pub parallel_tool_calls: Option<bool>,
pub logprobs: Option<bool>,
pub top_logprobs: Option<u32>,
pub logit_bias: Option<HashMap<String, f32>>,
pub response_format: Option<Value>,
pub reasoning_effort: Option<ReasoningEffort>,
}Expand description
Options for completion requests.
Fields§
§api_key: Option<String>API key (if not set, uses environment variable).
api_base: Option<String>API base URL (for custom endpoints/proxies).
tools: Option<Vec<Tool>>Tools available to the model.
tool_choice: Option<ToolChoice>How the model should choose which tool to use.
temperature: Option<f32>Sampling temperature (0.0 to 2.0).
top_p: Option<f32>Nucleus sampling parameter.
max_tokens: Option<u32>Maximum tokens to generate.
n: Option<u32>Number of completions to generate.
stop: Option<StopSequence>Stop sequences.
presence_penalty: Option<f32>Presence penalty (-2.0 to 2.0).
frequency_penalty: Option<f32>Frequency penalty (-2.0 to 2.0).
seed: Option<i64>Random seed for reproducibility.
user: Option<String>User identifier for abuse detection.
parallel_tool_calls: Option<bool>Whether to allow parallel tool calls.
logprobs: Option<bool>Whether to return log probabilities.
top_logprobs: Option<u32>Number of top log probabilities to return.
logit_bias: Option<HashMap<String, f32>>Logit bias for specific tokens.
response_format: Option<Value>Response format (e.g., JSON mode).
reasoning_effort: Option<ReasoningEffort>Reasoning effort for models that support extended thinking.
Implementations§
Source§impl CompletionOptions
impl CompletionOptions
Sourcepub fn with_api_key(api_key: impl Into<String>) -> Self
pub fn with_api_key(api_key: impl Into<String>) -> Self
Create new options with an API key.
Sourcepub fn temperature(self, temperature: f32) -> Self
pub fn temperature(self, temperature: f32) -> Self
Set the temperature.
Sourcepub fn max_tokens(self, max_tokens: u32) -> Self
pub fn max_tokens(self, max_tokens: u32) -> Self
Set the max tokens.
Sourcepub fn tool_choice(self, tool_choice: ToolChoice) -> Self
pub fn tool_choice(self, tool_choice: ToolChoice) -> Self
Set the tool choice.
Sourcepub fn reasoning_effort(self, effort: ReasoningEffort) -> Self
pub fn reasoning_effort(self, effort: ReasoningEffort) -> Self
Set the reasoning effort.
Trait Implementations§
Source§impl Clone for CompletionOptions
impl Clone for CompletionOptions
Source§fn clone(&self) -> CompletionOptions
fn clone(&self) -> CompletionOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more