pub struct MaxTokens(/* private fields */);Expand description
Maximum number of response tokens requested from the model.
Implementations§
Source§impl MaxTokens
impl MaxTokens
Sourcepub fn new(value: usize) -> Result<Self, Error>
pub fn new(value: usize) -> Result<Self, Error>
Creates a token limit.
The Rust API stores token counts as usize, but the Swift bridge uses
i64. This constructor rejects values that cannot cross that boundary
without changing meaning.
§Examples
use aimx::MaxTokens;
let max_tokens = MaxTokens::new(256)?;
assert_eq!(max_tokens.get(), 256);§Errors
Returns Error::InvalidMaxTokens when value is greater than
MaxTokens::MAX.
Trait Implementations§
Source§impl Ord for MaxTokens
impl Ord for MaxTokens
Source§impl PartialOrd for MaxTokens
impl PartialOrd for MaxTokens
impl Copy for MaxTokens
impl Eq for MaxTokens
impl StructuralPartialEq for MaxTokens
Auto Trait Implementations§
impl Freeze for MaxTokens
impl RefUnwindSafe for MaxTokens
impl Send for MaxTokens
impl Sync for MaxTokens
impl Unpin for MaxTokens
impl UnsafeUnpin for MaxTokens
impl UnwindSafe for MaxTokens
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