pub struct GenerateContentRequest {
pub contents: Vec<Content>,
pub generation_config: Option<GenerationConfig>,
pub safety_settings: Option<Vec<SafetySetting>>,
pub tools: Option<Vec<Tool>>,
pub tool_config: Option<ToolConfig>,
pub system_instruction: Option<Content>,
pub cached_content: Option<String>,
}Expand description
Request to generate content
Fields§
§contents: Vec<Content>The contents to generate content from
generation_config: Option<GenerationConfig>The generation config
safety_settings: Option<Vec<SafetySetting>>The safety settings
tools: Option<Vec<Tool>>The tools that the model can use
tool_config: Option<ToolConfig>The tool config
system_instruction: Option<Content>The system instruction
cached_content: Option<String>The cached content to use
Implementations§
Source§impl GenerateContentRequest
impl GenerateContentRequest
Sourcepub fn strip_vertex_unsupported_fields(&mut self)
pub fn strip_vertex_unsupported_fields(&mut self)
Strips fields that Vertex AI does not support.
The Vertex AI surface (aiplatform.googleapis.com) rejects
includeServerSideToolInvocations with a 400 error. Vertex AI handles
built-in tools (Google Search, URL Context, etc.) natively without
needing this flag. This method clears the flag so the request can be
sent to Vertex AI without modification.
AI Studio (generativelanguage.googleapis.com) requires the flag for
Gemini 3 models to return toolCall/toolResponse parts instead of
silently truncating the response.
Trait Implementations§
Source§impl Clone for GenerateContentRequest
impl Clone for GenerateContentRequest
Source§fn clone(&self) -> GenerateContentRequest
fn clone(&self) -> GenerateContentRequest
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 GenerateContentRequest
impl Debug for GenerateContentRequest
Source§impl<'de> Deserialize<'de> for GenerateContentRequest
impl<'de> Deserialize<'de> for GenerateContentRequest
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for GenerateContentRequest
impl RefUnwindSafe for GenerateContentRequest
impl Send for GenerateContentRequest
impl Sync for GenerateContentRequest
impl Unpin for GenerateContentRequest
impl UnsafeUnpin 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
Mutably borrows from an owned value. Read more