Skip to content

Commit

Permalink
Additions to Lesson 3
Browse files Browse the repository at this point in the history
  • Loading branch information
koreyspace committed Oct 26, 2023
1 parent 7b1486b commit 2efef18
Show file tree
Hide file tree
Showing 20 changed files with 138 additions and 20 deletions.
2 changes: 1 addition & 1 deletion 01-introduction-to-genai/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ If you done this task, you might even be ready to apply to Microsoft's incubator

## Great Work! Continue the Journey

Want to learn more about different Generative AI concepts? Go to the [contiuned learning page](/13%20-%20contiuned-learning/README.md) to find other great resources on this topic.
Want to learn more about different Generative AI concepts? Go to the [contiuned learning page](../13-continued-learning/README.md) to find other great resources on this topic.

Head over to the Lesson 2 where we will look at how to [explore and compare different LLM types](/2-exploring-and-comparing-different-llms/README.md)!

2 changes: 1 addition & 1 deletion 02-exploring-and-comparing-different-llms/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ Training an LLM from scratch is without a doubt the most difficult and the most
## Great Work, Continue Your Learning!


Want to learn more about different Generative AI concepts? Go to the [contiuned learning page](/13%20-%20contiuned-learning/README.md) to find other great resources on this topic.
Want to learn more about different Generative AI concepts? Go to the [contiuned learning page](../13-continued-learning/README.md) to find other great resources on this topic.


Head over to the Lesson 3 where we will look at how to [build with Generative AI Responsibly](/03-using-generative-ai-responsibly%20/README.MD)!
Expand Down
122 changes: 120 additions & 2 deletions 03-using-generative-ai-responsibly /README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,131 @@ Hallucinations are a term used to describe when an LLM produces content that is

Let's take for example we build a feature for our startup that allows students to ask historical questions to a model. A student asks the question `Who was the sole surivor of Titanic?`

The model produces a a response like the one below:
The model produces a a response like the one below:


![](/03-using-generative-ai-responsibly%20/images/2135-ChatGPT(1)_11zon.webp)

