gemini: Pass system prompt as system instructions (#28793)

https://ai.google.dev/gemini-api/docs/text-generation#system-instructions

Release Notes:

- agent: Improve performance of Gemini models
This commit is contained in:
Bennet Bo Fenner 2025-04-15 19:45:47 +02:00 committed by GitHub
parent c381a500f8
commit c7e80c80c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 62 additions and 36 deletions

View file

@ -125,6 +125,7 @@ pub struct GenerateContentRequest {
#[serde(default, skip_serializing_if = "String::is_empty")]
pub model: String,
pub contents: Vec<Content>,
pub system_instructions: Option<SystemInstructions>,
pub generation_config: Option<GenerationConfig>,
pub safety_settings: Option<Vec<SafetySetting>>,
#[serde(skip_serializing_if = "Option::is_none")]
@ -159,6 +160,12 @@ pub struct Content {
pub role: Role,
}
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct SystemInstructions {
pub parts: Vec<Part>,
}
#[derive(Debug, PartialEq, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub enum Role {