Blog Post

Microsoft Developer Community Blog
3 MIN READ

Quest 4 - I want to connect my AI prototype to external data using RAG

Julia_Muiruri's avatar
Julia_Muiruri
Icon for Microsoft rankMicrosoft
Jun 16, 2025

In 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

  1. ✅ A GitHub account
  2. ✅ Visual Studio Code installed
  3. ✅ 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.

Response without RAG

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.

Response with RAG enabled

⭐️ 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!

Ask YouTube architecture diagram

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

Updated Jul 09, 2025
Version 2.0
No CommentsBe the first to comment