.NET: Inline const values in samples where used only once (#1387)

* Inline const values in samples where used only once

* Fix some spacing issues and use consistent ordering of settings/params
This commit is contained in:
westey
2025-10-10 16:50:53 +00:00
committed by GitHub
parent 3730db3e94
commit d6fdb91480
21 changed files with 53 additions and 106 deletions
@@ -10,12 +10,9 @@ using OpenAI.Chat;
var apiKey = Environment.GetEnvironmentVariable("OPENAI_API_KEY") ?? throw new InvalidOperationException("OPENAI_API_KEY is not set.");
var model = Environment.GetEnvironmentVariable("OPENAI_MODEL") ?? "gpt-4o-mini";
const string JokerName = "Joker";
const string JokerInstructions = "You are good at telling jokes.";
AIAgent agent = new OpenAIClient(apiKey)
.GetChatClient(model)
.CreateAIAgent(JokerInstructions, JokerName);
.CreateAIAgent(instructions: "You are good at telling jokes.", name: "Joker");
UserChatMessage chatMessage = new("Tell me a joke about a pirate.");