pub struct AnthropicCompletionRequest {
pub model: String,
pub messages: Vec<CompletionRequestMessage>,
pub max_tokens: u64,
pub stop_sequences: Option<Vec<String>>,
pub system: Option<String>,
pub temperature: f32,
pub top_p: Option<f32>,
}
Fields§
§model: String
ID of the model to use.
See models for additional details and options.
messages: Vec<CompletionRequestMessage>
Input messages.
Our models are trained to operate on alternating user and assistant conversational turns. When creating a new Message, you specify the prior conversational turns with the messages parameter, and the model then generates the next Message in the conversation.
See examples for more input examples.
Note that if you want to include a system prompt, you can use the top-level system parameter — there is no “system” role for input messages in the Messages API.
max_tokens: u64
The maximum number of tokens to generate before stopping.
Note that our models may stop before reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.
Different models have different maximum values for this parameter. See models for details.
stop_sequences: Option<Vec<String>>
Custom text sequences that will cause the model to stop generating.
Our models will normally stop when they have naturally completed their turn, which will result in a response stop_reason of “end_turn”.
If you want the model to stop generating when it encounters custom strings of text, you can use the stop_sequences parameter. If the model encounters one of the custom sequences, the response stop_reason value will be “stop_sequence” and the response stop_sequence value will contain the matched stop sequence.
system: Option<String>
System prompt.
A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our guide to system prompts.
temperature: f32
Amount of randomness injected into the response.
Defaults to 0.5. Ranges from 0.0 to 1.0. Use temperature closer to 0.0 for analytical / multiple choice, and closer to 1.0 for creative and generative tasks.
Note that even with temperature of 0.0, the results will not be fully deterministic.
top_p: Option<f32>
min: 0.0, max: 1.0, default: None
Implementations§
Source§impl AnthropicCompletionRequest
impl AnthropicCompletionRequest
pub fn new(req: &CompletionRequest) -> Result<Self, CompletionError>
Trait Implementations§
Source§impl Clone for AnthropicCompletionRequest
impl Clone for AnthropicCompletionRequest
Source§fn clone(&self) -> AnthropicCompletionRequest
fn clone(&self) -> AnthropicCompletionRequest
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for AnthropicCompletionRequest
impl Debug for AnthropicCompletionRequest
Source§impl Default for AnthropicCompletionRequest
impl Default for AnthropicCompletionRequest
Source§fn default() -> AnthropicCompletionRequest
fn default() -> AnthropicCompletionRequest
Source§impl<'de> Deserialize<'de> for AnthropicCompletionRequest
impl<'de> Deserialize<'de> for AnthropicCompletionRequest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl StructuralPartialEq for AnthropicCompletionRequest
Auto Trait Implementations§
impl Freeze for AnthropicCompletionRequest
impl RefUnwindSafe for AnthropicCompletionRequest
impl Send for AnthropicCompletionRequest
impl Sync for AnthropicCompletionRequest
impl Unpin for AnthropicCompletionRequest
impl UnwindSafe for AnthropicCompletionRequest
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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 more