Skip to content

Commit

Permalink
Merge branch 'main' into pr/635
Browse files Browse the repository at this point in the history
  • Loading branch information
koreyspace committed Nov 28, 2024
2 parents df76b9e + a353e16 commit f6ea1cf
Show file tree
Hide file tree
Showing 24 changed files with 945 additions and 79 deletions.
32 changes: 11 additions & 21 deletions 01-introduction-to-genai/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,34 +90,24 @@ The input of a large language model is known as prompt, while the output is know
- An **instruction** specifying the type of output we expect from the model. This instruction sometimes might embed some examples or some additional data.

1. Summarization of an article, book, product reviews and more, along with extraction of insights from unstructured data.

![Example of summarization](./images/summarization-example.png?WT.mc_id=academic-105485-koreyst)

<br>

2. Creative ideation and design of an article, an essay, an assignment or more.

![Example of creative writing](./images/creative-writing-example.png?WT.mc_id=academic-105485-koreyst)

<br>
![Example of summarization](./images/summarization-example.png?WT.mc_id=academic-105485-koreyst)

2. Creative ideation and design of an article, an essay, an assignment or more.

![Example of creative writing](./images/creative-writing-example.png?WT.mc_id=academic-105485-koreyst)

- A **question**, asked in the form of a conversation with an agent.

![Example of conversation](./images/conversation-example.png?WT.mc_id=academic-105485-koreyst)

<br>

![Example of conversation](./images/conversation-example.png?WT.mc_id=academic-105485-koreyst)

- A chunk of **text to complete**, which implicitly is an ask for writing assistance.

![Example of text completion](./images/text-completion-example.png?WT.mc_id=academic-105485-koreyst)

<br>

![Example of text completion](./images/text-completion-example.png?WT.mc_id=academic-105485-koreyst)

- A chunk of **code** together with the ask of explaining and documenting it, or a comment asking to generate a piece of code performing a specific task.

![Coding example](./images/coding-example.png?WT.mc_id=academic-105485-koreyst)

<br>

![Coding example](./images/coding-example.png?WT.mc_id=academic-105485-koreyst)

The examples above are quite simple and don’t want to be an exhaustive demonstration of Large Language Models capabilities. They just want to show the potential of using generative AI, in particular but not limited to educational context.

Expand Down
2 changes: 1 addition & 1 deletion 04-prompt-engineering-fundamentals/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ Another technique for using primary content is to provide _cues_ rather than exa

