Skip to content

docs: GH page #134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div align="center">
<div align="center">

<img src="./docs/images/logo.png" alt="" align="center" height="128" />

Expand Down
10 changes: 10 additions & 0 deletions _sidebar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- Lessons
- [01 - Intro to Gen AI](/lessons/01-intro-to-genai/README.md)
- [02 - First AI App](/lessons/02-first-ai-app/README.md)
- [03 - Prompt Engineering](/lessons/03-prompt-engineering/README.md)
- [04 - Structured Output](/lessons/04-structured-output/README.md)
- [05 - Retrieval Augmented Generation](/lessons/05-rag/README.md)
- [06 - Tool Calling](/lessons/06-tool-calling/README.md)
- [07 - MCP](/lessons/07-mcp/README.md)
- [08 - MCP, improving Client with LLM](/lessons/08-mcp-advanced/README.md)

45 changes: 45 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Web Dev for Beginners</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="description" content="Description">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<link rel="icon" type="image/png" href="images/favicon.png">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsify-themeable@0/dist/css/theme-simple.css">
<link rel="stylesheet" href="index.css">
</head>
<body>
<div id="app"></div>
<script type="text/javascript">

(function(c,l,a,r,i,t,y){
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
})(window, document, "clarity", "script", "rr8mykpwiy");

window.$docsify = {
loadSidebar: true,
name: 'Generative AI For Beginners with JavaScript',
repo: 'https://github.com/microsoft/generative-ai-with-javascript',
relativePath: true,
auto2top: false,
notFoundPage: true,
alias: {
'/(README.(.*))': '/translations/$1',
'#/((?!README).*)/README.(.*)': '$1/translations/README.$2',
'/((?!README).*)/((?!README).*)/README.(.*)': '$1/$2/translations/README.$3',

// handle English, since English files isn't in translation folders
'/(README$)': '/$1',
'#/((?!README).*)/(README$)': '$1/$2',
'/((?!README).*)/((?!README).*)/(README$)': '$1/$2/$3'
}
}
</script>
<script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.min.js"></script>

</body>
</html>
22 changes: 11 additions & 11 deletions lessons/01-intro-to-genai/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ If you haven't already, set up your development environment. Here's how you can

_This video gives you an introduction to Generative AI with JavaScript_

💼 Slides: [Introduction to Generative AI](../../videos/slides/00-intro.pptx)
💼 Slides: [Introduction to Generative AI](/videos/slides/00-intro.pptx)

## Generative AI

Expand All @@ -43,7 +43,7 @@ In the heart of 1860s London, you are recognized as one of the most skilled mech
Your workbench, the heart of your workshop, is an organized mess.

<div>
<img src="./assets/london.png" alt="London Workshop"width=300 >
<img src="/lessons/01-intro-to-genai/assets/london.png" alt="London Workshop"width=300 >
</div>

_At the center of the bench lies the torso of a robot—an engineering marvel that has consumed months of effort. Its wooden frame is intricately carved, each joint meticulously designed for smooth movement._
Expand Down Expand Up @@ -75,7 +75,7 @@ It's dark and gloomy inside, the only light filtering through the grimy windows,
As your eyes adjust to the dim light, you notice a figure in the distance, waving at you. You walk towards him, your footsteps echoing on the wooden floor. The figure becomes clearer, and you recognize him from newspaper photos, it's Charles Babbage.

<div>
<img src="./assets/library.png" alt="Dusty Library" width="300">
<img src="/lessons/01-intro-to-genai/assets/library.png" alt="Dusty Library" width="300">
</div>

### What's This Device?
Expand All @@ -91,7 +91,7 @@ Compelled by curiosity, your fingers drift toward the red button. The moment you
Then, blackness, and a sense of falling.

<div>
<img src="./assets/vortex.png" alt="Time Vortex" width="300">
<img src="/lessons/01-intro-to-genai/assets/vortex.png" alt="Time Vortex" width="300">
</div>

### Alexandria 300 BC
Expand All @@ -101,7 +101,7 @@ You awaken, disoriented. As your vision clears, an ancient city unfolds before y
People in togas move through the streets, their voices blending into a symphony of ancient dialects, air filled with the scent of exotic spices and the distant sound of merchants hawking their wares.

