Struct google_api_proto::google::ai::generativelanguage::v1beta::GenerateContentRequest
source · pub struct GenerateContentRequest {
pub model: String,
pub system_instruction: Option<Content>,
pub contents: Vec<Content>,
pub tools: Vec<Tool>,
pub tool_config: Option<ToolConfig>,
pub safety_settings: Vec<SafetySetting>,
pub generation_config: Option<GenerationConfig>,
pub cached_content: Option<String>,
}
Expand description
Request to generate a completion from the model.
Fields§
§model: String
Required. The name of the Model
to use for generating the completion.
Format: name=models/{model}
.
system_instruction: Option<Content>
Optional. Developer set system instruction(s). Currently, text only.
contents: Vec<Content>
Required. The content of the current conversation with the model.
For single-turn queries, this is a single instance. For multi-turn queries like chat, this is a repeated field that contains the conversation history and the latest request.
tools: Vec<Tool>
Optional. A list of Tools
the Model
may use to generate the next
response.
A Tool
is a piece of code that enables the system to interact with
external systems to perform an action, or set of actions, outside of
knowledge and scope of the Model
. Supported Tool
s are Function
and
code_execution
. Refer to the Function
calling and the
Code execution
guides to learn more.
tool_config: Option<ToolConfig>
Optional. Tool configuration for any Tool
specified in the request. Refer
to the Function calling
guide
for a usage example.
safety_settings: Vec<SafetySetting>
Optional. A list of unique SafetySetting
instances for blocking unsafe
content.
This will be enforced on the GenerateContentRequest.contents
and
GenerateContentResponse.candidates
. There should not be more than one
setting for each SafetyCategory
type. The API will block any contents and
responses that fail to meet the thresholds set by these settings. This list
overrides the default settings for each SafetyCategory
specified in the
safety_settings. If there is no SafetySetting
for a given
SafetyCategory
provided in the list, the API will use the default safety
setting for that category. Harm categories HARM_CATEGORY_HATE_SPEECH,
HARM_CATEGORY_SEXUALLY_EXPLICIT, HARM_CATEGORY_DANGEROUS_CONTENT,
HARM_CATEGORY_HARASSMENT are supported. Refer to the
guide
for detailed information on available safety settings. Also refer to the
Safety guidance to
learn how to incorporate safety considerations in your AI applications.
generation_config: Option<GenerationConfig>
Optional. Configuration options for model generation and outputs.
cached_content: Option<String>
Optional. The name of the content
cached to use as context
to serve the prediction. Format: cachedContents/{cachedContent}
Implementations§
source§impl GenerateContentRequest
impl GenerateContentRequest
sourcepub fn cached_content(&self) -> &str
pub fn cached_content(&self) -> &str
Returns the value of cached_content
, or the default value if cached_content
is unset.
Trait Implementations§
source§impl Clone for GenerateContentRequest
impl Clone for GenerateContentRequest
source§fn clone(&self) -> GenerateContentRequest
fn clone(&self) -> GenerateContentRequest
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for GenerateContentRequest
impl Debug for GenerateContentRequest
source§impl Default for GenerateContentRequest
impl Default for GenerateContentRequest
source§impl Message for GenerateContentRequest
impl Message for GenerateContentRequest
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 GenerateContentRequest
impl PartialEq for GenerateContentRequest
source§fn eq(&self, other: &GenerateContentRequest) -> bool
fn eq(&self, other: &GenerateContentRequest) -> bool
self
and other
values to be equal, and is used
by ==
.impl StructuralPartialEq for GenerateContentRequest
Auto Trait Implementations§
impl Freeze for GenerateContentRequest
impl RefUnwindSafe for GenerateContentRequest
impl Send for GenerateContentRequest
impl Sync for GenerateContentRequest
impl Unpin for GenerateContentRequest
impl UnwindSafe for GenerateContentRequest
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