This example assumes using Ollama; is in scope and apiKey contains your Ollama API key.
1 2 3 4 5 6 7 8 91011121314151617181920212223
awaitusingvarcontainer=awaitEnvironment.PrepareAsync(TestModels.Chat);varchat=container.Client.Chat(model:TestModels.Chat,systemMessage:"You are a helpful weather assistant. Use the provided tools for weather questions.",autoCallTools:true);chat.Options=newModelOptions{Temperature=0,Seed=1,};varservice=newWeatherService();chat.AddToolService(service.AsTools().AsOllamaTools(),service.AsCalls());try{_=awaitchat.SendAsync("What is the current temperature in Dubai, UAE in Celsius?");}finally{Console.WriteLine(chat.PrintMessages());}