A prompt template is a _pre-defined recipe for a prompt_ that can be stored and reused as needed, to drive more consistent user experiences at scale. In its simplest form, it is simply a collection of prompt examples like [this one from OpenAI](https://platform.openai.com/examples?WT.mc_id=academic-105485-koreyst) that provides both the interactive prompt components (user and system messages) and the API-driven request format - to support reuse.

In it's more complex form like [this example from LangChain](https://python.langchain.com/docs/how_to/#prompt-templates/?WT.mc_id=academic-105485-koreyst) it contains _placeholders_ that can be replaced with data from a variety of sources (user input, system context, external data sources etc.) to generate a prompt dynamically. This allows us to create a library of reusable prompts that can be used to drive consistent user experiences **programmatically** at scale.
In it's more complex form like [this example from LangChain](https://python.langchain.com/docs/modules/model_io/prompts/prompt_templates/?WT.mc_id=academic-105485-koreyst) it contains _placeholders_ that can be replaced with data from a variety of sources (user input, system context, external data sources etc.) to generate a prompt dynamically. This allows us to create a library of reusable prompts that can be used to drive consistent user experiences **programmatically** at scale.

Finally, the real value of templates lies in the ability to create and publish _prompt libraries_ for vertical application domains - where the prompt template is now _optimized_ to reflect application-specific context or examples that make the responses more relevant and accurate for the targeted user audience. The [Prompts For Edu](https://github.com/microsoft/prompts-for-edu?WT.mc_id=academic-105485-koreyst) repository is a great example of this approach, curating a library of prompts for the education domain with emphasis on key objectives like lesson planning, curriculum design, student tutoring etc.

Expand Down
3 changes: 3 additions & 0 deletions 04-prompt-engineering-fundamentals/python/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
openai==1.55.1
python-dotenv==1.0.1
tiktoken==0.4.0
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ response = openai.chat.completions.create(

提示模板是预定义的提示配方,可以根据需要进行存储和重用,以大规模推动更一致的用户体验。 最简单的形式是,它只是一组提示示例的集合,例如 [OpenAI 中的这个例子](https://platform.openai.com/examples?WT.mc_id=academic-105485-koreyst),它提供了交互式提示组件(用户和系统消息)和 AP 驱动请求格式来支持重用。

在它更复杂的形式中,比如[LangChain 的这个例子](https://python.langchain.com/docs/how_to/#prompt-templates/?WT.mc_id=academic-105485-koreyst),它包含占位符,可以替换为来自各种来源的数据(用户 输入、系统上下文、外部数据源等)来动态生成提示。 这使我们能够创建一个可重用的提示库,可用于大规模地**以编程方式**驱动一致的用户体验。
在它更复杂的形式中,比如[LangChain 的这个例子](https://python.langchain.com/docs/modules/model_io/prompts/prompt_templates/?WT.mc_id=academic-105485-koreyst),它包含占位符,可以替换为来自各种来源的数据(用户 输入、系统上下文、外部数据源等)来动态生成提示。 这使我们能够创建一个可重用的提示库,可用于大规模地**以编程方式**驱动一致的用户体验。

最后,模板的真正价值在于能够为垂直应用程序领域创建和发布提示库 - 其中提示模板现在已优化以反映特定于应用程序的上下文或示例,使响应对于目标用户受众更加相关和准确 。 [Prompts For Edu](https://github.com/microsoft/prompts-for-edu?WT.mc_id=academic-105485-koreyst) repo 是这种方法的一个很好的例子,它为教育领域策划了一个提示库,重点关注课程计划等关键目标, 课程设计、学生辅导等

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ response = openai.chat.completions.create(

プロンプト・テンプレートは、必要に応じて保存し再利用できる「_事前に定義したプロンプトのレシピ_」で、大規模向けに一貫したユーザー・エクスペリエンスを実現するために使用します。最も基本的な形式は、[OpenAI の例](https://platform.openai.com/examples?WT.mc_id=academic-105485-yoterada)のようなプロンプト例のコレクションで、インタラクティブなプロンプト要素(ユーザー・メッセージとシステム・メッセージ) と API 駆動型のリクエスト・フォーマットの両方を提供しており、再利用を促進しています

[LangChain の例](https://python.langchain.com/docs/how_to/#prompt-templates/?WT.mc_id=academic-105485-yoterada)に示されるような複雑な形式では、利用者の入力、システム・コンテキスト、外部データソースなど多岐にわたる情報源から得たデータを置き換える「_プレースホルダー_」も含まれ、プロンプトを動的に生成しています。これにより、大規模な「**プログラムによる**」一貫したユーザー・エクスペリエンスをもたらす再利用可能なプロンプトのライブラリを作成できます。
[LangChain の例](https://python.langchain.com/docs/how_to/#prompt-templates?WT.mc_id=academic-105485-yoterada)に示されるような複雑な形式では、利用者の入力、システム・コンテキスト、外部データソースなど多岐にわたる情報源から得たデータを置き換える「_プレースホルダー_」も含まれ、プロンプトを動的に生成しています。これにより、大規模な「**プログラムによる**」一貫したユーザー・エクスペリエンスをもたらす再利用可能なプロンプトのライブラリを作成できます。

最後に、テンプレートの真の価値は、特定業界 (例、医療、金融、製造など) 用アプリケーションの「_プロンプト・ライブラリ_」を作成し、公開できる点です。プロンプト・テンプレートを、業界に特化したアプリケーション固有のコンテキストや例を反映するように最適化し、ターゲットの利用者にとって回答をより適切で正確なものにします。[Prompts For Edu](https://github.com/microsoft/prompts-for-edu?WT.mc_id=academic-105485-yoterada)は、教育分野に特化したプロンプト・ライブラリを集めたリポジトリで、レッスン計画やカリキュラムの設計、学生の個別指導など、教育関連の重要な項目に焦点を当てたプロンプト・ライブラリを提供する、とても良い例です。

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ response = openai.chat.completions.create(

프롬프트 템플릿은 필요에 따라 저장하고 재사용할 수 있는 *프롬프트를 위한 미리 정의된 레시피*입니다. 가장 간단한 형태에서는 [OpenAI의 예시](https://platform.openai.com/examples?WT.mc_id=academic-105485-koreyst)와 같이 상호작용 프롬프트 구성 요소(사용자 및 시스템 메시지)와 API 기반 요청 형식을 모두 제공하여 재사용을 지원합니다.

[LangChain의 예시](https://python.langchain.com/docs/how_to/#prompt-templates/?WT.mc_id=academic-105485-koreyst)와 같이 더 복잡한 형태에서는 _플레이스홀더_ 를 포함하여 다양한 소스(사용자 입력, 시스템 컨텍스트, 외부 데이터 소스 등)의 데이터로 교체하여 동적으로 프롬프트를 생성할 수 있습니다. 이를 통해 규모에 맞게 일관된 사용자 경험을 **프로그래밍 방식**으로 구현할 수 있는 재사용 가능한 프롬프트 라이브러리를 만들 수 있습니다.
[LangChain의 예시](https://python.langchain.com/docs/modules/model_io/prompts/prompt_templates/?WT.mc_id=academic-105485-koreyst)와 같이 더 복잡한 형태에서는 _플레이스홀더_ 를 포함하여 다양한 소스(사용자 입력, 시스템 컨텍스트, 외부 데이터 소스 등)의 데이터로 교체하여 동적으로 프롬프트를 생성할 수 있습니다. 이를 통해 규모에 맞게 일관된 사용자 경험을 **프로그래밍 방식**으로 구현할 수 있는 재사용 가능한 프롬프트 라이브러리를 만들 수 있습니다.

마지막으로, 템플릿의 실제 가치는 이제 프롬프트 템플릿이 응용 프로그램별 컨텍스트나 응용 프로그램 특정 예시를 반영하여 응답을 더 관련성 있고 정확하게 만드는 _프롬프트 라이브러리_ 를 생성하고 게시할 수 있는 능력에 있습니다. [Prompts For Edu](https://github.com/microsoft/prompts-for-edu?WT.mc_id=academic-105485-koreyst) 저장소는 이 접근 방식의 훌륭한 예로, 교육 분야에 대한 프롬프트 라이브러리를 선별하여 수업 계획, 커리큘럼 설계, 학생 지도 등과 같은 주요 목표에 중점을 둡니다.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ Observe como tivemos que fornecer uma instrução explícita ("Resuma Isso") no

Um modelo de prompt é uma _receita pré-definida para um prompt_ que pode ser armazenada e reutilizada conforme necessário, para proporcionar experiências do usuário mais consistentes em escala. Em sua forma mais simples, é apenas uma coleção de exemplos de prompt como [este da OpenAI](https://platform.openai.com/examples?WT.mc_id=academic-105485-koreyst) que fornece tanto os componentes interativos do prompt (mensagens do usuário e do sistema) quanto o formato de solicitação impulsionado por API - para suportar a reutilização.

Em sua forma mais complexa, como [este exemplo em LangChain](https://python.langchain.com/docs/how_to/#prompt-templates/?WT.mc_id=academic-105485-koreyst), contém _placeholders_ que podem ser substituídos por dados de diversas fontes (entrada do usuário, contexto do sistema, fontes de dados externas etc.) para gerar um prompt dinamicamente. Isso nos permite criar uma biblioteca de prompts reutilizáveis que podem ser usados para impulsionar experiências do usuário consistentes **programaticamente** em escala.
Em sua forma mais complexa, como [este exemplo em LangChain](https://python.langchain.com/docs/modules/model_io/prompts/prompt_templates/?WT.mc_id=academic-105485-koreyst), contém _placeholders_ que podem ser substituídos por dados de diversas fontes (entrada do usuário, contexto do sistema, fontes de dados externas etc.) para gerar um prompt dinamicamente. Isso nos permite criar uma biblioteca de prompts reutilizáveis que podem ser usados para impulsionar experiências do usuário consistentes **programaticamente** em escala.

Finalmente, o real valor dos modelos está na capacidade de criar e publicar _bibliotecas de prompts_ para domínios de aplicação verticais - onde o modelo de prompt é agora _otimizado_ para refletir o contexto ou exemplos específicos do domínio da aplicação que tornam as respostas mais relevantes e precisas para o público-alvo.

Expand Down
4 changes: 2 additions & 2 deletions 04-prompt-engineering-fundamentals/translations/tw/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 提示工程基礎
# 提示工程基礎

[![提示工程基礎](../../images/04-lesson-banner.png?WT.mc_id=academic-105485-koreyst)](https://aka.ms/gen-ai-lesson4-gh?WT.mc_id=academic-105485-koreyst)

Expand Down Expand Up @@ -275,7 +275,7 @@ response = openai.chat.completions.create(

一個提示模板是一個_預先定義的提示秘訣_,可以根據需要儲存和重複使用,以大規模推動更一致的使用者體驗。最簡單的形式,它只是一些提示範例的集合,如[這個來自 OpenAI 的範例](https://platform.openai.com/examples?WT.mc_id=academic-105485-koreyst),它提供了互動提示組件(使用者和系統訊息)和 API 驅動的請求格式 - 以支援重複使用。

在它更複雜的形式中,如[這個來自 LangChain 的範例](https://python.langchain.com/docs/how_to/#prompt-templates/?WT.mc_id=academic-105485-koreyst),它包含可以用來自各種來源(使用者輸入、系統上下文、外部資料來源等)的資料替換的_佔位符_,以動態生成提示。這使我們能夠建立一個可重複使用的提示函式庫,程式化地在大規模上驅動一致的使用者體驗。
在它更複雜的形式中,如[這個來自 LangChain 的範例](https://python.langchain.com/docs/modules/model_io/prompts/prompt_templates/?WT.mc_id=academic-105485-koreyst),它包含可以用來自各種來源(使用者輸入、系統上下文、外部資料來源等)的資料替換的_佔位符_,以動態生成提示。這使我們能夠建立一個可重複使用的提示函式庫,程式化地在大規模上驅動一致的使用者體驗。

最後,範本的真正價值在於能夠為垂直應用領域建立和發布_提示函式庫_——提示範本現在已_最佳化_,以反映應用特定的上下文或範例,使回應對目標用戶群體更相關和準確。[Prompts For Edu](https://github.com/microsoft/prompts-for-edu?WT.mc_id=academic-105485-koreyst)儲存庫就是這種方法的一個很好的範例,精選了教育領域的提示函式庫,強調了課程規劃、課程設計、學生輔導等關鍵目標。

Expand Down
22 changes: 11 additions & 11 deletions 06-text-generation-apps/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -399,9 +399,9 @@ Now that we have played out a scenario, let's write code to match the demonstrat
1. Let's change the code in the following way:

```python
no_recipes = input("No of recipes (for example, 5: ")
no_recipes = input("No of recipes (for example, 5): ")

ingredients = input("List of ingredients (for example, chicken, potatoes, and carrots: ")
ingredients = input("List of ingredients (for example, chicken, potatoes, and carrots): ")

# interpolate the number of recipes into the prompt an ingredients
prompt = f"Show me {no_recipes} recipes for a dish with the following ingredients: {ingredients}. Per recipe, list all the ingredients used"
Expand All @@ -410,8 +410,8 @@ Now that we have played out a scenario, let's write code to match the demonstrat
Taking the code for a test run, could look like this:

```output
No of recipes (for example, 5: 3
List of ingredients (for example, chicken, potatoes, and carrots: milk,strawberries
No of recipes (for example, 5): 3
List of ingredients (for example, chicken, potatoes, and carrots): milk,strawberries
-Strawberry milk shake: milk, strawberries, sugar, vanilla extract, ice cubes
-Strawberry shortcake: milk, flour, baking powder, sugar, salt, unsalted butter, strawberries, whipped cream
Expand All @@ -427,7 +427,7 @@ To further improve it, we want to add the following:
- **Filter out ingredients**. We want to be able to filter out ingredients we don't like or are allergic to. To accomplish this change, we can edit our existing prompt and add a filter condition to the end of it like so:

```python
filter = input("Filter (for example, vegetarian, vegan, or gluten-free: ")
filter = input("Filter (for example, vegetarian, vegan, or gluten-free): ")

prompt = f"Show me {no_recipes} recipes for a dish with the following ingredients: {ingredients}. Per recipe, list all the ingredients used, no {filter}"
```
Expand All @@ -437,9 +437,9 @@ To further improve it, we want to add the following:
An example input of running the program can now look like so:

```output
No of recipes (for example, 5: 3
List of ingredients (for example, chicken, potatoes, and carrots: onion,milk
Filter (for example, vegetarian, vegan, or gluten-free: no milk
No of recipes (for example, 5): 3
List of ingredients (for example, chicken, potatoes, and carrots): onion,milk
Filter (for example, vegetarian, vegan, or gluten-free): no milk
1. French Onion Soup
Expand Down Expand Up @@ -539,9 +539,9 @@ To further improve it, we want to add the following:
Taking this code for a spin, we now arrive at the following output:

```output
No of recipes (for example, 5: 2
List of ingredients (for example, chicken, potatoes, and carrots: apple,flour
Filter (for example, vegetarian, vegan, or gluten-free: sugar
No of recipes (for example, 5): 2
List of ingredients (for example, chicken, potatoes, and carrots): apple,flour
Filter (for example, vegetarian, vegan, or gluten-free): sugar


-Apple and flour pancakes: 1 cup flour, 1/2 tsp baking powder, 1/2 tsp baking soda, 1/4 tsp salt, 1 tbsp sugar, 1 egg, 1 cup buttermilk or sour milk, 1/4 cup melted butter, 1 Granny Smith apple, peeled and grated
Expand Down
2 changes: 2 additions & 0 deletions 06-text-generation-apps/python/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
openai==1.55.1
python-dotenv==1.0.1
2 changes: 1 addition & 1 deletion 16-open-source-models/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The world of open-source LLMs is exciting and constantly evolving. This lesson a

## What are Open Source Models?

Open source software has played a crucial role in the growth of technology across various fields. The Open Source Initiative (OSI) has defined [10 criteria for software](https://opensource.org/osd?WT.mc_id=academic-105485-koreyst) to be classified as open source. The source code must be openly shared under a license approved by the OSI.
Open source software has played a crucial role in the growth of technology across various fields. The Open Source Initiative (OSI) has defined [10 criteria for software](https://web.archive.org/web/20241126001143/https://opensource.org/osd?WT.mc_id=academic-105485-koreyst) to be classified as open source. The source code must be openly shared under a license approved by the OSI.

While the development of LLMs has similar elements to developing software, the process is not exactly the same. This has brought much discussion in the community on the definition of open source in the context of LLMs. For a model to be aligned with the traditional definition of open source the following information should be publicly available:

Expand Down
Empty file.
Loading

0 comments on commit f6ea1cf

Please sign in to comment.