pub struct ChatRequest {
pub model: String,
pub system: Option<String>,
pub messages: Vec<(String, String)>,
pub max_tokens: u32,
pub temperature: Option<f64>,
pub stop_sequences: Vec<String>,
pub stream: bool,
pub tools: Option<Value>,
pub extra: Vec<(String, Value)>,
}Fields§
§model: String§system: Option<String>§messages: Vec<(String, String)>(role, content) pairs; role is user or assistant.
max_tokens: u32§temperature: Option<f64>§stop_sequences: Vec<String>§stream: bool§tools: Option<Value>Raw tool definitions in the target protocol’s own shape.
extra: Vec<(String, Value)>Arbitrary extra top-level fields, merged last. Used by probes that need to poke at parameter handling.
Implementations§
Source§impl ChatRequest
impl ChatRequest
pub fn new(model: &str, user: &str) -> Self
pub fn max_tokens(self, n: u32) -> Self
pub fn temperature(self, t: f64) -> Self
pub fn system(self, s: &str) -> Self
pub fn stop(self, seqs: &[&str]) -> Self
pub fn stream(self, on: bool) -> Self
pub fn model_id(self, m: &str) -> Self
Sourcepub fn prompt_text(&self) -> String
pub fn prompt_text(&self) -> String
The text this request sends, used for local token estimation.
pub fn to_body(&self, proto: Protocol) -> Value
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