usingvarclient=newTogetherClient(apiKey);Meai.IChatClientchatClient=client;vargetWeatherTool=AIFunctionFactory.Create((stringlocation)=>$"The weather in {location} is sunny, 72°F","GetWeather","Gets the current weather for a location");varmessages=newList<Meai.ChatMessage>{new(Meai.ChatRole.User,"What's the weather in Seattle?"),};varoptions=newMeai.ChatOptions{ModelId="meta-llama/Llama-3.3-70B-Instruct-Turbo",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(newMeai.ChatMessage(Meai.ChatRole.Tool,[ new FunctionResultContent(functionCall.CallId, toolResult),]));// Second turn: model should respond with the weather infovarfinalResponse=awaitchatClient.GetResponseAsync(messages,options);