diff --git a/examples/function-call.rs b/examples/function-call.rs index 288a217..928a19a 100644 --- a/examples/function-call.rs +++ b/examples/function-call.rs @@ -1,7 +1,8 @@ use std::{env, error::Error}; use google_genai::prelude::{ - Content, FunctionDeclaration, GeminiClient, GenerateContentRequest, Part, PartData, Role, Tools, + Content, FunctionDeclaration, FunctionResponse, GeminiClient, GenerateContentRequest, Part, + PartData, Role, Tools, }; use serde_json::json; @@ -85,12 +86,14 @@ async fn main() -> Result<(), Box> { contents.push(Content { role: Some(Role::User), parts: Some(vec![Part { - data: PartData::FunctionResponse { + data: PartData::FunctionResponse(FunctionResponse { id: id.clone(), name: name.clone(), response: json!({"result": 1234}), will_continue: None, - }, + parts: None, + scheduling: None, + }), media_resolution: None, part_metadata: None, thought: None, diff --git a/src/types/common.rs b/src/types/common.rs index c350c96..d4e70d6 100644 --- a/src/types/common.rs +++ b/src/types/common.rs @@ -3,6 +3,8 @@ use std::{fmt::Display, str::FromStr, vec}; use serde::{Deserialize, Serialize}; use serde_json::Value; +use crate::types::FunctionResponse; + #[derive(Clone, Default, Debug, Serialize, Deserialize)] pub struct Content { pub role: Option, @@ -118,13 +120,7 @@ pub enum PartData { args: Option, }, // https://ai.google.dev/api/caching#FunctionResponse - FunctionResponse { - id: Option, - name: String, - response: Value, - will_continue: Option, - // TODO: Add remaining fields. - }, + FunctionResponse(FunctionResponse), FileData(Value), ExecutableCode(Value), CodeExecutionResult(Value),