pub struct TypedChatRequest<M: ChatModel, S: Sealed = MissingInput> { /* private fields */ }Expand description
A capability-checked chat request.
M determines which model-specific methods exist, while S prevents sending a request before
it contains user or tool input. Convert with TypedChatRequest::into_raw when a raw extension
field is required.
Implementations§
Source§impl<M: ChatModel> TypedChatRequest<M, MissingInput>
impl<M: ChatModel> TypedChatRequest<M, MissingInput>
Source§impl<M: ChatModel, S: Sealed> TypedChatRequest<M, S>
impl<M: ChatModel, S: Sealed> TypedChatRequest<M, S>
pub const fn model_id(&self) -> &'static str
pub const fn capabilities(&self) -> ModelCapabilities
pub fn system(self, value: impl Into<String>) -> Self
pub fn assistant(self, value: impl Into<String>) -> Self
pub fn temperature(self, value: f32) -> Self
pub fn top_p(self, value: f32) -> Self
pub fn max_tokens(self, value: u32) -> Self
pub fn request_id(self, value: impl Into<String>) -> Self
pub fn user_id(self, value: impl Into<String>) -> Self
pub fn into_raw(self) -> ChatCompletionRequest
Source§impl<M: TextChatModel, S: Sealed> TypedChatRequest<M, S>
impl<M: TextChatModel, S: Sealed> TypedChatRequest<M, S>
Source§impl<M: VisionChatModel, S: Sealed> TypedChatRequest<M, S>
impl<M: VisionChatModel, S: Sealed> TypedChatRequest<M, S>
pub fn user_parts( self, parts: impl IntoIterator<Item = ContentPart>, ) -> TypedChatRequest<M, Ready>
Source§impl<M: SupportsThinking, S: Sealed> TypedChatRequest<M, S>
impl<M: SupportsThinking, S: Sealed> TypedChatRequest<M, S>
Source§impl<M: SupportsReasoningEffort, S: Sealed> TypedChatRequest<M, S>
impl<M: SupportsReasoningEffort, S: Sealed> TypedChatRequest<M, S>
Sourcepub fn reasoning_effort(self, value: ReasoningEffort) -> Self
pub fn reasoning_effort(self, value: ReasoningEffort) -> Self
Sets GLM-5.2 reasoning effort.
This method does not exist for models that do not declare the capability:
ⓘ
use rustglm::{Glm51, ReasoningEffort, TypedChatRequest};
let _ = TypedChatRequest::<Glm51>::new()
.reasoning_effort(ReasoningEffort::High);Source§impl<M: SupportsTools, S: Sealed> TypedChatRequest<M, S>
impl<M: SupportsTools, S: Sealed> TypedChatRequest<M, S>
pub fn tool(self, value: Tool) -> Self
pub fn tools(self, values: impl IntoIterator<Item = Tool>) -> Self
pub fn tool_result( self, call_id: impl Into<String>, output: impl Into<String>, ) -> TypedChatRequest<M, Ready>
Source§impl<M: SupportsToolStream, S: Sealed> TypedChatRequest<M, S>
impl<M: SupportsToolStream, S: Sealed> TypedChatRequest<M, S>
Sourcepub fn tool_stream(self) -> Self
pub fn tool_stream(self) -> Self
Enables incremental Function Call output for models that support tool_stream.
ⓘ
use rustglm::{Glm45Air, TypedChatRequest};
let _ = TypedChatRequest::<Glm45Air>::new().tool_stream();Source§impl<M: ChatModel> TypedChatRequest<M, Ready>
impl<M: ChatModel> TypedChatRequest<M, Ready>
pub fn as_raw(&self) -> &ChatCompletionRequest
Trait Implementations§
Source§impl<M: Clone + ChatModel, S: Clone + Sealed> Clone for TypedChatRequest<M, S>
impl<M: Clone + ChatModel, S: Clone + Sealed> Clone for TypedChatRequest<M, S>
Source§fn clone(&self) -> TypedChatRequest<M, S>
fn clone(&self) -> TypedChatRequest<M, S>
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 moreSource§impl<M: ChatModel> Default for TypedChatRequest<M, MissingInput>
impl<M: ChatModel> Default for TypedChatRequest<M, MissingInput>
impl<M: PartialEq + ChatModel, S: PartialEq + Sealed> StructuralPartialEq for TypedChatRequest<M, S>
Auto Trait Implementations§
impl<M, S> Freeze for TypedChatRequest<M, S>
impl<M, S> RefUnwindSafe for TypedChatRequest<M, S>where
M: RefUnwindSafe,
S: RefUnwindSafe,
impl<M, S> Send for TypedChatRequest<M, S>where
S: Send,
impl<M, S> Sync for TypedChatRequest<M, S>where
S: Sync,
impl<M, S> Unpin for TypedChatRequest<M, S>
impl<M, S> UnsafeUnpin for TypedChatRequest<M, S>
impl<M, S> UnwindSafe for TypedChatRequest<M, S>where
M: UnwindSafe,
S: UnwindSafe,
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