<div>
<img src="./assets/alexandria.png" alt="Alexandria 300 BC" width="300">
<img src="/lessons/01-intro-to-genai/assets/alexandria.png" alt="Alexandria 300 BC" width="300">
</div>

**You:** Surely, I must have hit my head, you think, closing your eyes and opening them again, scene remains unchanged.
Expand All @@ -113,7 +113,7 @@ Am I stuck in the past? Do I dare press that button again? Before you can decide
An elderly gentleman wearing a toga waves at you from the steps of the grand temple. His white hair and beard catch the sunlight, giving him an almost ethereal glow.

<div>
<img src="./assets/dinocrates.png" alt="Dinocrates wearing a toga" width="300">
<img src="/lessons/01-intro-to-genai/assets/dinocrates.png" alt="Dinocrates wearing a toga" width="300">
</div>

**Dinocrates:** "Welcome, traveler," he says warmly. "I am Dinocrates, architect of this great city. Your arrival was foretold."
Expand Down Expand Up @@ -145,7 +145,7 @@ A thought strikes you. Can the device understand me if I speak to it?
**You:** You're right, George is a good name, it was my father's name in fact.

<div>
<img src="./assets/time-beetle.png" alt="Time travel device resembling a metallic beetle" width="300">
<img src="/lessons/01-intro-to-genai/assets/time-beetle.png" alt="Time travel device resembling a metallic beetle" width="300">
</div>

