openai/openai-dotnet
Publicmirrored from https://github.com/openai/openai-dotnetAvailable
examples/Responses/Example01_SimpleResponse.cs
24lines · modeblame
aaa924ecJose Arriaga Maldonado1 years ago | 1 | using NUnit.Framework; |
| 2 | using OpenAI.Responses; | |
| 3 | using System; | |
| 4 | | |
| 5 | namespace OpenAI.Examples; | |
| 6 | | |
5dce104aJose Arriaga Maldonado1 years ago | 7 | // This example uses experimental APIs which are subject to change. To use experimental APIs, |
| 8 | // please acknowledge their experimental status by suppressing the corresponding warning. | |
| 9 | #pragma warning disable OPENAI001 | |
| 10 | | |
aaa924ecJose Arriaga Maldonado1 years ago | 11 | public partial class ResponseExamples |
| 12 | { | |
| 13 | [Test] | |
5dce104aJose Arriaga Maldonado1 years ago | 14 | public void Example01_SimpleResponse() |
aaa924ecJose Arriaga Maldonado1 years ago | 15 | { |
5ff668b5Copilot5 months ago | 16 | ResponsesClient client = new(apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY")); |
aaa924ecJose Arriaga Maldonado1 years ago | 17 | |
5ff668b5Copilot5 months ago | 18 | ResponseResult response = client.CreateResponse("gpt-5", "Say 'this is a test.'"); |
aaa924ecJose Arriaga Maldonado1 years ago | 19 | |
| 20 | Console.WriteLine($"[ASSISTANT]: {response.GetOutputText()}"); | |
| 21 | } | |
| 22 | } | |
5dce104aJose Arriaga Maldonado1 years ago | 23 | |
| 24 | #pragma warning restore OPENAI001 |