pub enum CompletionTokensParam {
MaxTokens,
MaxCompletionTokens,
}Expand description
Which token-limit field to use in the API request body.
OpenAI introduced max_completion_tokens for reasoning (o*) models while keeping
max_tokens for legacy ones. The OpenAiProvider infers the correct field from the
model name via a prefix table, but that table cannot cover every fine-tuned or
newly-released variant. Set this override when the inference would be wrong for your model.
§Examples
use zeph_llm::openai::{CompletionTokensParam, OpenAiConfig, OpenAiProvider};
// Force max_completion_tokens for a fine-tuned reasoning model
// whose name does not start with "o" + digit.
let cfg = OpenAiConfig {
api_key: "sk-...".into(),
base_url: "https://api.openai.com/v1".into(),
model: "my-ft-reasoner-v1".into(),
max_tokens: 8192,
embedding_model: None,
reasoning_effort: None,
context_window: None,
completion_tokens_param: Some(CompletionTokensParam::MaxCompletionTokens),
vision: None,
};
let provider = OpenAiProvider::new(cfg);Variants§
MaxTokens
Use the legacy max_tokens field (standard chat models).
MaxCompletionTokens
Use max_completion_tokens (required by o* reasoning models and gpt-5).
Trait Implementations§
Source§impl Clone for CompletionTokensParam
impl Clone for CompletionTokensParam
Source§fn clone(&self) -> CompletionTokensParam
fn clone(&self) -> CompletionTokensParam
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for CompletionTokensParam
Source§impl Debug for CompletionTokensParam
impl Debug for CompletionTokensParam
impl Eq for CompletionTokensParam
Source§impl PartialEq for CompletionTokensParam
impl PartialEq for CompletionTokensParam
impl StructuralPartialEq for CompletionTokensParam
Auto Trait Implementations§
impl Freeze for CompletionTokensParam
impl RefUnwindSafe for CompletionTokensParam
impl Send for CompletionTokensParam
impl Sync for CompletionTokensParam
impl Unpin for CompletionTokensParam
impl UnsafeUnpin for CompletionTokensParam
impl UnwindSafe for CompletionTokensParam
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.