This example assumes using Mistral; is in scope and apiKey contains your Mistral API key.
1 2 3 4 5 6 7 8 91011121314151617181920212223
usingvarclient=newMistralClient(apiKey);vargetWeatherTool=Meai.AIFunctionFactory.Create((stringlocation)=>$"The weather in {location} is 72°F and sunny.",name:"get_weather",description:"Gets the current weather for a given location.");Meai.IChatClientchatClient=client;varupdates=chatClient.GetStreamingResponseAsync([ new Meai.ChatMessage(Meai.ChatRole.User, "What is the weather in Paris?") ],newMeai.ChatOptions{ModelId="mistral-small-latest",Tools=[getWeatherTool],});varfunctionCalls=newList<Meai.FunctionCallContent>();awaitforeach(varupdateinupdates){functionCalls.AddRange(update.Contents.OfType<Meai.FunctionCallContent>());}