pub struct ChatRequest {
pub messages: Vec<Message>,
pub tools: Vec<ToolDef>,
pub temperature: Option<f32>,
pub max_tokens: Option<u32>,
pub response_format: ResponseFormat,
pub stop: Vec<String>,
pub timeout: Option<Duration>,
}Expand description
Chat completion request.
Fields§
§messages: Vec<Message>Conversation history.
tools: Vec<ToolDef>Tools available for the model to call.
temperature: Option<f32>Sampling temperature.
max_tokens: Option<u32>Maximum response tokens.
response_format: ResponseFormatOutput format hint.
stop: Vec<String>Stop sequences.
timeout: Option<Duration>Per-request deadline. Provider should abort if exceeded.
Implementations§
Source§impl ChatRequest
impl ChatRequest
Sourcepub fn new(messages: Vec<Message>) -> Self
pub fn new(messages: Vec<Message>) -> Self
Build a request with the supplied messages and no tools.
Sourcepub fn builder() -> ChatRequestBuilder
pub fn builder() -> ChatRequestBuilder
Start building a request; messages are sent in the order they are added.
use klieo_core::llm::ChatRequest;
let req = ChatRequest::builder().system("be terse").user("hi").build();
assert_eq!(req.messages.len(), 2);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