pub struct ChatRequest {
pub model: String,
pub messages: Vec<ChatMessage>,
pub max_tokens: Option<u32>,
pub temperature_milli: u32,
pub credential: Option<CredentialRef>,
}Expand description
A chat completion request. model is a routing hint:
"local"or""→ local Candle engine"openai/<model>"→ OpenAI Chat Completions"anthropic/<model>"→ Anthropic Messages"ollama/<model>"→ local Ollama (OpenAI-compat)"gemini/<model>"→ Google Generative AI
The credential field’s Debug output is redacted; the rest of the struct
derives a normal Debug impl.
Fields§
§model: String§messages: Vec<ChatMessage>§max_tokens: Option<u32>§temperature_milli: u32Temperature × 1000 (integer to keep the type Eq-able; 1000 = 1.0).
credential: Option<CredentialRef>Implementations§
Source§impl ChatRequest
impl ChatRequest
pub fn new(model: impl Into<String>, messages: Vec<ChatMessage>) -> Self
pub fn with_max_tokens(self, n: u32) -> Self
pub fn with_temperature(self, t_milli: u32) -> Self
pub fn with_credential(self, cred: CredentialRef) -> Self
Trait Implementations§
Source§impl Clone for ChatRequest
impl Clone for ChatRequest
Source§fn clone(&self) -> ChatRequest
fn clone(&self) -> ChatRequest
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 moreAuto Trait Implementations§
impl Freeze for ChatRequest
impl RefUnwindSafe for ChatRequest
impl Send for ChatRequest
impl Sync for ChatRequest
impl Unpin for ChatRequest
impl UnsafeUnpin for ChatRequest
impl UnwindSafe for ChatRequest
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