This example assumes using Inception; is in scope and apiKey contains your Inception API key.
1 2 3 4 5 6 7 8 91011121314
usingvarclient=newInceptionClient(apiKey);varrequest=newChatCompletionRequest{Model="mercury-3",Messages=[newMessage{Role=MessageRole.User,Content="Say hello in three words."}],ReasoningEffort=ChatCompletionRequestReasoningEffort.Instant,Realtime=true,Temperature=0.75,MaxCompletionTokens=1024,};request.Messages=[newMessage{Role=MessageRole.User,Content="Get the weather in Dubai."}];request.Tools=[WeatherTool()];request.ToolChoice=newNamedToolChoice{Function=newToolChoiceFunction{Name="get_weather"}};varresponse=awaitclient.Chat.CreateChatCompletionAsync(request);varcall=response.Choices[0].Message.ToolCalls![0];usingvararguments=JsonDocument.Parse(call.Function.Arguments);