microsoftlearning / mslearn-openai Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://microsoftlearning.github.io/mslearn-openai/
License: MIT License
Home Page: https://microsoftlearning.github.io/mslearn-openai/
License: MIT License
Description of issue
For all the exercises located here Azure OpenAI Exercises, there is no option to set the content theme similar to the standard MS Lean approach.
Repro steps:
Description of issue
Console.ReadLine()
will only get the first line and submit this as user prompt.Description of issue
After saving the data upload/indexing setup, it takes many minutes to finish (even if index is ready , as we can see in Azure Portal).
Many times it even gives a warning of index not found.
WORKAROUND IN CLASS:
Description of issue
Having changed the appsettings /env entries to aoiDeployment name, the code also needs to be updated as it still references aoiModelname
Repro steps:
Description of issue
With the March 2024 update, the learning path 6 exercise was changed to 'Exercise: Implement Retrieval Augmented Generation (RAG) with Azure OpenAI Service', previously it was 'Exercise: Use your own data with Azure OpenAI Service'. The repository doesn't have the instructions for the update exercise.
Description of issue
Python requests
in Lab6 is not accessed. See in:
https://github.com/MicrosoftLearning/mslearn-openai/blob/main/Labfiles/06-use-own-data/Python/ownData.py#L2
Note
While in Lab5, it is accessed for Post API.
Description of issue:
The following text provided doesn't match the lab scenario, it's not about summarization and there's no sample text file provided.
"Applications for both C# and Python have been provided, as well as a sample text file you’ll use to test the summarization. Both apps feature the same functionality."
Description of issue
Upon executing the code, line 26 does not complete successfully.
submission = requests.post(url, headers=headers, json=body)
Printing the error message shows the following error
POST request status code: 404
POST request response: {'error': {'code': 'notFound', 'message': 'Task not found.'}}
As a result, the next command errors and throws an exception:
operation_location = submission.headers['Operation-Location']
Repro steps:
Description of issue
Step 5 says:
While the storage account resource is being created, return to Azure OpenAI Studio and select Create a new Azure AI Search resource with the following settings.
The issue is where is the button or link to create the AI Search Resource in the OpenAI Studio?
Description of issue
Currently Lab 5 is using DALL-E 2 which is only available in East US. Suggest using DALL-E 3 which is now available in both East US & Sweden Central to avoid a single point of failure and for load balancing purposes.
Repro steps:
Both C# & Python environment needs to include a third variable to account for the DALL-E 3 deployment ID. Also the request string the main code body needs to be changed as well. Reference this document for more details. https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#request-a-generated-image-dall-e-3
In 04-code-generation.md, it looks like the intro paragraph to the Generate code in chat playground section was copied from a previous lab (unless the code creates animals with really fun names!)
Here's what's there:
Before using your app, examine how prompt engineering improves the model response in the playground. In this first example, imagine you are trying to write a python app of animals with fun names.
Description of issue
Configure your application - refers to text file to be summarized - this is NOT related to image generation.
"Applications for both C# and Python have been provided, as well as a sample text file you’ll use to test the summarization. Both apps feature the same functionality. "
Repro steps:
Description of issue
In Lab4, the python script could never find the function.py file.
Note I am running this on my local machine.
Repro steps:
Run the script and choose #1, enter in a prompt, and it will return err 2
Resolution
I added in the following code which changed my working folder to the folder containing the lab 4 script:
# Change the current working directory to the script's directory
script_directory = os.path.dirname(os.path.abspath(__file__))
os.chdir(script_directory)
Description of issue
There is no namespace or main() method in the CSharp Program.cs file.
Repro steps:
Description of issue: The guidelines are not clear; it's not specified in which file the modification should be done, and it's not clear when we're referring to PowerShell or Code Editor. Please review the suggested modifications in the repro steps.
Repro steps:
4. Replace "Navigate to the folder for your preferred language and install the necessary packages" with "Install the necessary packages for your preferred language in Bash in your Cloud Shell."
5. Replace "Navigate to your preferred language folder, select the code file, and add the necessary libraries." with "Navigate to your preferred language folder, and open the file named 'test-openai-model.py' or 'program.cs'. Then, add the necessary libraries by including the following code:"
6. Replace "Open up the application code for your language and add the necessary code for building the request, which specifies the various parameters for your model such as prompt and temperature." by "In the same file as in the previous step, add the missing necessary code for building the request. This code specifies various parameters for your model, such as prompt and temperature."
When trying to deploy model to a web app as stated at the end of the https://microsoftlearning.github.io/mslearn-openai/Instructions/Exercises/01-get-started-azure-openai.html nothing happened. Deployment was in progress for a quite long time (hours) but did not finished.
What could have gone wrong?
Description of issue
Repro steps:
getting error in python executing.
\Labfiles\02-nlp-azure-openai\Python\test-openai-model.py
print("Summary: " + response.choices[0].message.content + "\n")
Step 5
Add code to use the Azure OpenAI service
I try to update the code like you can see
but i have error
// Implicit using statements are included
using System.Text;
using System.Text.Json;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration.Json;
using Azure;
// Add Azure OpenAI package
using Azure.AI.OpenAI;
// Build a config object and retrieve user settings.
IConfiguration config = new ConfigurationBuilder()
.AddJsonFile("appsettings.json")
.Build();
string? oaiEndpoint = config["AzureOAIEndpoint"];
string? oaiKey = config["AzureOAIKey"];
string? oaiDeploymentName = config["AzureOAIDeploymentName"];
if(string.IsNullOrEmpty(oaiEndpoint) || string.IsNullOrEmpty(oaiKey) || string.IsNullOrEmpty(oaiDeploymentName) )
{
Console.WriteLine("Please check your appsettings.json file for missing or incorrect values.");
return;
}
// Initialize the Azure OpenAI client...
// Initialize the Azure OpenAI client
OpenAIClient client = new OpenAIClient(new Uri(oaiEndpoint), new AzureKeyCredential(oaiKey));
// System message to provide context to the model
string systemMessage = "I am a hiking enthusiast named Forest who helps people discover hikes in their area. If no area is specified, I will default to near Rainier National Park. I will then provide three suggestions for nearby hikes that vary in length. I will also share an interesting fact about the local nature on the hikes when making a recommendation.";
do {
Console.WriteLine("Enter your prompt text (or type 'quit' to exit): ");
string? inputText = Console.ReadLine();
if (inputText == "quit") break;
// Generate summary from Azure OpenAI
if (inputText == null) {
Console.WriteLine("Please enter a prompt.");
continue;
}
Console.WriteLine("\nSending request for summary to Azure OpenAI endpoint...\n\n");
// Add code to send request...
// Build completion options object
ChatCompletionsOptions chatCompletionsOptions = new ChatCompletionsOptions()
{
Messages =
{
new ChatRequestSystemMessage(systemMessage),
new ChatRequestUserMessage(inputText),
},
MaxTokens = 400,
Temperature = 0.7f,
DeploymentName = oaiDeploymentName
};
// Send request to Azure OpenAI model
ChatCompletions response = client.GetChatCompletions(chatCompletionsOptions);
// Print the response
string completion = response.Choices[0].Message.Content;
Console.WriteLine("Response: " + completion + "\n");
} while (true);
Description of issue
Typo
Observe the prompt input, and generated output. This time you'll likely see the email in a similar format, but with a much less informal tone. You'll likely even see jokes included!
Should read:
Observe the prompt input, and generated output. This time you'll likely see the email in a similar format, but with a much more informal tone. You'll likely even see jokes included!
Repro steps:
My issue was basically the same as #33 so I am closing this
Description of issue
Based on the changes introduced by PR #34
We need to change instructions line 146 to
model=azure_oai_deployment
Repro steps:
Description of issue
New messages (completions) from the model should be added with "assistant" role and not "system" to the messages array.
Repro steps:
Python code provided for step 5:
# Add code to send request...
# Send request to Azure OpenAI model
messages_array.append({"role": "user", "content": input_text})
response = client.chat.completions.create(
model=azure_oai_deployment,
temperature=0.7,
max_tokens=1200,
messages=messages_array
)
generated_text = response.choices[0].message.content
# Add generated text to messages array
messages_array.append({"role": "system", "content": generated_text})
# Print generated text
print("Summary: " + generated_text + "\n")
Recommended to change from "system" to "assistant":
# Add generated text to messages array
messages_array.append({"role": "assistant", "content": generated_text})
Description of issue
References in code and instructions to the model
name are incorrect and should be deployment
Description of issue
All python imports python-dotenv:
from dotenv import load_dotenv
but throw ModuleNotFoundError: No module named 'dotenv'
if not install python-dotenv in advance.
Description of issue
dotnet add package Azure.AI.OpenAI --prerelease
The above package is no longer available, suggest to use the same package as described in Lab 3
There is a Markdown issue that results in applying programming language formatting (C#, perhaps, as the repo default), to English prompt, resulting in strange formatting. For example, note the color coding in Lab 1:
Compare with the correct Markdown for Lab 3. All text is consistently styled:
Please adjust Markdown in the impacted labs accordingly.
Description of issue
Instructions read "In Azure OpenAI Studio, create a new deployment with the following settings:
Model: gpt-35-turbo"
I was unable to complete the instructions because I received an error message when I tried to create a deployment for the gpt-35-turbo model. Please see screen image 1.
When I selected the command to request more quota, this message was displayed:
Azure OpenAI Service: Request for Quota Increase
This form is used to submit requests for increased Azure OpenAI TPM (tokens-per-minute) quota.
Quota increases for text-davinci-003, gpt-35-turbo, and gpt-4 are temporarily paused due to substantial demand for these models. However, we are accepting requests and will fill them in the order they are received once our process resumes. Priority will be given to customers who generate traffic that consumes the existing quota allocation, and your request may be denied if this condition is not met.
Please see screen image 2.
link->Azure OpenAI Service: Request for Quota Increase (microsoft.com)
I was able to complete the steps by using the gpt-35-turbo-16k model instead.
Repro steps:
The AI-050 has 6 labs, which are rather similar from the code boiler-plate perspective. The lab hoster (Skillable) has these as 6 separate labs, each only allows the VM to run for 60-90 minutes. It wastes a lot of time for 1-day class. You have to boot up each lab, then re-download the lab files, re-install any packages for Python, build a new OpenAI environment and then deploy a model... Like 10-15 minutes for each lab.
Is there any discussion about making this just one 8-hour VM environment so we only have to build everything once, and can then just work through the code for each lab?
Hi,
I am trying to follow the instructions in the repo https://github.com/MicrosoftLearning/mslearn-openai/blob/main/Instructions/Exercises/02-natural-language-azure-openai.md and in the section:
Add code to use the Azure OpenAI service -> Step 2 -> while adding a new chat message I am facing an error. Is it because the class chatmessage doesn't exist in the Azure.AI.OpenAI namespace and documentation has to be corrected as below. Could you please help on this?
Messages =
{
// new ChatMessage(ChatRole.System, "You are a helpful assistant."), --> old code
new ChatRequestSystemMessage(""You are a helpful assistant.""),
// new ChatMessage(ChatRole.User, "Summarize the following text in 20 words or less:\n" + text), -->old code
new ChatRequestUserMessage("Summarize the following text in 20 words or less:\n" + text),
},
Error: The type or namespace name 'ChatMessage' could not be found
Thanks,
Nethra
Can these labs please be upgraded from GPT-3.5 to GPT-4?
There would probably be no appreciable difference, however, we will be showing attendees how to deploy cutting-edge models.
My understanding is that these labs are on GPT-3.5 purely for historical reasons.
When running the code for Lab05 Image generation with DALL-E.
I always get an 'The given header was not found' when executing this line:
var callback_url = init_response.Headers.GetValues("operation-location").FirstOrDefault();
the init_response gives me a 404 error
the AzureOAIEndpoint is the same as in other labs that are working,
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.