From ca41fe2672fd3c5b9056d2ab268f044d2da1bbcc Mon Sep 17 00:00:00 2001 From: chris Date: Wed, 26 Feb 2025 19:22:25 +0000 Subject: [PATCH 1/3] Update README.md --- lessons/01-intro-to-genai/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lessons/01-intro-to-genai/README.md b/lessons/01-intro-to-genai/README.md index 1a653c1a..42af1785 100644 --- a/lessons/01-intro-to-genai/README.md +++ b/lessons/01-intro-to-genai/README.md @@ -24,7 +24,7 @@ By now, you've likely heard of tools like ChatGPT or Generative AI. The concept Moreover, Generative AI has evolved into multi modal capabilities, allowing you to provide an image or video as input and receive a variety of outputs. This advancement has significantly enhanced many people's workflows—not only by generating text but also by summarizing, translating, and more. -*Simply put, natural language prompts are becoming the new standard interface for many apps—and your users expect to use them.* +*Simply put, natural language interfaces are becoming the new standard interface for many apps—and your users expect to use them.* ## Narrative: A Journey Through Time From 0b406504dcef712ea41cbb05936071563eade5d2 Mon Sep 17 00:00:00 2001 From: chris Date: Wed, 26 Feb 2025 19:47:28 +0000 Subject: [PATCH 2/3] fixing a lot of small things --- lessons/01-intro-to-genai/README.md | 4 ++++ lessons/02-first-ai-app/README.md | 12 ++++++------ lessons/03-prompt-engineering/README.md | 6 +++--- .../03-prompt-engineering/solutions/solution.md | 2 +- lessons/04-structured-output/README.md | 14 ++++++++------ lessons/04-structured-output/solution/solution.md | 4 ++-- lessons/05-rag/README.md | 3 --- 7 files changed, 24 insertions(+), 21 deletions(-) diff --git a/lessons/01-intro-to-genai/README.md b/lessons/01-intro-to-genai/README.md index 42af1785..38ced699 100644 --- a/lessons/01-intro-to-genai/README.md +++ b/lessons/01-intro-to-genai/README.md @@ -349,3 +349,7 @@ Which of the following statements about Generative AI and JavaScript are true? 1. JavaScript powered Generative AI apps can only generate text. 2. JavaScript can be used to build AI-powered applications, including chatbots, text generation tools, and more. 3. Python is the only language used for AI development. + +## References + +- [Generative Ai JavaScript video series](https://genai-js) diff --git a/lessons/02-first-ai-app/README.md b/lessons/02-first-ai-app/README.md index 3257ae07..46dbc9a4 100644 --- a/lessons/02-first-ai-app/README.md +++ b/lessons/02-first-ai-app/README.md @@ -469,7 +469,7 @@ Leonardo suddenly asked to inspect the time beetle closer, he looked at it from > [!NOTE] -> **The aerial screw, also known as the helical air screw,was intended to lift off the ground by compressing air. Leonardo's design featured a large, spiral-shaped rotor made of linen, stiffened with starch, and mounted on a wooden platform. The idea was that a crew of men would run around the platform, turning cranks to rotate the screw rapidly enough to achieve lift +> The aerial screw, also known as the helical air screw,was intended to lift off the ground by compressing air. Leonardo's design featured a large, spiral-shaped rotor made of linen, stiffened with starch, and mounted on a wooden platform. The idea was that a crew of men would run around the platform, turning cranks to rotate the screw rapidly enough to achieve lift > > Although Leonardo never built a full-scale version of the aerial screw, his sketches and notes provide detailed insights into how he envisioned it working. He believed that if the screw was turned quickly enough, it would push against the air and lift the entire structure off the ground. > @@ -506,8 +506,8 @@ A3: The context window determines how creative the AI's responses are. ## References -- [1] [Text generation](https://platform.openai.com/docs/guides/text-generation) -- [2] [JavaScript library for OpenAI](https://github.com/openai/openai-node/tree/master/examples) -- [3] [Tokenizer](https://platform.openai.com/tokenizer) -- [4] [Completion API](https://platform.openai.com/docs/api-reference/completions) -- [5] [Chat completions](https://platform.openai.com/docs/guides/text-generation#text-generation-models) +- [Text generation](https://platform.openai.com/docs/guides/text-generation) +- [JavaScript library for OpenAI](https://github.com/openai/openai-node/tree/master/examples) +- [Tokenizer](https://platform.openai.com/tokenizer) +- [Completion API](https://platform.openai.com/docs/api-reference/completions) +- [Chat completions](https://platform.openai.com/docs/guides/text-generation#text-generation-models) diff --git a/lessons/03-prompt-engineering/README.md b/lessons/03-prompt-engineering/README.md index 20dd9280..24ae682d 100644 --- a/lessons/03-prompt-engineering/README.md +++ b/lessons/03-prompt-engineering/README.md @@ -143,7 +143,7 @@ If you also want to hear some background music of what it could have sounded lik **Time beetle:** Well, you want to land the aerial screw, right? -**You:** Yes, preferably in one piece. :) +**You:** Yes, preferably in one piece. ☺️ **Time beetle:** I thought so, now listen up! Prompt engineering is about crafting the right prompts to get the desired output from a language model. @@ -296,7 +296,7 @@ For the below calculation, take me through your reasoning for each step, The point to all this is that you shouldn't trust an answer coming from an AI. It's therefore a good idea to take the response through a reasoning process to ensure it is accurate. -**You:** So what I said before :) +**You:** So what I said before ☺️ ## Meta prompts @@ -362,7 +362,7 @@ As you can see the response mention products that are not provided by Contoso In **Leonardo:** can your AI gizmo help in calculating to see if we will make it or if we need to make another time jump? -**Time beetle:** I can yes, my name is George though, I prefer that over Gizmo. I'm actually going to leave it to the two of you to figure out how to set up the prompt. :) +**Time beetle:** I can yes, my name is George though, I prefer that over Gizmo. I'm actually going to leave it to the two of you to figure out how to set up the prompt. ☺️ Build an app that asks for: diff --git a/lessons/03-prompt-engineering/solutions/solution.md b/lessons/03-prompt-engineering/solutions/solution.md index ba6d9516..f0d559a5 100644 --- a/lessons/03-prompt-engineering/solutions/solution.md +++ b/lessons/03-prompt-engineering/solutions/solution.md @@ -2,7 +2,7 @@ Here's the solution: ```javascript import { OpenAI } from "openai"; -import readline from "readline"; +import readline from "node:readline"; const rl = readline.createInterface({ input: process.stdin, diff --git a/lessons/04-structured-output/README.md b/lessons/04-structured-output/README.md index 76944f97..3ed3b77a 100644 --- a/lessons/04-structured-output/README.md +++ b/lessons/04-structured-output/README.md @@ -80,7 +80,7 @@ Upon reaching the top of the pyramid, you are led into a grand chamber where Mon **Leonardo:** "We come in peace," he says, his voice steady. "We seek knowledge and understanding. Allow us to demonstrate the power of our machine and share our knowledge with you." -**Montezuma:** "Very well. I propose a game of Patolli. If I win the best of three games, you will give me your device and tell me how it works. If you win, you are free to go." +**Montezuma:** "Very well. I propose a game of [Patolli](#patolli). If I win the best of three games, you will give me your device and tell me how it works. If you win, you are free to go."
Playing a game of Patolli @@ -104,6 +104,8 @@ With a final, decisive move, Leonardo wins the game. The room erupts in cheers a **Leonardo:** _smirks_ +### Patolli + > [!NOTE] > Patolli is one of the oldest known games in the Americas, played by various pre-Columbian Mesoamerican cultures, including the Aztecs. > @@ -169,7 +171,7 @@ Generative AI models can output data in various formats. However, output of unst **You:** Well, aren't you clever ;) -**Time beetle:** I try my best :) +**Time beetle:** I try my best ☺️ Another benefit, even for human readers, is that structured data is easier to read and understand when it follows a familiar format. @@ -181,7 +183,7 @@ Let's look at a few examples of input and asking for specific output formats can **Time beetle:** Let's start with a simple example. Imagine you're Leonardo da Vinci and you're trying to come up with ideas for inventions using 15th-century technology. You want to know what resources you need and how much effort it would take to build each invention. Here's how you can ask for this information: -**Leonardo:** Oh I like this game, everyone pretend you're me :) +**Leonardo:** Oh I like this game, everyone pretend you're me ☺️ > Prompt: Generate ideas for inventions I can build using 15th-century technology. For each invention, specify the required resources and estimate the effort needed to build it. @@ -254,9 +256,9 @@ This time we end up with a table that is easier to read and understand. ### Presenting an output template -Another way of getting structured output is to present an output template, here it can be any format, from columns to JSON, XML, or CSV. +Another way of getting structured output is to present an output template, here it can be any format, from columns to JSON, XML, CSV to markdown. -> Prompt Generate ideas for inventions that can be built using 15th-century technology. For each invention, specify the required resources and estimate the effort needed to construct it. Present the information using the following format: +> Prompt: Generate ideas for inventions that can be built using 15th-century technology. For each invention, specify the required resources and estimate the effort needed to construct it. Present the information using the following format (use markdown as output format): > > Title: [Invention Name] > Description: [Brief Explanation] @@ -533,7 +535,7 @@ This combination of presenting skills and parameters and extracting data from pr **Leonardo:** So I managed to fix the damage to the aerial screw but now it needs a boot sequence: left left up right: You: sounds easy enough, just that text? -**Leonardo:** Yes, but it' special, it needs to be mirrored, that's how I write all my text. And of course I use a Caesar cipher with a shift of 3 because I'm Italian. :) +**Leonardo:** Yes, but it' special, it needs to be mirrored, that's how I write all my text. And of course I use a Caesar cipher with a shift of 3 because I'm Italian. ☺️ **You:** Yes, could you just type it in then? diff --git a/lessons/04-structured-output/solution/solution.md b/lessons/04-structured-output/solution/solution.md index aab8fcef..7dc8bbe8 100644 --- a/lessons/04-structured-output/solution/solution.md +++ b/lessons/04-structured-output/solution/solution.md @@ -8,9 +8,9 @@ const distance = 100; // Create prompt including inputs should include chain of thought -const boot_sequence = `left left up right`; +const bootSequence = `left left up right`; -const prompt = `Provide the boot sequence for the aerial screw, the text should be mirrored and encoded with a Caesar cipher with a shift of 3. The boot sequence is: ${boot_sequence}.`; +const prompt = `Provide the boot sequence for the aerial screw, the text should be mirrored and encoded with a Caesar cipher with a shift of 3. The boot sequence is: ${bootSequence}.`; // Call the language model with the prompt diff --git a/lessons/05-rag/README.md b/lessons/05-rag/README.md index 89d00290..9d88e11a 100644 --- a/lessons/05-rag/README.md +++ b/lessons/05-rag/README.md @@ -281,9 +281,6 @@ for await (const chunk of chunks) { } ``` -> [!IMPORTANT] -> Follow [the dev setup guide](../../docs/dev-setup.md) to see how to setup your environment to run this code. - You can find this code in the `example/rag-cars.js` file along with the `hybrid.csv` file containing the data used for the retrieval. **Ada:** Once you run this code, you should see the data found by in the CSV file by the retriever, formatted as a markdown table, followed by the AI-generated response to the question. Try changing the question to see how the retrieved data and response changes. You can also try asking questions about unrelated topics to see how the AI model handles them. From 62dd06a5edccea596639d7ae638e8a46466e8ca5 Mon Sep 17 00:00:00 2001 From: chris Date: Wed, 26 Feb 2025 19:51:37 +0000 Subject: [PATCH 3/3] smaller fixes --- lessons/01-intro-to-genai/README.md | 2 +- lessons/02-first-ai-app/README.md | 2 +- lessons/03-prompt-engineering/README.md | 8 ++++---- lessons/04-structured-output/README.md | 4 ++++ lessons/05-rag/README.md | 4 ++-- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/lessons/01-intro-to-genai/README.md b/lessons/01-intro-to-genai/README.md index 38ced699..408c2759 100644 --- a/lessons/01-intro-to-genai/README.md +++ b/lessons/01-intro-to-genai/README.md @@ -350,6 +350,6 @@ Which of the following statements about Generative AI and JavaScript are true? 2. JavaScript can be used to build AI-powered applications, including chatbots, text generation tools, and more. 3. Python is the only language used for AI development. -## References +## Self-Study Resources - [Generative Ai JavaScript video series](https://genai-js) diff --git a/lessons/02-first-ai-app/README.md b/lessons/02-first-ai-app/README.md index 46dbc9a4..70bf0282 100644 --- a/lessons/02-first-ai-app/README.md +++ b/lessons/02-first-ai-app/README.md @@ -504,7 +504,7 @@ A3: The context window determines how creative the AI's responses are. [Solution quiz](./solution/solution-quiz.md) -## References +## Self-Study Resources - [Text generation](https://platform.openai.com/docs/guides/text-generation) - [JavaScript library for OpenAI](https://github.com/openai/openai-node/tree/master/examples) diff --git a/lessons/03-prompt-engineering/README.md b/lessons/03-prompt-engineering/README.md index 24ae682d..9fcd835a 100644 --- a/lessons/03-prompt-engineering/README.md +++ b/lessons/03-prompt-engineering/README.md @@ -410,10 +410,10 @@ Q: What is prompt engineering? [Solution quiz](./solutions/solution-quiz.md) -## References +## Self-Study Resources -- [1] [Prompt engineering](https://en.wikipedia.org/wiki/Prompt_engineering) -- [2] [Prompt engineering fundamentals](https://github.com/microsoft/generative-ai-for-beginners/blob/main/04-prompt-engineering-fundamentals/README.md?WT.mc_id=academic-105485-koreyst) -- [3] [Advanced prompt engineering](https://github.com/microsoft/generative-ai-for-beginners/tree/main/05-advanced-prompts) +- [Prompt engineering](https://en.wikipedia.org/wiki/Prompt_engineering) +- [Prompt engineering fundamentals](https://github.com/microsoft/generative-ai-for-beginners/blob/main/04-prompt-engineering-fundamentals/README.md?WT.mc_id=academic-105485-koreyst) +- [Advanced prompt engineering](https://github.com/microsoft/generative-ai-for-beginners/tree/main/05-advanced-prompts) \ No newline at end of file diff --git a/lessons/04-structured-output/README.md b/lessons/04-structured-output/README.md index 3ed3b77a..c25882a6 100644 --- a/lessons/04-structured-output/README.md +++ b/lessons/04-structured-output/README.md @@ -581,3 +581,7 @@ Q: What is structured output used for? [Solution quiz](./solution/solution-quiz.md) + +## Self-Study Resources + +- [Generative AI with JavaScript video series](https://aka.ms/genai-js) diff --git a/lessons/05-rag/README.md b/lessons/05-rag/README.md index 9d88e11a..e04332c4 100644 --- a/lessons/05-rag/README.md +++ b/lessons/05-rag/README.md @@ -345,8 +345,8 @@ const text = Object.values(data.query.pages)[0]?.extract; ## Self-Study Resources -- **Learn docs:** [Retrieval-Augmented Generation and Indexes](https://learn.microsoft.com/azure/ai-studio/concepts/retrieval-augmented-generation) +- [Retrieval-Augmented Generation and Indexes](https://learn.microsoft.com/azure/ai-studio/concepts/retrieval-augmented-generation) - **Sample apps**: * [Serverless AI Chat with RAG](https://github.com/Azure-Samples/serverless-chat-langchainjs/) * [Ask Youtube: A RAG-based Youtube Q&A API](https://github.com/Azure-Samples/langchainjs-quickstart-demo) -- **Full length workshop:** [Create your own ChatGPT with RAG](https://moaw.dev/workshop/gh:azure-samples/azure-openai-rag-workshop/docs/workshop-qdrant.md) +- [Full length workshop: Create your own ChatGPT with RAG](https://moaw.dev/workshop/gh:azure-samples/azure-openai-rag-workshop/docs/workshop-qdrant.md)