This example assumes using Together; is in scope and apiKey contains your Together API key.
1 2 3 4 5 6 7 8 9101112131415161718192021
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");varupdates=chatClient.GetStreamingResponseAsync([new Meai.ChatMessage(Meai.ChatRole.User, "What's the weather in Seattle?")],newMeai.ChatOptions{ModelId="meta-llama/Llama-3.3-70B-Instruct-Turbo",Tools=[getWeatherTool],});varfunctionCalls=newList<FunctionCallContent>();awaitforeach(varupdateinupdates){functionCalls.AddRange(update.Contents.OfType<FunctionCallContent>());}