Skip to content

Commit 9d0393d

Browse files
Docs/formating fix (#116)
* feat: Add Easter Egg detection for optimized prompts (Issue #27) * Fix typos, grammar, and formatting in Azure OpenAI setup guide
1 parent fdc018d commit 9d0393d

File tree

2 files changed

+32
-41
lines changed

2 files changed

+32
-41
lines changed

docs/setup/getting-started-azure-openai.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Setting Up the Development Environment for Azure OpenAI
22

3-
Azure AI Foundry is a service that allows you to deploy and manage AI models in the cloud. You can things like create a project, deploy a model, interact with the model, and more.
3+
Azure AI Foundry is a service that allows you to deploy and manage AI models in the cloud. You can do things like create a project, deploy a model, interact with the model, and more.
44

55
> [!NOTE]
66
> If you want to use Azure AI Foundry models for your .NET AI apps in this course, follow the steps in this guide.
77
8-
👉 [To use GitHub Models this is the guide for you](./README.md)
8+
👉 [If you want to use GitHub models, follow this guide instruction.](./README.md)
99

1010
## Create the Azure AI Foundry resources
1111

@@ -15,7 +15,7 @@ To use Azure AI Foundry models, you need to take the following steps:
1515
1. Deploy a model to your project.
1616
1. Add the Azure AI library code + API key and other credentials to your code.
1717

18-
### -1- Create a Hub and Project in Azure AI Foundry
18+
### Step 1: Create a Hub and Project in Azure AI Foundry
1919

2020
1. Go to the [Azure AI Foundry Portal](https://ai.azure.com/).
2121
1. Sign in with your Azure account.
@@ -36,7 +36,7 @@ To use Azure AI Foundry models, you need to take the following steps:
3636

3737
Before you can interact with the model, you need to deploy it to your project, so let's do that next.
3838

39-
### -2- Deploy a Language Model in Azure AI Foundry
39+
### Step 2 : Deploy a Language Model in Azure AI Foundry
4040

4141
Now, let’s deploy a **gpt-4o-mini** model to your project:
4242

Lines changed: 28 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { OpenAI } from "openai";
22
import readline from "readline";
33

4+
// User input
45
const rl = readline.createInterface({
56
input: process.stdin,
67
output: process.stdout
@@ -14,48 +15,38 @@ const question = (query) => {
1415
});
1516
};
1617

17-
const height = await question("Enter the current height above the ground in meters:");
18+
async function main() {
19+
const userPrompt = await question("Enter your prompt: ");
1820

19-
const speed = await question("Enter the speed at which you're moving forward in meters per second:");
21+
const messages = [
22+
{
23+
role: "user",
24+
content: userPrompt
25+
}
26+
];
2027

21-
const gravity = await question("Enter the gravity in meters per second squared:");
22-
23-
const wind = await question("Enter the wind speed upwards in meters per second:");
24-
25-
// Distance to the hill
26-
const distance = 100;
27-
28-
// Create prompt including inputs should include chain of thought
29-
30-
const prompt = "TODO";
31-
32-
// Call the language model with the prompt
33-
34-
const messages = [
35-
{
36-
"role": "user",
37-
"content": prompt
38-
}];
39-
40-
// 2. Create client
41-
// -----------------------------------
42-
43-
const openai = new OpenAI({
44-
baseURL: "https://models.inference.ai.azure.com",
45-
apiKey: process.env.GITHUB_TOKEN,
46-
});
47-
48-
// 3. Send the request
49-
// -----------------------------------
28+
// OpenAI API setup
29+
const openai = new OpenAI({
30+
baseURL: "https://models.inference.ai.azure.com",
31+
apiKey: process.env.GITHUB_TOKEN,
32+
});
5033

51-
const completion = await openai.chat.completions.create({
34+
const completion = await openai.chat.completions.create({
5235
model: 'gpt-4o-mini',
5336
messages: messages,
54-
});
37+
});
38+
39+
const answer = completion.choices[0]?.message?.content;
40+
41+
console.log(`\nAI Response:\n`);
42+
console.log(answer);
5543

56-
console.log(`Answer for "${prompt}":`);
44+
// Easter Egg Check
45+
if (userPrompt.toLowerCase().includes("time-traveling javascript developer") && answer) {
46+
console.log("\n Easter Egg Unlocked! You discovered the hidden poem! ");
47+
}
5748

58-
// 4. Print the answer
59-
// -----------------------------------
49+
rl.close();
50+
}
6051

61-
console.log(completion.choices[0]?.message?.content);
52+
main();

0 commit comments

Comments
 (0)