DEV Community

Build Agentic RAG application using langchain.js, nestjs, Htmx, and Gemma 2

This blog post details the process of building an agentic RAG (Retrieval-Augmented Generation) application using Langchain, NestJS, and Gemma 2. The application utilizes Langchain to create tools for retrieving information from various sources, including DuckDuckGo for web search, a custom Dragon Ball Z API for character filtering, and retrievers for Angular Signal and Angular Form documentation. These tools are then integrated into a Langchain agent, which intelligently selects and executes the appropriate tool based on user queries. The application leverages NestJS for its framework and infrastructure, while Gemma 2 serves as the underlying language model. The user interface is rendered using HTMX and Handlebar template engine, showcasing the responses in a list format. The post provides a comprehensive guide, outlining the setup process, configuration steps, and code snippets for creating the tools, retrievers, and the agent itself. It also demonstrates how to integrate the environment variables, set up API keys, and install necessary dependencies. The blog post concludes with a description of the agent module, constants, and providers, highlighting the core components that enable the agentic RAG functionality.
favicon
dev.to
dev.to
Create attached notes ...