openai/openai-dotnet

Public

mirrored from https://github.com/openai/openai-dotnetAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
copilot/fix-codeinterpretertoolcontainer

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

docs/guides/text/responses/responses_simpleprompt.cs

17lines · modecode

1// SAMPLE: Generate text from a simple prompt
2// GUIDANCE: Instructions to run this code: https://aka.ms/oai/net/start
3#pragma warning disable OPENAI001
4
5#:package OpenAI@2.*
6
7using OpenAI.Responses;
8
9string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;
10ResponsesClient client = new(key);
11
12ResponseResult response = client.CreateResponse(
13 "gpt-5.2",
14 "Write a one-sentence bedtime story about a unicorn."
15);
16
17Console.WriteLine(response.GetOutputText());