This example assumes using Inception; is in scope and apiKey contains your Inception API key.
1 2 3 4 5 6 7 8 910111213141516171819
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="Return the city Dubai as JSON."}];request.ResponseFormat=newResponseFormatJSONSchema{JsonSchema=newJSONSchema{Name="city_response",Strict=true,Schema=Json("""{"type":"object","properties":{"city":{"type":"string"}},"required":["city"],"additionalProperties":false}"""),},};varresponse=awaitclient.Chat.CreateChatCompletionAsync(request);usingvarresult=JsonDocument.Parse(response.Choices[0].Message.Content!.Value.Value1!);