_Time device, “George” the metallic beetle_
Expand All @@ -166,7 +166,7 @@ If you want to interact with Dinocrates, run the [Characters](/app/README.md) ap
> [Responsible AI disclaimer](../../README.md#responsible-ai-disclaimer)

<div>
<img src="./assets/dinocrates.png" alt="Dinocrates wearing a toga" width="300">
<img src="/lessons/01-intro-to-genai/assets/dinocrates.png" alt="Dinocrates wearing a toga" width="300">
</div>

**Steps**:
Expand All @@ -178,7 +178,7 @@ If you want to interact with Dinocrates, run the [Characters](/app/README.md) ap
5. Chat with Dinocrates.

> [!NOTE]
> If you're running the project locally on your machine, please review the QuickStart guide to get a [GitHub personal access](../../docs/setup/README.md#creating-a-personal-access-token-pat-for-github-model-access) token setup and replace the key in the code.
> If you're running the project locally on your machine, please review the QuickStart guide to get a [GitHub personal access](/docs/setup/README.md#creating-a-personal-access-token-pat-for-github-model-access) token setup and replace the key in the code.

### Code Sneak Peek

Expand Down Expand Up @@ -344,7 +344,7 @@ Visit [Microsoft Copilot](https://copilot.microsoft.com), [ChatGPT](https://chat

## Solution

[Solution](./solution/solution.md)
[Solution](/lessons/01-intro-to-genai/solution/solution.md)

### Knowledge Check

Expand All @@ -354,7 +354,7 @@ A. JavaScript powered Generative AI apps can only generate text.
B. JavaScript can be used to build AI-powered applications, including chatbots, text generation tools, and more.
C. Python is the only language used for AI development.

[Quiz solution](./solution/solution-quiz.md)
[Quiz solution](/lessons/01-intro-to-genai/solution/solution-quiz.md)

## Self-Study Resources

Expand Down
24 changes: 12 additions & 12 deletions lessons/02-first-ai-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ _This video gives you an introduction to AI models called "large language models

*🎥 Click on the image above to watch a short video about large language models*

💼 Slides: [Introduction to large language models, LLMs](../../videos/slides/01-llms.pptx)
💼 Slides: [Introduction to large language models, LLMs](/videos/slides/01-llms.pptx)

## Narrative: Picture yourself in a boat on a river


> [!NOTE]
> _Our story so far: You are a maker of things, a craftsman from 1860s London who has traveled through time using a mysterious device called the Time Beetle. You've journeyed through the annals of history, witnessing the creation of the lighthouse at Alexandria, a marvel of ancient engineering you helped create with a little help from Dinocrates and the Time Beetle._
>
> See [Lesson 1](../01-intro-to-genai/README.md) if you want to catch up with the story from the beginning and get started with Generative AI.
> See [Lesson 1](/lessons/01-intro-to-genai/README.md) if you want to catch up with the story from the beginning and get started with Generative AI.

> [!NOTE]
> While we recommend going through the story (it's fun!), [click here](#interact-with-leonardo) if you'd prefer to jump straight to the technical content.
Expand All @@ -42,7 +42,7 @@ When you open your eyes, the world has shifted. As you manage to get up, you rea
Looking around the boat, you find a long oar resting against the side. Grasping it, you begin to row towards the distant buildings. As you get closer, the buildings come into sharper focus, they are old, their architecture reminiscent of a Renaissance painting.

<div>
<img src="./assets/boat.png" alt="Boat on the rive, man standing with a paddle" width=300" >
<img src="/lessons/02-first-ai-app/assets/boat.png" alt="Boat on the rive, man standing with a paddle" width=300" >
</div>

The question now is, where and when are you this time?
Expand All @@ -52,7 +52,7 @@ You manage to secure the boat at the dock and start walking along the wooden pla
As you walk, you notice a man with a long beard and a hat, digging through a crate of what looks like mechanical parts. His hands move deftly, sorting through gears and springs with practiced ease.

<div >
<img src="./assets/leonardo.png" alt="Leonardo Da Vinci standing next to a crate in the harbour" width="300" >
<img src="/lessons/02-first-ai-app/assets/leonardo.png" alt="Leonardo Da Vinci standing next to a crate in the harbour" width="300" >
</div>

### Help me, Leonardo
Expand Down Expand Up @@ -82,7 +82,7 @@ As you walk, you notice a man with a long beard and a hat, digging through a cra
### At the workshop

<div>
<img src="./assets/leonardo-workshop.png" alt="Lenoardos workshop" width="300" >
<img src="/lessons/02-first-ai-app/assets/leonardo-workshop.png" alt="Lenoardos workshop" width="300" >
</div>

The old man leads you to a large wooden door and you are greeted by the sight of a workshop filled with all sorts of mechanical contraptions.
Expand Down Expand Up @@ -122,10 +122,10 @@ If you want to interact with Leonardo, run the [Characters](/app/README.md) app.

> [!IMPORTANT]
> This is entirely fictional; the responses are generated by AI.
> [Responsible AI disclaimer](../../README.md#responsible-ai-disclaimer)
> [Responsible AI disclaimer](/README.md#responsible-ai-disclaimer)

<div>
<img src="./assets/leonardo-talk.jpeg" width=300>
<img src="/lessons/02-first-ai-app/assets/leonardo-talk.jpeg" width=300>
</div>

**Steps**:
Expand All @@ -139,7 +139,7 @@ If you want to interact with Leonardo, run the [Characters](/app/README.md) app.
For a more detailed explanation of the app, see [Detailed app explanation](/lessons/01-intro-to-genai/README.md#interact-with-dinocrates).

> [!NOTE]
> If you're running the project locally on your machine, please review the QuickStart guide to get a [GitHub personal access](../../docs/setup/README.md#creating-a-personal-access-token-pat-for-github-model-access) token setup and replace the key in the code.
> If you're running the project locally on your machine, please review the QuickStart guide to get a [GitHub personal access](/docs/setup/README.md#creating-a-personal-access-token-pat-for-github-model-access) token setup and replace the key in the code.

## Development environment setup

Expand Down Expand Up @@ -409,7 +409,7 @@ This means the majority of tokens can be spent on the input tokens, i.e 128k - 1
I want you to generate recipes for me.
```

![Demo of tokenizer](./assets/tokenizer.png)
![Demo of tokenizer](/lessons/02-first-ai-app/assets/tokenizer.png)

Running `tokenizer` on the sentence above gives us 9 tokens.

Expand Down Expand Up @@ -462,7 +462,7 @@ Leonardo suddenly asked to inspect the Time Beetle closer, he looked at it from
**Time Beetle:** Nothing

<div>
<img style="margin-top: 52px; margin-left: 15px; margin-right: 10px" align=right src="./assets/helicopter.jpg" alt="Aerial screw, Leonardo Da Vinci" width="300" >
<img style="margin-top: 52px; margin-left: 15px; margin-right: 10px" align=right src="/lessons/02-first-ai-app/assets/helicopter.jpg" alt="Aerial screw, Leonardo Da Vinci" width="300" >
</div>

> [!NOTE]
Expand All @@ -488,7 +488,7 @@ Check out [Sample app](/app/README.md) to get started.

## Solution

[Solution](./solution/solution.md)
[Solution](/lessons/02-first-ai-app/solution/solution.md)

## Knowledge Check

Expand All @@ -500,7 +500,7 @@ B. The context window is the number of previous messages that the AI uses to gen

C. The context window determines how creative the AI's responses are.

[Quiz solution](./solution/solution-quiz.md)
[Quiz solution](/lessons/02-first-ai-app/solution/solution-quiz.md)

## Self-Study Resources

Expand Down
14 changes: 7 additions & 7 deletions lessons/03-prompt-engineering/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ _This video offers an introduction to improving your "prompting" skills, teachin
> [!NOTE]
> So far, you've been on a journey through time with Leonardo da Vinci, exploring the wonders of the Renaissance. You've encountered the Time Beetle, a mysterious device that allows you to travel through time and space.
>
> See [Lesson 1](../01-intro-to-genai/README.md) if you want to catch up with the story from the beginning.
> See [Lesson 1](/lessons/01-intro-to-genai/README.md) if you want to catch up with the story from the beginning.

> [!NOTE]
> While we recommend going through the story (it's fun!), [click here](#interact-with-sforza) if you'd prefer to jump straight to the technical content.
Expand All @@ -35,7 +35,7 @@ _This video offers an introduction to improving your "prompting" skills, teachin
Before you manage to press the button, the workshop doors slam open with a thunderous bang. A man stands in the doorway, broad-shouldered and dressed in expensive clothes, he waves a piece of paper in the air, yelling:

<div>
<img src="./assets/ludovico.png" alt="An angry Ludovico Sforza busting in through the door" width="300">
<img src="/lessons/03-prompt-engineering/assets/ludovico.png" alt="An angry Ludovico Sforza busting in through the door" width="300">
</div>

*Ludovico Sforza*
Expand Down Expand Up @@ -65,7 +65,7 @@ A swirl of colors envelops the carriage, the world around you dissolving into a
The swirl of colors fades, and you find yourself in the carriage, now racing down the Via Appia in Rome and to your astonishment, you're in the middle of a horse race. Chariots thunder past, their wheels kicking up clouds of dust.

<div>
<img src="./assets/escape.png" alt="Escape from Rome" width="300">
<img src="/lessons/03-prompt-engineering/assets/escape.png" alt="Escape from Rome" width="300">
</div>

**You:** Leonardo, where are we?
Expand Down Expand Up @@ -105,7 +105,7 @@ With a final push, the aerial screw begins to spin. The blades catch the air, an
You look out over the city; the ancient buildings stretch out below you.

<div>
<img src="./assets/airborne.png" alt="Airborne, looks down at the city with feet dangling" width="300">
<img src="/lessons/03-prompt-engineering/assets/airborne.png" alt="Airborne, looks down at the city with feet dangling" width="300">
</div>

## Interact with Sforza
Expand All @@ -117,7 +117,7 @@ If you want to interact with Sforza, run the [Characters](/app/README.md) app.
> [Responsible AI disclaimer](/README.md#responsible-ai-disclaimer)

<div >
<img src="./assets/ludovico.png" alt="Ludovico Sforza" width="300" >
<img src="/lessons/03-prompt-engineering/assets/ludovico.png" alt="Ludovico Sforza" width="300" >
</div>

**Steps**:
Expand Down Expand Up @@ -320,7 +320,7 @@ Build an app in JavaScript that asks for the following inputs:

Then use the LLM to incorporate these inputs and leverage the chain of thought prompting technique to guide the model to the right answer.

[Solution](./solution/solution.md)
[Solution](/lessons/03-prompt-engineering/solution/solution.md)

## Knowledge Check

Expand All @@ -332,7 +332,7 @@ B. Prompt engineering is about crafting the right prompts to get the desired out

C. Prompt engineering is about training a model to recognize patterns in data.

[Quiz solution](./solution/solution-quiz.md)
[Quiz solution](/lessons/03-prompt-engineering/solution/solution-quiz.md)

## Self-Study Resources

Expand Down
16 changes: 8 additions & 8 deletions lessons/04-structured-output/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ _This video offers an introduction to improving your "prompting" skills, teachin

*🎥 Click on the image above to watch a short video about prompt engineering*

💼 Slides: [Prompt engineering](../../videos/slides/02-prompt-engineering.pptx)
💼 Slides: [Prompt engineering](/videos/slides/02-prompt-engineering.pptx)

## Narrative - Out of the frying pan and into the fire

> [!NOTE]
> _Our story so far: You, a mechanically trained engineer from 1860 and have been on a journey through time with Leonardo da Vinci. You've escaped Roman soldiers — or rather, you're in the process of escaping them— and you're desperately searching for a way to land the aeriel screw safely_.
>
> See [Lesson 1](../01-intro-to-genai/README.md) if you want to catch up with the story from the beginning.
> See [Lesson 1](/lessons/01-intro-to-genai/README.md) if you want to catch up with the story from the beginning.

> [!NOTE]
> While we recommend going through the story (it's fun!), [click here](#interact-with-montezuma) if you'd prefer to jump straight to the technical content.
Expand All @@ -47,7 +47,7 @@ The bright light from the Time Beetle fades, and you find yourself standing at t
The aerial screw, rests awkwardly on a large, intricately carved stone, with markings that look like a calendar

<div>
<img alt="Aztec calendar, Wikipedia" src="./assets/aztec.png" width="300" />
<img alt="Aztec calendar, Wikipedia" src="/lessons/04-structured-output/assets/aztec.png" width="300" />
</div>

_Aztec calendar, Wikipedia_
Expand All @@ -59,7 +59,7 @@ Leonardo da Vinci steps forward, his eyes wide with wonder.
Before you can react, a group of Aztec soldiers approaches.

<div>
<img src="./assets/meeting.png" alt="Meeting with Aztecs" width="300" />
<img src="/lessons/04-structured-output/assets/meeting.png" alt="Meeting with Aztecs" width="300" />
</div>

**Soldier leader:** "Who are you, and what have you done?" he demands in Nahuatl.
Expand All @@ -83,7 +83,7 @@ Upon reaching the top of the pyramid, you are led into a grand chamber where Mon
**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."

<div>
<img src="./assets/game.png" alt="Playing a game of Patolli" width="300" />
<img src="/lessons/04-structured-output/assets/game.png" alt="Playing a game of Patolli" width="300" />
</div>

The game begins, and the room falls silent, save for the sound of beans being rolled and pieces moving across the board.
Expand Down Expand Up @@ -115,7 +115,7 @@ With a final, decisive move, Leonardo wins the game. The room erupts in cheers a
> **Aztec Involvement**: Widely played by nobles and commoners, it was a favorite at Montezuma’s court. Beyond fun, it involved high-stakes gambling with bets like blankets, precious stones, or even freedom.

<div>
<img width="300" src="./assets/patolli.png" alt="Patolli board" />
<img width="300" src="/lessons/04-structured-output/assets/patolli.png" alt="Patolli board" />
</div>

_Patolli - Wikipedia_
Expand Down Expand Up @@ -536,7 +536,7 @@ See the [sample app](/app/README.md) for code to get started with. It contains a

## Solution

[Solution](./solution/solution.md)
[Solution](/lessons/04-structured-output/solution/solution.md)

## Challenge

Expand Down Expand Up @@ -564,7 +564,7 @@ B. Extracting data from prompts.

C. Generating unstructured text.

[Quiz solution](./solution/solution-quiz.md)
[Quiz solution](/lessons/04-structured-output/solution/solution-quiz.md)

## Self-Study Resources

Expand Down
Loading