usingvarclient=GetAuthorizedClient();IChatClientchatClient=client;vargetWeatherTool=AIFunctionFactory.Create((stringlocation)=>$"The weather in {location} is sunny, 72°F","GetWeather","Gets the current weather for a location");varmessages=newList<ChatMessage>{new(ChatRole.User,"What's the weather in Seattle?"),};varoptions=newChatOptions{ModelId="jamba-large",Tools=[getWeatherTool],};// First turn: model should call the toolvarresponse=awaitchatClient.GetResponseAsync(messages,options);varfunctionCall=response.Messages.SelectMany(m=>m.Contents).OfType<FunctionCallContent>().FirstOrDefault();// Add assistant response with tool call and tool resultmessages.AddRange(response.Messages);vartoolResult=awaitgetWeatherTool.InvokeAsync(functionCall!.Argumentsis{}args?newAIFunctionArguments(args):null);messages.Add(newChatMessage(ChatRole.Tool,[ new FunctionResultContent(functionCall.CallId, toolResult),]));// Second turn: model should respond with the weather infovarfinalResponse=awaitchatClient.GetResponseAsync(messages,options);