Struct google_api_proto::google::ai::generativelanguage::v1beta2::MessagePrompt
source · pub struct MessagePrompt {
pub context: String,
pub examples: Vec<Example>,
pub messages: Vec<Message>,
}
Expand description
All of the structured input text passed to the model as a prompt.
A MessagePrompt
contains a structured set of fields that provide context
for the conversation, examples of user input/model output message pairs that
prime the model to respond in different ways, and the conversation history
or list of messages representing the alternating turns of the conversation
between the user and the model.
Fields§
§context: String
Optional. Text that should be provided to the model first to ground the response.
If not empty, this context
will be given to the model first before the
examples
and messages
. When using a context
be sure to provide it
with every request to maintain continuity.
This field can be a description of your prompt to the model to help provide context and guide the responses. Examples: “Translate the phrase from English to French.” or “Given a statement, classify the sentiment as happy, sad or neutral.”
Anything included in this field will take precedence over message history
if the total input size exceeds the model’s input_token_limit
and the
input request is truncated.
examples: Vec<Example>
Optional. Examples of what the model should generate.
This includes both user input and the response that the model should emulate.
These examples
are treated identically to conversation messages except
that they take precedence over the history in messages
:
If the total input size exceeds the model’s input_token_limit
the input
will be truncated. Items will be dropped from messages
before examples
.
messages: Vec<Message>
Required. A snapshot of the recent conversation history sorted chronologically.
Turns alternate between two authors.
If the total input size exceeds the model’s input_token_limit
the input
will be truncated: The oldest items will be dropped from messages
.
Trait Implementations§
source§impl Clone for MessagePrompt
impl Clone for MessagePrompt
source§fn clone(&self) -> MessagePrompt
fn clone(&self) -> MessagePrompt
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for MessagePrompt
impl Debug for MessagePrompt
source§impl Default for MessagePrompt
impl Default for MessagePrompt
source§impl Message for MessagePrompt
impl Message for MessagePrompt
source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
source§fn encode_to_vec(&self) -> Vec<u8>where
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8>where
Self: Sized,
source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
source§fn encode_length_delimited_to_vec(&self) -> Vec<u8>where
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8>where
Self: Sized,
source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self
. Read moresource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self
.source§impl PartialEq for MessagePrompt
impl PartialEq for MessagePrompt
source§fn eq(&self, other: &MessagePrompt) -> bool
fn eq(&self, other: &MessagePrompt) -> bool
self
and other
values to be equal, and is used
by ==
.impl StructuralPartialEq for MessagePrompt
Auto Trait Implementations§
impl Freeze for MessagePrompt
impl RefUnwindSafe for MessagePrompt
impl Send for MessagePrompt
impl Sync for MessagePrompt
impl Unpin for MessagePrompt
impl UnwindSafe for MessagePrompt
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request