-
Notifications
You must be signed in to change notification settings - Fork 284
Create simpleprompt.cs #488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Example on tying openai-dotnet docs to openai.com docs folder structure
Actually please rename to chat_simpleprompt.cs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd recommend that we're more generous with whitespace in samples to help cluster concepts together and improve readability.
The file also looks like it should be name chat_simple_prompt.cs
to follow the snake naming conventions in the folder
// 1. Set OPENAI_KEY environment variable to your OpenAI API key, never hardcode it. | ||
// 2. Run this command: type chat_simpleprompt.cs | ||
// 3. Run this commnd: dotnet run chat_simpleprompt.cs | ||
#:package OpenAI@2.* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#:package OpenAI@2.* | |
#:package OpenAI@2.* | |
// 3. Run this commnd: dotnet run chat_simpleprompt.cs | ||
#:package OpenAI@2.* | ||
#:property PublishAot=false | ||
using OpenAI.Chat; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using OpenAI.Chat; | |
using OpenAI.Chat; | |
string key = Environment.GetEnvironmentVariable("OPENAI_KEY")!; | ||
ChatClient client = new (model: "gpt-4.1", apiKey: apiKey); | ||
ChatCompletion acompletion = client.CompleteChat("list all noble gases"); | ||
Console.WriteLine(acompletion.Content[0].Text); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Console.WriteLine(acompletion.Content[0].Text); | |
Console.WriteLine(acompletion.Content[0].Text); |
@KrzysztofCwalina Example on tying openai-dotnet docs to openai.com docs folder structure