#[non_exhaustive]pub struct GenerateContentRequest {
pub model: String,
pub contents: Vec<Content>,
pub system_instruction: Option<Content>,
pub cached_content: String,
pub tools: Vec<Tool>,
pub tool_config: Option<ToolConfig>,
pub labels: HashMap<String, String>,
pub safety_settings: Vec<SafetySetting>,
pub generation_config: Option<GenerationConfig>,
/* private fields */
}Expand description
Request message for [PredictionService.GenerateContent].
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.model: StringRequired. The fully qualified name of the publisher model or tuned model endpoint to use.
Publisher model format:
projects/{project}/locations/{location}/publishers/*/models/*
Tuned model endpoint format:
projects/{project}/locations/{location}/endpoints/{endpoint}
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, this is a repeated field that contains conversation history + latest request.
system_instruction: Option<Content>Optional. The user provided system instructions for the model. Note: only text should be used in parts and content in each part will be in a separate paragraph.
cached_content: StringOptional. The name of the cached content used as context to serve the
prediction. Note: only used in explicit caching, where users can have
control over caching (e.g. what content to cache) and enjoy guaranteed cost
savings. Format:
projects/{project}/locations/{location}/cachedContents/{cachedContent}
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.
tool_config: Option<ToolConfig>Optional. Tool config. This config is shared for all tools provided in the request.
labels: HashMap<String, String>Optional. The labels with user-defined metadata for the request. It is used for billing and reporting only.
Label keys and values can be no longer than 63 characters (Unicode codepoints) and can only contain lowercase letters, numeric characters, underscores, and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter.
safety_settings: Vec<SafetySetting>Optional. Per request settings for blocking unsafe content. Enforced on GenerateContentResponse.candidates.
generation_config: Option<GenerationConfig>Optional. Generation config.
Implementations§
Source§impl GenerateContentRequest
impl GenerateContentRequest
pub fn new() -> Self
Sourcepub fn set_contents<T, V>(self, v: T) -> Self
pub fn set_contents<T, V>(self, v: T) -> Self
Sets the value of contents.
Sourcepub fn set_system_instruction<T: Into<Option<Content>>>(self, v: T) -> Self
pub fn set_system_instruction<T: Into<Option<Content>>>(self, v: T) -> Self
Sets the value of system_instruction.
Sourcepub fn set_cached_content<T: Into<String>>(self, v: T) -> Self
pub fn set_cached_content<T: Into<String>>(self, v: T) -> Self
Sets the value of cached_content.
Sourcepub fn set_tool_config<T: Into<Option<ToolConfig>>>(self, v: T) -> Self
pub fn set_tool_config<T: Into<Option<ToolConfig>>>(self, v: T) -> Self
Sets the value of tool_config.
Sourcepub fn set_labels<T, K, V>(self, v: T) -> Self
pub fn set_labels<T, K, V>(self, v: T) -> Self
Sets the value of labels.
Sourcepub fn set_safety_settings<T, V>(self, v: T) -> Self
pub fn set_safety_settings<T, V>(self, v: T) -> Self
Sets the value of safety_settings.
Sourcepub fn set_generation_config<T: Into<Option<GenerationConfig>>>(
self,
v: T,
) -> Self
pub fn set_generation_config<T: Into<Option<GenerationConfig>>>( self, v: T, ) -> Self
Sets the value of generation_config.
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 more