usingvarclient=newHuggingFaceInferenceClient(apiKey);IChatClientchatClient=client;// Stream chat responses with tool calling using the MEAI IChatClient interface.// Define a simple tool that returns the current weather.vartool=AIFunctionFactory.Create((stringlocation)=>$"The weather in {location} is sunny, 72°F.","get_weather","Gets the current weather for a location.");varfunctionCalls=newList<FunctionCallContent>();ChatFinishReason?finishReason=null;awaitforeach(varupdateinchatClient.GetStreamingResponseAsync([new ChatMessage(ChatRole.User, "What's the weather in San Francisco?")],newChatOptions{ModelId="Qwen/Qwen2.5-Coder-32B-Instruct",Tools=[tool],})){functionCalls.AddRange(update.Contents.OfType<FunctionCallContent>());if(update.FinishReasonisnotnull){finishReason=update.FinishReason;}}// The model should respond with tool calls.