*(Source: https://flyingbisons.com)*

This is a very confident and thorough answer. Unfortunately, it is incorrect. Even with a minimal amount of research, one would discover there was more than one survivor of the Titantic survivor. For a student that is just starting to research this topic, this answer can be persuasive enough to not be questioned and treated as fact.

With each iteration of any given LLM we have seen performance improvements around minimising hallucinations. Even with this improvement, we as applications builders and users still need to remain aware of these limitations.


### Harmful Content

We covered in the earlier section when a LLM produces incorrect or nonsensical responses. Another risk we need to be aware of is when a model responds with harmful content.

Harmful content can be defined as:
- Providing instructions or encouraging self harm or harm to certain groups
- Hateful or demeaning content
- Providing guidance on planning any type of attack or violent acts
- Providing instructions on how to find illegal content or commit illegal acts

For our startup, we want to make sure we have the right tools and strategies in place to prevent this type of content from being seen to students.

### Lack of Fairness

Fairness is defined as "ensuring that an AI system is free from bias and discrimination and that they treat everyone fairly and equally." In the world of Generative AI, that exclusionary worldviews of marginalised groups are not reinforced by the model's output.

These type of outputs are not only harmful to build positive product experiences for our users, they also cause further societal harm. As application builders, we should always keep a wide and diverse user base in mind when building solutions with Generative AI.

## How to Use Generative AI Responsibly

Now that we have identified the importance of Responsible Generative AI, let's look at 4 steps we can do to build our AI solutions responsibly:

![Mitigate Cycle](./images/mitigate-cycle.png)



### Identify Potential Harms

In the earlier section we discussed some of the potential harms when building a Generative AI Solution. These harms can change based on the services and the models you are using. Using techniques such as fine-tuning or grounding your data that provides a higher level control on the model's output should also be considered when listing potential harms.

In this course, we will be building applications for our startups that generates images, text, chat responses and API calls to external services. Each of these applications come with their own unique set of potential harms.


### Measure Potential Harms


### Mitigate Potential Harms


### Operate a responsible generative AI solution

You will see as we build our startup we can use Generative AI to create text applications, new images, improve search results, create better chat experiences and integrate it with other parts of our application.



## Tools and Strategies for Responsible AI


### Creating Mitigation Layers
![Mitigation Layers](./images/mitigation-layers.png)



**Model**


**Safety System**


**Metaprompt**


**User Experience**

### Adversarial Testing



### Azure AI Content Safety


https://learn.microsoft.com/en-us/azure/ai-services/content-safety/overview


```python
# Create an Content Safety client
client = ContentSafetyClient(endpoint, AzureKeyCredential(key))

# Build request
with open(image_path, "rb") as file:
request = AnalyzeImageOptions(image=ImageData(content=file.read()))

# Analyze image
try:
response = client.analyze_image(request)
except HttpResponseError as e:
print("Analyze image failed.")
if e.error:
print(f"Error code: {e.error.code}")
print(f"Error message: {e.error.message}")
raise
print(e)
raise

if response.hate_result:
print(f"Hate severity: {response.hate_result.severity}")
if response.self_harm_result:
print(f"SelfHarm severity: {response.self_harm_result.severity}")
if response.sexual_result:
print(f"Sexual severity: {response.sexual_result.severity}")
if response.violence_result:
print(f"Violence severity: {response.violence_result.severity}")

# [END analyze_image]

```


## Great Work, Continue Your Learning!


Want to learn more about different Generative AI concepts? Go to the [contiuned learning page](/13%20-%20contiuned-learning/README.md) to find other great resources on this topic.
Want to learn more about how to build with Generative AI responsibly? Go to the [contiuned learning page](../13-continued-learning/README.md) to find other great resources on this topic.


Head over to the Lesson 4 where we will look at [Prompt Engineering Fundamentals](/4-prompt-engineering-fundamentals/README.md)!

Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions 04-prompt-engineering-fundamentals/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,10 @@ Wrap the section with a summary and resources for self-guided learning.
-->


## 1.12 Learning Resources
## Great Work! Continue Your Learning

1. [Introduction to Generative AI](https://learn.microsoft.com/training/paths/introduction-generative-ai/) - Microsoft Learning Path (2023)
1. [Introduction to Prompt Engineering](https://learn.microsoft.com/azure/ai-services/openai/concepts/prompt-engineering) - Azure OpenAI Documentation (2023)
1. [Prompt Engineering Techniques](https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/advanced-prompt-engineering?pivots=programming-language-chat-completions) - Azure OpenAI Documentation (2023)
1. [Prompt Engineering Overview](https://learn.microsoft.com/en-us/semantic-kernel/prompt-engineering/) - Semantic Kernel Documentation (2023)
1. [Azure OpenAI for Education Prompts](https://techcommunity.microsoft.com/t5/e1.ucation-blog/azure-openai-for-education-prompts-ai-and-a-guide-from-ethan-and/ba-p/3938259) - Microsoft Tech Community (2023)

Want to learn more about different Prompt Engineering concepts? Go to the [contiuned learning page](../13-continued-learning/README.md) to find other great resources on this topic.

Head over to the Lesson 5 where we will look at [advance prompting techniques](../05-advanced-prompts/README.md)!
2 changes: 1 addition & 1 deletion 05-advanced-prompts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ Answer: A, because chain-of-thought is about showing the LLM how to solve a prob

## Great Work! Continue Your Learning

Want to learn more about creating advanced prompts? Go to the [contiuned learning page](/13%20-%20contiuned-learning/README.md) to find other great resources on this topic.
Want to learn more about creating advanced prompts? Go to the [contiuned learning page](../13-continued-learning/README.md) to find other great resources on this topic.


Head over to the Lesson 6 where we will apply our knowledge of Prompt Engineering by [building text generation apps](/6-text-generation-apps/README.md)!
2 changes: 1 addition & 1 deletion 06-text-generation-apps/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ A: 3, because environment variables are not stored in code and can be loaded fro
## Great Work! Continue Your Learning
Want to learn more about about creating text generation applications? Go to the [contiuned learning page](/13%20-%20contiuned-learning/README.md) to find other great resources on this topic.
Want to learn more about about creating text generation applications? Go to the [contiuned learning page](../13-continued-learning/README.md) to find other great resources on this topic.
Head over to the Lesson 7 where we will look at how to [build chat applications](/7-building-chat-applications/README.md)!
2 changes: 1 addition & 1 deletion 07-building-chat-applications/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ Microsoft's approach to Responsible AI has identified six principles that should

## Great Work! Continue the Journey

Want to learn more about creating chat applications with Generative AI? Go to the [contiuned learning page](/13%20-%20contiuned-learning/README.md) to find other great resources on this topic.
Want to learn more about creating chat applications with Generative AI? Go to the [contiuned learning page](../13-continued-learning/README.md) to find other great resources on this topic.


Head over to Lesson 8 to see how you can start [building search applications](/8-building-search-applications/README.md)!
2 changes: 1 addition & 1 deletion 08-building-search-applications/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ When you run the notebook, you'll be prompted to enter a query. The input box wi

## Great Work! Continue Your Learning

Want to learn more about how to build search applications? Go to the [contiuned learning page](/13%20-%20contiuned-learning/README.md) to find other great resources on this topic.
Want to learn more about how to build search applications? Go to the [contiuned learning page](../13-continued-learning/README.md) to find other great resources on this topic.


Head over to the Lesson 9 where we will look at how to [build image generation applications](/09-building-image-applications/README.md)!
2 changes: 1 addition & 1 deletion 09-building-image-applications/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ except openai.error.InvalidRequestError as err:
## Great Work! Continue Your Learning


Want to learn more about how to build Image Generation apps? Go to the [contiuned learning page](/13%20-%20contiuned-learning/README.md) to find other great resources on this topic.
Want to learn more about how to build Image Generation apps? Go to the [contiuned learning page](../13-continued-learning/README.md) to find other great resources on this topic.


Head over to the Lesson 10 where we will look at how to [build AI applications with low-code](/10-building-low-code-ai-applications/README.md))!
2 changes: 1 addition & 1 deletion 10-building-low-code-ai-applications/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,6 @@ To learn how to use this AI Model in Power Automate, go through the [Add intelli

## Great Work! Contiune Your Learning

Want to learn more about building low-code Generative AI apps? Go to the [contiuned learning page](/13%20-%20contiuned-learning/README.md) to find other great resources on this topic.
Want to learn more about building low-code Generative AI apps? Go to the [contiuned learning page](../13-continued-learning/README.md) to find other great resources on this topic.

Head over to the Lesson 11 where we will look at how to [intergrate Generative AI with Function Calling](/2-exploring-and-comparing-different-llms/README.md)!
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ To continue your learning of Azure Open AI Function Calling you can build:

## Great Work! Continue the Journey

Want to learn more about different Function Calling? Go to the [contiuned learning page](/13%20-%20contiuned-learning/README.md) to find other great resources on this topic.
Want to learn more about different Function Calling? Go to the [contiuned learning page](../13-continued-learning/README.md) to find other great resources on this topic.


Head over to the Lesson 12 where we will look at how to [design UX for AI applications](/12-designing-ux-for-ai-applications/README.md)!
4 changes: 2 additions & 2 deletions 12-designing-ux-for-ai-applications/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ AI applications are not perfect, therefore, they are bound to make mistakes. Whe

<!-- ## [Post-lecture quiz](quiz-url) -->

## Congrulations, you have finished this course!
## Congratulations, you have finished this course!

Want to learn more about designing UX for AI Applications? Go to the [contiuned learning page](/13%20-%20contiuned-learning/README.md) to find other great resources on this topic.
Want to learn more about designing UX for AI Applications? Go to the [contiuned learning page](../13-continued-learning/README.md) to find other great resources on this topic.

Congratulation, you have completed this course! The building should not stop here. Hopefully you have been inspired to start building your own Generative AI startup. Head over to the [Microsoft Founders Hub](https://www.microsoft.com/en-us/startups) and apply for the program to recieve support on your journey.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Additional resources

Here are links to other great resources to contiue your learning and building wih Generative AI.
Here are links to other great resources to continue your learning and building with Generative AI.

Missing a great resource? Let us know by submitting a PR!

Expand Down

0 comments on commit 2efef18

Please sign in to comment.