usingvarclient=newGeminiClient(apiKey);varmodelId=GetGenerateContentModelId();try{vargetWeatherTool=AIFunctionFactory.Create((stringlocation)=>$"The weather in {location} is 72°F and sunny.",name:"get_weather",description:"Gets the current weather for a given location.");IChatClientchatClient=client;varresponse=awaitchatClient.GetResponseAsync([ new ChatMessage(ChatRole.User, "What is the weather in Paris?") ],newChatOptions{ModelId=modelId,Tools=[getWeatherTool],});// The model should request a tool callvarfunctionCall=response.Messages.SelectMany(m=>m.Contents).OfType<FunctionCallContent>().FirstOrDefault();}catch(ApiExceptionex)when(IsTransientAvailabilityIssue(ex)){AssertTransientAvailability(ex);}