pub struct CreateMessageRequest {Show 16 fields
pub model: String,
pub max_tokens: u32,
pub messages: Vec<Message>,
pub system: Option<SystemPrompt>,
pub tools: Option<Vec<ApiTool>>,
pub tool_choice: Option<ToolChoice>,
pub stream: Option<bool>,
pub stop_sequences: Option<Vec<String>>,
pub temperature: Option<f32>,
pub top_p: Option<f32>,
pub top_k: Option<u32>,
pub metadata: Option<RequestMetadata>,
pub thinking: Option<ThinkingConfig>,
pub output_format: Option<OutputFormat>,
pub context_management: Option<ContextManagement>,
pub output_config: Option<OutputConfig>,
}Fields§
§model: String§max_tokens: u32§messages: Vec<Message>§system: Option<SystemPrompt>§tools: Option<Vec<ApiTool>>§tool_choice: Option<ToolChoice>§stream: Option<bool>§stop_sequences: Option<Vec<String>>§temperature: Option<f32>§top_p: Option<f32>§top_k: Option<u32>§metadata: Option<RequestMetadata>§thinking: Option<ThinkingConfig>§output_format: Option<OutputFormat>§context_management: Option<ContextManagement>§output_config: Option<OutputConfig>Implementations§
Source§impl CreateMessageRequest
impl CreateMessageRequest
pub fn new(model: impl Into<String>, messages: Vec<Message>) -> Self
pub fn validate(&self) -> Result<(), TokenValidationError>
pub fn requires_128k_beta(&self) -> bool
pub fn system(self, system: impl Into<SystemPrompt>) -> Self
pub fn tools(self, tools: Vec<ToolDefinition>) -> Self
pub fn web_search(self, config: WebSearchTool) -> Self
pub fn web_fetch(self, config: WebFetchTool) -> Self
pub fn tool_search(self, config: ToolSearchTool) -> Self
pub fn api_tools(self, tools: Vec<ApiTool>) -> Self
pub fn tool_choice(self, choice: ToolChoice) -> Self
pub fn tool_choice_auto(self) -> Self
pub fn tool_choice_any(self) -> Self
pub fn tool_choice_none(self) -> Self
pub fn required_tool(self, name: impl Into<String>) -> Self
pub fn stream(self) -> Self
pub fn max_tokens(self, max_tokens: u32) -> Self
pub fn model(self, model: impl Into<String>) -> Self
pub fn temperature(self, temperature: f32) -> Self
pub fn top_p(self, top_p: f32) -> Self
pub fn top_k(self, top_k: u32) -> Self
pub fn stop_sequences(self, sequences: Vec<String>) -> Self
pub fn thinking(self, config: ThinkingConfig) -> Self
pub fn extended_thinking(self, budget_tokens: u32) -> Self
pub fn output_format(self, format: OutputFormat) -> Self
Sourcepub fn json_schema(self, schema: Value) -> Self
pub fn json_schema(self, schema: Value) -> Self
Set JSON schema for structured output.
Automatically transforms the schema for strict mode compatibility:
- Adds
additionalProperties: falseto all objects - Removes unsupported constraints (minimum, maximum, minLength, maxLength, etc.)
- Ensures
requiredfields are present
pub fn context_management(self, management: ContextManagement) -> Self
pub fn effort(self, level: EffortLevel) -> Self
pub fn output_config(self, config: OutputConfig) -> Self
Trait Implementations§
Source§impl Clone for CreateMessageRequest
impl Clone for CreateMessageRequest
Source§fn clone(&self) -> CreateMessageRequest
fn clone(&self) -> CreateMessageRequest
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CreateMessageRequest
impl Debug for CreateMessageRequest
Auto Trait Implementations§
impl Freeze for CreateMessageRequest
impl RefUnwindSafe for CreateMessageRequest
impl Send for CreateMessageRequest
impl Sync for CreateMessageRequest
impl Unpin for CreateMessageRequest
impl UnwindSafe for CreateMessageRequest
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.