Skip to content

Commit 440b707

Browse files
committed
2 parents 0a6d588 + 0635d77 commit 440b707

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

Instructions/Exercises/04-code-generation.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ Before using in your app, examine how Azure OpenAI can generate and explain code
7171
def multiply(a, b):
7272
result = 0
7373
negative = False
74-
7574
if a < 0 and b > 0:
7675
a = -a
7776
negative = True
@@ -81,16 +80,13 @@ Before using in your app, examine how Azure OpenAI can generate and explain code
8180
elif a < 0 and b < 0:
8281
a = -a
8382
b = -b
84-
8583
while b > 0:
8684
result += a
87-
b -= 1
88-
85+
b -= 1
8986
if negative:
9087
return -result
9188
else:
9289
return result
93-
9490
```
9591
9692
The model should describe what the function does, which is to multiply two numbers together by using a loop.
@@ -156,7 +152,7 @@ Now you're ready to use the Azure OpenAI SDK to consume your deployed model.
156152
using Azure.AI.OpenAI;
157153
```
158154
159-
**Python**: prompt-engineering.py
155+
**Python**: code-generation.py
160156
161157
```python
162158
# Add Azure OpenAI package

Instructions/Exercises/05-generate-images.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,9 @@ Now that you've reviewed the code, it's time to run it and generate some images.
109109

110110
4. Wait for the image to be generated - a hyperlink will be displayed in the terminal pane. Then select the hyperlink to open a new browser tab and review the image that was generated.
111111

112-
5. Close the browser tab containing the generated image and re-run the app to generate a new image with a different prompt.
112+
> **TIP**: If the app can't find the header, wait a minute and try again. Newly deployed resources can take up to 5 minutes to become available.
113+
114+
6. Close the browser tab containing the generated image and re-run the app to generate a new image with a different prompt.
113115

114116
## Clean up
115117

Labfiles/05-image-generation/CSharp/Program.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,22 @@ namespace generate_image
1212
{
1313
class Program
1414
{
15-
private static string aoaiEndpoint;
16-
private static string aoaiKey;
15+
private static string? aoaiEndpoint;
16+
private static string? aoaiKey;
1717
static async Task Main(string[] args)
1818
{
1919
try
2020
{
2121
// Get config settings from AppSettings
2222
IConfigurationBuilder builder = new ConfigurationBuilder().AddJsonFile("appsettings.json");
2323
IConfigurationRoot configuration = builder.Build();
24-
aoaiEndpoint = configuration["AzureOAIEndpoint"];
25-
aoaiKey = configuration["AzureOAIKey"];
24+
aoaiEndpoint = configuration["AzureOAIEndpoint"] ?? "";
25+
aoaiKey = configuration["AzureOAIKey"] ?? "";
2626

2727
// Get prompt for image to be generated
2828
Console.Clear();
29-
string prompt = "";
3029
Console.WriteLine("Enter a prompt to request an image:");
31-
prompt = Console.ReadLine();
30+
string prompt = Console.ReadLine() ?? "";
3231

3332
// Make the initial call to start the job
3433
using (var client = new HttpClient())

Labfiles/05-image-generation/CSharp/generate_image.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
</PropertyGroup>
9+
<PropertyGroup>
10+
<MSBuildWarningsAsMessages>$(MSBuildWarningsAsMessages);CS8600;CS8602</MSBuildWarningsAsMessages>
11+
</PropertyGroup>
912

1013
<ItemGroup>
1114
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />

0 commit comments

Comments
 (0)