openai/openai-dotnet
Publicmirrored from https://github.com/openai/openai-dotnetAvailable
examples/Responses/Example01_HelloWorld.cs
18lines · modeblame
aaa924ecJose Arriaga Maldonado1 years ago | 1 | using NUnit.Framework; |
| 2 | using OpenAI.Responses; | |
| 3 | using System; | |
| 4 | | |
| 5 | namespace OpenAI.Examples; | |
| 6 | | |
| 7 | public partial class ResponseExamples | |
| 8 | { | |
| 9 | [Test] | |
| 10 | public void Example01_HelloWorld() | |
| 11 | { | |
| 12 | OpenAIResponseClient client = new(model: "gpt-4o", apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY")); | |
| 13 | | |
| 14 | OpenAIResponse response = client.CreateResponse("Say 'this is a test.'"); | |
| 15 | | |
| 16 | Console.WriteLine($"[ASSISTANT]: {response.GetOutputText()}"); | |
| 17 | } | |
| 18 | } |