Use Prompty with Foundry Local
June 16, 2025Microsoft Sentinel: Repositories, the Future of Content-as-Code & Best Practices
June 17, 2025In this quest, you’ll teach your AI app to talk to external data using the Retreival Augmented Generation (RAG) technique. You’ll overcome the limitations of pre-trained language models by allowing them to reference your own data, using it as context to deliver accurate, fact-based responses.
👉 Want to catch up on the full program or grab more quests? https://aka.ms/JSAIBuildathon
💬 Got questions or want to hang with other builders? Join us on Discord — head to the #js-ai-build-a-thon channel.
🔧 What You’ll Build
In this quest, you’ll:
- Connect your AI app to external documents (like PDFs)
- Allow your app to “read” and respond using your real-world content
Why does this matter? Because LLMs are powerful, but they don’t know your business, reports, or research papers, etc. With RAG, you can give them that context instantly.
🚀 What You’ll Need
- ✅ A GitHub account
- ✅ Visual Studio Code installed
- ✅ Node.js installed
🛠️ Concepts You’ll Explore
🔍 Retrieval-Augmented Generation (RAG)
Think of RAG as giving your LLM a memory boost. Instead of relying on pre-trained data alone, RAG lets your model look up relevant facts from your content (like PDFs, docs, or CSVs) before answering.
Benefits:
- Reduces hallucination
- Improves relevance and accuracy
- Makes your app dynamic and data-aware
📄 Bring Your Own Data (BYOD)
You’ll use a sample .pdf to simulate a use case, but we strongly encourage you to bring your own. Think:
- Annual reports
- Research papers
- Instruction manuals
- Policy docs
We’ll use the pdf-parse library to extract text — but here’s your dev challenge: try expanding your app to support .csv files or web content too! Lesson 5 in the resources section below shows you how.
⭐️ For a Production-Ready RAG Experience
Let’s take a quick pause and look beyond the basics? For an implementation that follows industry best practices—ensuring faster responses, secure handling of data, and scalable retrieval—check out this robust example from Azure Samples:
🔗 Ask YouTube Shout out to Yohan Lasorsa, the sample author
Ask YouTube lets you query YouTube video transcripts like you’re chatting with the video itself. Just drop in a video link, and it’ll fetch the transcript, chunk it, embed it, and let you ask context-aware questions—powered by Retrieval-Augmented Generation (RAG).
It’s a lightweight, serverless app built with LangChain.js, OpenAI, and Azure AI Search—great for learning how to bring your own data into AI conversations!
This sample demonstrates how to:
- Embed your documents using powerful embedding models
- Store and query vectors efficiently using a vector store
- Use LangChain.js to structure your RAG pipeline in a modular, extensible way
Perfect if you’re planning to build something more advanced—or just want to see how RAG is done right in the wild.
📖 Bonus Resources to Go Deeper
- Lesson 5: Talk to your data with Retrieval-Augmented Generation (RAG)
Learn to embed and query external documents like a pro. - What is Retrieval-Augmented Generation (RAG)?
A foundational overview of RAG in LLM development. - Retrieval Augmented Generation and Indexes
A closer look at indexing and storing data for fast retrieval. - Get started with Serverless AI Chat with RAG using LlamaIndex
Practical steps to build with LlamaIndex, fully serverless. - Get started with Serverless AI Chat with RAG using LangChain.js
Learn how to do the same with LangChain.js, the JavaScript-native RAG toolkit.