@@ -46,7 +46,7 @@ use gemini_client_rs::{
4646 ParameterPropertyArray , ParameterPropertyBoolean , ParameterPropertyInteger ,
4747 ParameterPropertyString , Role , Tool , ToolConfig , ToolConfigFunctionDeclaration ,
4848 } ,
49- GeminiClient ,
49+ FunctionHandler , GeminiClient ,
5050} ;
5151
5252use dotenvy:: dotenv;
@@ -333,14 +333,11 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
333333 std:: env:: var ( "GEMINI_MODEL_NAME" ) . unwrap_or_else ( |_| "gemini-2.5-flash" . to_string ( ) ) ;
334334
335335 // Set up function handler
336- let mut function_handlers: HashMap <
337- String ,
338- Box < dyn Fn ( & mut serde_json:: Value ) -> Result < serde_json:: Value , String > + Send + Sync > ,
339- > = HashMap :: new ( ) ;
336+ let mut function_handlers: HashMap < String , FunctionHandler > = HashMap :: new ( ) ;
340337
341338 function_handlers. insert (
342339 "schedule_meeting" . to_string ( ) ,
343- Box :: new ( |args : & mut serde_json:: Value | {
340+ FunctionHandler :: Sync ( Box :: new ( |args : & mut serde_json:: Value | {
344341 // Deserialize the arguments using the MeetingRequest struct
345342 let meeting_request: MeetingRequest = serde_json:: from_value ( args. clone ( ) )
346343 . map_err ( |e| format ! ( "Failed to deserialize meeting request: {}" , e) ) ?;
@@ -375,7 +372,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
375372 // Serialize the response back to JSON
376373 serde_json:: to_value ( response)
377374 . map_err ( |e| format ! ( "Failed to serialize meeting response: {}" , e) )
378- } ) ,
375+ } ) ) ,
379376 ) ;
380377
381378 // Make the request
0 commit comments