Building a RAG Pattern chat bot with Azure OpenAI and LangChain.js | Azure Developers JavaScript Day
In this second article on this year's Microsoft event aimed at JavaScript developers: Azure Developers JavaScript Day 2024, we're going to talk about creating a chatbot using the RAG (Retrieval Augmentation Generation) architecture with Azure OpenAI and LangChain.js! And this time we have the special participation of Lars Gyrup, a Microsoft MVP from Denmark, GitHub star, NX Champion, Angular hero of education and a fervent community organizer. And, also with Wassim Chegham, a Senior Developer Advocate Engineer at Microsoft with a long history in JavaScript development, and Natalia Venditto, a Principal Product Manager at Microsoft focused on the Developer Experience in Azure.
Let's get to the content!
What was covered during the session?
The Confluence of Expertise
Lars introduced his extensive background, highlighting his contributions to Developer Technologies, Open-Source projects, and educational initiatives. His foundational work with the This is Learning community, which evolved from an Angular-centric hub to a broader tech community, showcases his commitment to fostering growth and knowledge sharing among tech enthusiasts of all skill levels.
Wassim and Natalia, complemented the discussion with their vast experiences. Their collaboration has led to the development of samples that guide the community on best practices for application implementation using Azure services and Developer Tools.
Unraveling the RAG Pattern
The core of the session was the deep dive into the RAG pattern, a sophisticated architecture designed to enhance AI-driven applications by leveraging large language models for predictive content generation. This pattern, integral to generative AI technologies like GitHub Copilot, empowers applications to construct responses to user queries with unprecedented accuracy and relevance.
Architectural Overview and Implementation
Wassim and Natalia walked through the architecture of the sample RAG chatbot application, detailing the utilization of various Azure services, including:
- Azure Static Web Apps for the UI deployment
- Azure Container Apps for the backend logic
- Azure AI Search for data indexing and retrieval
The integration with OpenAI’s APIs plays a pivotal role in fetching predictive models and responses.
The session also shed light on the application's backend components: the indexer and the search API, highlighting the use of Fastify for API exposure and the strategic implementation of the sliding window algorithm for efficient text chunking and indexing.
Below you can see a diagram of the project's architecture:
Engaging with the Code
The practical segment involved a detailed code walkthrough, emphasizing npm workspaces, monorepo organization, and the use of libraries like LangChain.js for seamless interaction with Azure OpenAI. The discussion also touched on the importance of semantic search and vector embeddings in improving the chatbot's response quality.
You can get an overview of the project's code at GitHub. Help us improve the project with your contributions and feedback! The project is completely open-source and available to the community. And give stars to the repository if you like it! ;)
Frontend Realizations and Angular Insights
Lars provided a comprehensive overview of the latest features and improvements in Angular, including:
- Signals for managing state changes.
- Standalone components for modular development.
- And the evolution of template syntax for more intuitive code structuring.
The session illustrated how these Angular advancements could be leveraged in the context of the RAG chatbot application, enhancing its functionality and user interaction.
You can see in the image below an example of how the chatbot has been implemented in the user interface, making use of Angular's new features:
Deployment and Contributions to the Project
The deployment process to Azure was demystified, showcasing the use of:
-
Azure Developer CLI: which is a command line tool that allows you to create, manage and deploy Azure resources directly from the terminal.
-
Bicep: which is an Infrastructure as Code (IaC) language that allows Azure resources to be defined declaratively.
The open invitation for community contributions to the project underscores the collaborative spirit of the initiative.
Conclusion for the Session
This enriching session at the JavaScript Developer Days 2024 not only offered a comprehensive guide to developing a RAG pattern chatbot but also illuminated the potential of combining Angular’s new features with Azure's robust cloud services. The contributions of Lars, Wassim, and Natalia provided attendees with valuable insights into leveraging modern web development practices and AI technologies to create dynamic, responsive applications.
The collaborative effort to build and refine this project invites developers from across the spectrum to contribute, learn, and grow within this innovative domain, further bridging the gap between AI advancements and practical web development applications.
Azure Developers JavaScript Day Cloud Skills Challenge
As mentioned in previous article, the event also featured a cloud skills challenge focused on JavaScript Developers, where participants could test their knowledge and skills in Azure. Although the challenge is over, you can continue your studies!
Link to the challenge: JavaScript and Azure Cloud Skills Challenge
Additional Resources
- Free Course - Learn Path - Bicep
- Free Course - Implement Retrieval Augmented Generation (RAG) with Azure OpenAI Service
- Collection - Microsoft Ignite: Generative AI with Azure OpenAI
- Collection - Master the basics of Azure: AI Fundamentals
- Free Course - Using GitHub Copilot with JavaScript
- Free Course - Build a Form Recognizer custom skill for Azure Cognitive Search
- Free Course - Search Azure Cosmos DB for NoSQL data with Azure Cognitive Search
- Free Course - Azure Static Web Apps Learn Path
Stay Tuned!
If you wish, you can follow what happened during the two days of the event via the playlist on YouTube. The event was full of interesting content and insights for JavaScript developers!
Stay tuned for more articles about this event and keep learning with us!
Published on:
Learn moreRelated posts
Azure Developer CLI (azd): Run and test AI agents locally with azd
New azd ai agent run and invoke commands let you start and test AI agents from your terminal—locally or in the cloud. The post Azure Developer...
Microsoft Purview compliance portal: Endpoint DLP classification support for Azure RMS–protected Office documents
Microsoft Purview Endpoint DLP will soon classify Azure RMS–protected Office documents, enabling consistent DLP policy enforcement on encrypte...
Introducing the Azure Cosmos DB Plugin for Cursor
We’re excited to announce the Cursor plugin for Azure Cosmos DB bringing AI-powered database expertise, best practices guidance, and liv...
Azure DevOps Remote MCP Server (public preview)
When we released the local Azure DevOps MCP Server, it gave customers a way to connect Azure DevOps data with tools like Visual Studio and Vis...
Azure Cosmos DB at FOSSASIA Summit 2026: Sessions, Conversations, and Community
The FOSSASIA Summit 2026 was an incredible gathering of developers, open-source contributors, startups, and technology enthusiasts from across...
Azure Cosmos DB at FOSSASIA Summit 2026: Sessions, Conversations, and Community
The FOSSASIA Summit 2026 was an incredible gathering of developers, open-source contributors, startups, and technology enthusiasts from across...
Dataverse: Avoid Concurrency issues by using Azure Service Bus Queue and Azure Functions
Another blog post to handle the concurrency issue. Previously, I shared how to do concurrency via a plugin in this blog post and also how to f...
March Patches for Azure DevOps Server
We are releasing patches for our self‑hosted product, Azure DevOps Server. We strongly recommend that all customers stay on the latest, most s...
Azure Developer CLI (azd): Debug hosted AI agents from your terminal
New azd ai agent show and monitor commands help you diagnose hosted AI agent failures directly from the CLI. The post Azure Developer CLI (azd...