{"id":223053,"date":"2025-05-04T15:08:28","date_gmt":"2025-05-04T15:08:28","guid":{"rendered":"https:\/\/peraltafinancing.com\/analytics\/how-to-build-an-intelligent-faq-chatbot-using-agentic-rag\/"},"modified":"2025-05-04T15:08:28","modified_gmt":"2025-05-04T15:08:28","slug":"how-to-build-an-intelligent-faq-chatbot-using-agentic-rag","status":"publish","type":"post","link":"https:\/\/fivemor.com\/?p=223053","title":{"rendered":"How to Build an Intelligent FAQ Chatbot Using Agentic RAG"},"content":{"rendered":"<p> <br \/>\n<\/p>\n<div id=\"article-start\">\n<p>AI agents are now a part of enterprises big and small. From filling forms at hospitals and checking legal documents to analyzing video footage and handling <a href=\"https:\/\/www.analyticsvidhya.com\/blog\/2025\/01\/navin-dhananjaya\/\" target=\"_blank\" rel=\"noreferrer noopener\">customer support<\/a> \u2013 we have AI agents for all kinds of tasks. Companies often spend hundreds of thousands of dollars on hiring customer support staff who can understand the needs of a customer and resolve them based on the company\u2019s guidelines. Today, having an intelligent chatbot to answer FAQs can efficiently improve customer service. In this article, we will learn how to build an FAQ chatbot that can resolve customer queries in seconds, using <a href=\"https:\/\/www.analyticsvidhya.com\/blog\/2024\/07\/building-agentic-rag-systems-with-langgraph\/\" target=\"_blank\" rel=\"noreferrer noopener\">agentic RAG<\/a> (Retrieval Augmented Generation), <a href=\"https:\/\/www.analyticsvidhya.com\/blog\/2024\/03\/build-an-ai-coding-agent-with-langgraph-by-langchain\/\" target=\"_blank\" rel=\"noreferrer noopener\">LangGraph<\/a> and <a href=\"https:\/\/www.analyticsvidhya.com\/blog\/2023\/07\/guide-to-chroma-db-a-vector-store-for-your-generative-ai-llms\/\" target=\"_blank\" rel=\"noreferrer noopener\">ChromaDB<\/a>.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-brief-on-agentic-rag\">Brief on Agentic RAG<\/h2>\n<p>RAG is a hot topic nowadays. Everyone is talking about RAG and building applications on top of it. RAG helps LLMs to get access to the real-time data, which makes LLMs more accurate than ever before.\u00a0 However, <a href=\"https:\/\/www.analyticsvidhya.com\/blog\/2023\/09\/retrieval-augmented-generation-rag-in-ai\/\" target=\"_blank\" rel=\"noreferrer noopener\">traditional RAG systems<\/a> tend to fail when it comes to choosing the best retrieval method, changing the retrieval workflow, or providing multi-step reasoning. This is where agentic RAG comes in.<\/p>\n<p>Agentic RAG enhances traditional RAG by incorporating the capabilities of AI agents into it. With this superpower, RAGs can dynamically change the workflow based on the nature of the query, do multi-step reasoning, and multi-step retrieval as well. We can even integrate tools into the agentic RAG system, and it can dynamically decide which tool to use when. Overall, it results in improved accuracy and makes the system more efficient and scalable.<\/p>\n<p>Here\u2019s an example of an agentic RAG workflow.<\/p>\n<figure class=\"wp-block-image size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1200\" height=\"374\" src=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/05\/Brief_on_agentic_rag.webp\" alt=\"Agentic RAG workflow\" class=\"wp-image-233439\" srcset=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/05\/Brief_on_agentic_rag.webp 1200w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/05\/Brief_on_agentic_rag-300x94.webp 300w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/05\/Brief_on_agentic_rag-768x239.webp 768w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/05\/Brief_on_agentic_rag-150x47.webp 150w\" sizes=\"(max-width: 1200px) 100vw, 1200px\"\/><\/figure>\n<p>The image above denotes the architecture of an agentic RAG framework. It shows how AI agents, when combined with RAG, can make decisions under certain conditions. The image clearly shows that if a conditional node is there, the agent will decide which edge to choose based on the context provided.<\/p>\n<p><em>Also Read: <a href=\"https:\/\/www.analyticsvidhya.com\/blog\/2024\/09\/llm-agents-for-business\/\" target=\"_blank\" rel=\"noreferrer noopener\">10 Business Applications of LLM Agents<\/a><\/em><\/p>\n<h2 class=\"wp-block-heading\" id=\"h-architecture-of-the-intelligent-faq-chatbot\">Architecture of the Intelligent FAQ Chatbot<\/h2>\n<p>Now we are going to dive into the architecture of the chatbot we are going to build. We\u2019ll be exploring how it works and what its important components are.<\/p>\n<p>The following figure shows the overall structure of our system. We will be implementing this using LangGraph, which is an open-source AI agents framework from LangChain.<\/p>\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"453\" height=\"614\" src=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/05\/architecture_infographic.webp\" alt=\"FAQ chatbot architecture\" class=\"wp-image-233441\" srcset=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/05\/architecture_infographic.webp 453w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/05\/architecture_infographic-221x300.webp 221w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/05\/architecture_infographic-150x203.webp 150w\" sizes=\"auto, (max-width: 453px) 100vw, 453px\"\/><\/figure>\n<p>The key components of our system include:<\/p>\n<ol class=\"wp-block-list\">\n<li><strong>LangGraph:<\/strong> A powerful open-source AI agent framework that efficiently creates complex, multi-agent, cyclic graph-based agents. These agents can maintain the states throughout the workflow and can efficiently handle the complex queries.<\/li>\n<li><strong>LLM: <\/strong>An efficient and powerful <a href=\"https:\/\/www.analyticsvidhya.com\/blog\/2023\/07\/beginners-guide-to-build-large-language-models-from-scratch\/\" target=\"_blank\" rel=\"noreferrer noopener\">Large Language Model<\/a> that can follow the instructions of the user and reply accordingly with the best of its knowledge. Here we will be using OpenAI\u2019s o4-mini, which is a small reasoning model that is specifically designed for speed, affordability, and tool use.<\/li>\n<li><strong>Vector Database: <\/strong>A vector database is used to store, manage and retrieve vector embeddings which are usually the numeric representation of data. Here we are using ChromaDB which is an open source AI native vector database. It is designed to empower the systems that depend on similarity searches, semantic searches, and other tasks involving vector data.<\/li>\n<\/ol>\n<p><em>Also Read: <a href=\"https:\/\/www.analyticsvidhya.com\/blog\/2025\/03\/customer-support-voice-agent\/\" target=\"_blank\" rel=\"noreferrer noopener\">How to Build a Customer Support Voice Agent<\/a><\/em><\/p>\n<h2 class=\"wp-block-heading\" id=\"h-hands-on-implementation-on-building-the-intelligent-faq-chatbot\">Hands-on Implementation on Building the Intelligent FAQ Chatbot<\/h2>\n<p>Now, we will be implementing the end-to-end workflow of our chatbot based on the architecture that we have discussed above. We will be doing it step-by-step with detailed explanations, code, as well as sample outputs. So let\u2019s begin.<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-step-1-install-dependencies\">Step 1: Install Dependencies<\/h3>\n<p>We will start by installing all the required libraries into our Jupyter notebook. This includes libraries such as langchain, langgraph, langchain-openai, langchain-community, chromadb, openai, python-dotenv, pydantic, and pysqlite3.<\/p>\n<pre class=\"wp-block-code\"><code>!pip install -q langchain langgraph langchain-openai langchain-community chromadb openai python-dotenv pydantic pysqlite3<\/code><\/pre>\n<h3 class=\"wp-block-heading\" id=\"h-step-2-import-required-libraries\">Step 2: Import Required Libraries<\/h3>\n<p>Now we are ready to import all the remaining libraries that we will need for this project.<\/p>\n<pre class=\"wp-block-code\"><code>import os\nimport json\nfrom typing import List, TypedDict, Annotated, Dict\nfrom dotenv import load_dotenv\n\n# Langchain &amp; LangGraph specific imports\nfrom langchain_openai import ChatOpenAI, OpenAIEmbeddings\nfrom langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder\nfrom pydantic import BaseModel, Field\nfrom langchain_core.messages import SystemMessage, HumanMessage, AIMessage\nfrom langchain_core.documents import Document\nfrom langchain_community.vectorstores import Chroma\nfrom langgraph.graph import StateGraph, END<\/code><\/pre>\n<h3 class=\"wp-block-heading\" id=\"h-step-3-set-up-the-openai-api-key\">Step 3: Set Up the OpenAI API Key<\/h3>\n<p>Enter your OpenAI key to set it as an environment variable.<\/p>\n<pre class=\"wp-block-code\"><code>from getpass import getpass\nOPENAI_API_KEY = getpass(\"OpenAI API Key:\")\nload_dotenv()\nos.getenv(\"OPENAI_API_KEY\")<\/code><\/pre>\n<h3 class=\"wp-block-heading\" id=\"h-step-4-download-the-dataset\">Step 4: Download the Dataset<\/h3>\n<p>We have made a sample FAQ dataset in json format for different departments. We\u2019ll need to download it from the drive and unzip it.<\/p>\n<pre class=\"wp-block-code\"><code>!gdown 1j6pdIansfQzKOZSEUinnHd8w6GlkKE6w\n!unzip -o \/content\/blog_faq_files.zip<\/code><\/pre>\n<p><strong>Output:<\/strong><\/p>\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1095\" height=\"262\" src=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/05\/download_dataset.webp\" alt=\"Chatbot using LangGraph and agentic RAG\" class=\"wp-image-233442\" srcset=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/05\/download_dataset.webp 1095w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/05\/download_dataset-300x72.webp 300w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/05\/download_dataset-768x184.webp 768w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/05\/download_dataset-150x36.webp 150w\" sizes=\"auto, (max-width: 1095px) 100vw, 1095px\"\/><\/figure>\n<h3 class=\"wp-block-heading\" id=\"h-step-5-defining-the-department-names-for-mapping\">Step 5: Defining the Department Names for Mapping<\/h3>\n<p>Now, let\u2019s define the mapping of the departments so that our agentic system can understand which file belongs to which department.<\/p>\n<pre class=\"wp-block-code\"><code># Define Department Names (ensure these match metadata used during ingestion)\nDEPARTMENTS = [\n   \"Customer Support\",\n   \"Product Information\",\n   \"Loyalty Program \/ Rewards\"\n]\nUNKNOWN_DEPARTMENT = \"Unknown\/Other\"\n\nFAQ_FILES = {\n   \"Customer Support\": \"customer_support_faq.json\",\n   \"Product Information\": \"product_information_faq.json\",\n   \"Loyalty Program \/ Rewards\": \"loyalty_program_faq.json\",\n}<\/code><\/pre>\n<h3 class=\"wp-block-heading\" id=\"h-step-6-define-the-helper-functions\">Step 6: Define the Helper Functions<\/h3>\n<p>We will define some helper functions which will be responsible for loading FAQs from the json files and also storing them in ChromaDB.<\/p>\n<p><strong>1. load_faqs(\u2026):<\/strong> It is a helper function which loads the FAQ from the json files and store them in a list called all_faqs.<\/p>\n<pre class=\"wp-block-code\"><code>def load_faqs(file_paths: Dict[str, str]) -&gt; Dict[str, List[Dict[str, str]]]:\n   \"\"\"Loads QA pairs from JSON files for each department.\"\"\"\n   all_faqs = {}\n   print(\"Loading FAQs...\")\n   for dept, file_path in file_paths.items():\n       try:\n           with open(file_path, 'r', encoding='utf-8') as f:\n               all_faqs[dept] = json.load(f)\n               print(f\"  - Loaded {len(all_faqs[dept])} FAQs for {dept}\")\n       except FileNotFoundError:\n           print(f\"  - WARNING: FAQ file not found for {dept}: {file_path}. Skipping.\")\n       except json.JSONDecodeError:\n           print(f\"  - ERROR: Could not decode JSON for {dept} from {file_path}. Skipping.\")\n   return all_faqs<\/code><\/pre>\n<p><strong>2. setup_chroma_vector_store(\u2026): <\/strong>This function sets up the ChromaDB to store the vector embeddings. For this, we will first define the Chroma configuration i.e., the directory which will contain the chroma database files. Then we will convert the FAQs to LangChain\u2019s Documents. It will contain metadata and page content which is the predefined format for an accurate RAG. We can combine question and answers for better contextual retrieval or just embed the answer. We are keeping the question as well department name in the metadata.<\/p>\n<pre class=\"wp-block-code\"><code># ChromaDB Configuration\nCHROMA_PERSIST_DIRECTORY = \".\/chroma_db_store\"\nCHROMA_COLLECTION_NAME = \"Chatbot_faqs\"\n\ndef setup_chroma_vector_store(\n   all_faqs: Dict[str, List[Dict[str, str]]],\n   persist_directory: str,\n   collection_name: str,\n   embedding_model: OpenAIEmbeddings,\n) -&gt; Chroma:\n   \"\"\"Creates or loads a Chroma vector store with FAQ data and metadata.\"\"\"\n   documents = []\n   print(\"\\nPreparing documents for vector store...\")\n   for department, faqs in all_faqs.items():\n       for faq in faqs:\n           # Combine Q&amp;A for better contextual embedding, or just embed answers\n           # content = f\"Question: {faq['question']}\\nAnswer: {faq['answer']}\"\n           content = faq['answer'] # Often embedding just the answer is effective for FAQ retrieval\n           doc = Document(\n               page_content=content,\n               metadata={\n                   \"department\": department,\n                   \"question\": faq['question'] # Keep question in metadata for potential display\n                   }\n           )\n           documents.append(doc)\n\n   print(f\"Total documents prepared: {len(documents)}\")\n\n   if not documents:\n       raise ValueError(\"No documents found to add to the vector store. Check FAQ loading.\")\n\n   print(f\"Initializing ChromaDB vector store (Persistence: {persist_directory})...\")\n   vector_store = Chroma(\n       collection_name=collection_name,\n       embedding_function=embedding_model,\n       persist_directory=persist_directory,\n   )\n   try:\n     vector_store = Chroma.from_documents(\n             documents=documents,\n             embedding=embedding_model,\n             persist_directory=persist_directory,\n             collection_name=collection_name\n             )\n     print(f\"Created and populated ChromaDB with {len(documents)} documents.\")\n     vector_store.persist() # Ensure persistence after creation\n     print(\"Vector store persisted.\")\n   except Exception as create_e:\n           print(f\"FATAL ERROR: Could not create Chroma vector store: {create_e}\")\n           raise create_e\n\n   print(\"ChromaDB setup complete.\")\n   return vector_store<\/code><\/pre>\n<h3 class=\"wp-block-heading\" id=\"h-step-7-define-the-langgraph-agent-components\">Step 7: Define the LangGraph Agent Components<\/h3>\n<p>Let\u2019s now define our AI agent component which is the main component of our work flow.<\/p>\n<p><strong>1. State definition:<\/strong> It is a python class containing the current state of the agent while running. It contains variables such as query, sentiment, department.<\/p>\n<pre class=\"wp-block-code\"><code>class AgentState(TypedDict):\n   query: str\n   sentiment: str\n   department: str\n   context: str # Retrieved context for RAG\n   response: str # Final response to the user\n   error: str | None # To capture potential errors<\/code><\/pre>\n<p><strong>2. Pydantic model:<\/strong> We have defined a <a href=\"https:\/\/www.analyticsvidhya.com\/blog\/2024\/12\/pydanticai\/\" target=\"_blank\" rel=\"noreferrer noopener\">pydantic model<\/a> here which will ensure a structured LLM output. It contains a sentiment which will have three values, \u201cpositive\u201d, \u201cnegative\u201d and \u201cneutral\u201d and a department name which will be predicted by the LLM.<\/p>\n<pre class=\"wp-block-code\"><code>class ClassificationResult(BaseModel):\n   \"\"\"Structured output for query classification.\"\"\"\n   sentiment: str = Field(description=\"Sentiment of the query (positive, neutral, negative)\")\n   department: str = Field(description=f\"Most relevant department from the list: {DEPARTMENTS + [UNKNOWN_DEPARTMENT]}. Use '{UNKNOWN_DEPARTMENT}' if unsure or not applicable.\")<\/code><\/pre>\n<p><strong>3. Nodes:<\/strong> The following are the node functions which will handle each task one by one.<\/p>\n<ol class=\"wp-block-list\"\/>\n<ul class=\"wp-block-list\">\n<li><strong>Classify_query_node:<\/strong> It classifies the incoming query into the sentiment as well as the target department name based on the nature of the query.<\/li>\n<li><strong>retrieve_context_node:\u00a0<\/strong> It performs the RAG over the vector database and filter the results on the basis of department name.<\/li>\n<li><strong>generate_response_node:<\/strong> It generates the final response based on the query and retrieved context from the database.<\/li>\n<li><strong>Human_escalation_node:<\/strong> If the sentiment is negative or the target department is unknown, it will escalate the query to the human user.<\/li>\n<li><strong>route_query:<\/strong> It determines the next step based on the query and output of the classification node.<\/li>\n<\/ul>\n<pre class=\"wp-block-code\"><code># 3. Nodes\ndef classify_query_node(state: AgentState) -&gt; Dict[str, str]:\n   \"\"\"\n   Classifies the user query for sentiment and target department using an LLM.\n   \"\"\"\n   print(\"--- Classifying Query ---\")\n   query = state[\"query\"]\n   llm = ChatOpenAI(model=\"o4-mini\", api_key=OPENAI_API_KEY) # Use a reliable, cheaper model\n\n   # Prepare prompt for classification\n   prompt_template = ChatPromptTemplate.from_messages([\n       SystemMessage(\n           content=f\"\"\"You are an expert query classifier for ShopUNow, a retail company.\nAnalyze the user's query to determine its sentiment and the most relevant department.\nThe available departments are: {', '.join(DEPARTMENTS)}.\nIf the query doesn't clearly fit into one of these, or is ambiguous, classify the department as '{UNKNOWN_DEPARTMENT}'.\nIf the query expresses frustration, anger, dissatisfaction, or complains about a problem, classify sentiment as 'negative'.\nIf the query is asking a question, seeking information, or making a neutral statement, classify sentiment as 'neutral'.\nIf the query expresses satisfaction, praise, or positive feedback, classify sentiment as 'positive'.\nRespond ONLY with the structured JSON output format.\"\"\"\n       ),\n       HumanMessage(content=f\"User Query: {query}\")\n   ])\n\n   # LLM Chain with structured output\n   classifier_chain = prompt_template | llm.with_structured_output(ClassificationResult)\n\n   try:\n       result: ClassificationResult = classifier_chain.invoke({}) # Pass empty dict as input seems required now\n       print(f\"  Classification Result: Sentiment=\"{result.sentiment}\", Department=\"{result.department}\"\")\n       return {\n           \"sentiment\": result.sentiment.lower(), # Normalize\n           \"department\": result.department\n           }\n   except Exception as e:\n       print(f\"  Error during classification: {e}\")\n       return {\n           \"sentiment\": \"neutral\", # Default on error\n           \"department\": UNKNOWN_DEPARTMENT,\n           \"error\": f\"Classification failed: {e}\"\n           }\n\ndef retrieve_context_node(state: AgentState) -&gt; Dict[str, str]:\n   \"\"\"\n   Retrieves relevant context from the vector store based on the query and department.\n   \"\"\"\n   print(\"--- Retrieving Context ---\")\n   query = state[\"query\"]\n   department = state[\"department\"]\n\n   if not department or department == UNKNOWN_DEPARTMENT:\n       print(\"  Skipping retrieval: Department unknown or not applicable.\")\n       return {\"context\": \"\", \"error\": \"Cannot retrieve context without a valid department.\"}\n\n   # Initialize embedding model and vector store access\n   embedding_model = OpenAIEmbeddings(api_key=OPENAI_API_KEY)\n   vector_store = Chroma(\n       collection_name=CHROMA_COLLECTION_NAME,\n       embedding_function=embedding_model,\n       persist_directory=CHROMA_PERSIST_DIRECTORY,\n   )\n   retriever = vector_store.as_retriever(\n       search_type=\"similarity\",\n       search_kwargs={\n           'k': 3, # Retrieve top 3 relevant docs\n           'filter': {'department': department} # *** CRITICAL: Filter by department ***\n           }\n   )\n\n   try:\n       retrieved_docs = retriever.invoke(query)\n       if retrieved_docs:\n           context = \"\\n\\n---\\n\\n\".join([doc.page_content for doc in retrieved_docs])\n           print(f\"  Retrieved {len(retrieved_docs)} documents for department '{department}'.\")\n           # print(f\"  Context Snippet: {context[:200]}...\") # Optional: log snippet\n           return {\"context\": context, \"error\": None}\n       else:\n           print(\"  No relevant documents found in vector store for this department.\")\n           return {\"context\": \"\", \"error\": \"No relevant context found.\"}\n   except Exception as e:\n       print(f\"  Error during context retrieval: {e}\")\n       return {\"context\": \"\", \"error\": f\"Retrieval failed: {e}\"}\n\ndef generate_response_node(state: AgentState) -&gt; Dict[str, str]:\n   \"\"\"\n   Generates a response using RAG based on the query and retrieved context.\n   \"\"\"\n   print(\"--- Generating Response (RAG) ---\")\n   query = state[\"query\"]\n   context = state[\"context\"]\n   llm = ChatOpenAI(model=\"o4-mini\", api_key=OPENAI_API_KEY) # Can use a more capable model for generation\n\n   if not context:\n       print(\"  No context provided, generating generic response.\")\n       # Fallback if retrieval failed but routing decided RAG path anyway\n       response_text = \"I couldn't find specific information related to your query in our knowledge base. Could you please rephrase or provide more details?\"\n       return {\"response\": response_text}\n\n   # RAG Prompt\n   prompt_template = ChatPromptTemplate.from_messages([\n       SystemMessage(\n           content=f\"\"\"You are a helpful AI Chatbot for ShopUNow. Answer the user's query based *only* on the provided context.\nBe concise and directly address the query. If the context doesn't contain the answer, state that clearly.\nDo not make up information.\nContext:\n---\n{context}\n---\"\"\"\n       ),\n       HumanMessage(content=f\"User Query: {query}\")\n   ])\n\n   RAG_chain = prompt_template | llm\n\n   try:\n       response = RAG_chain.invoke({})\n       response_text = response.content\n       print(f\"  Generated RAG Response: {response_text[:200]}...\")\n       return {\"response\": response_text}\n   except Exception as e:\n       print(f\"  Error during response generation: {e}\")\n       return {\"response\": \"Sorry, I encountered an error while generating the response.\", \"error\": f\"Generation failed: {e}\"}\n\ndef human_escalation_node(state: AgentState) -&gt; Dict[str, str]:\n   \"\"\"\n   Provides a message indicating the query will be escalated to a human.\n   \"\"\"\n   print(\"--- Escalating to Human Support ---\")\n   reason = \"\"\n   if state.get(\"sentiment\") == \"negative\":\n       reason = \"Due to the nature of your query,\"\n   elif state.get(\"department\") == UNKNOWN_DEPARTMENT:\n       reason = \"As your query requires specific attention,\"\n\n   response_text = f\"{reason} I need to escalate this to our human support team. They will review your request and get back to you shortly. Thank you for your patience.\"\n   print(f\"  Escalation Message: {response_text}\")\n   return {\"response\": response_text}\n\n# 4. Conditional Routing Logic\ndef route_query(state: AgentState) -&gt; str:\n   \"\"\"Determines the next step based on classification results.\"\"\"\n   print(\"--- Routing Decision ---\")\n   sentiment = state.get(\"sentiment\", \"neutral\")\n   department = state.get(\"department\", UNKNOWN_DEPARTMENT)\n\n   if sentiment == \"negative\" or department == UNKNOWN_DEPARTMENT:\n       print(f\"  Routing to: human_escalation (Sentiment: {sentiment}, Department: {department})\")\n       return \"human_escalation\"\n   else:\n       print(f\"  Routing to: retrieve_context (Sentiment: {sentiment}, Department: {department})\")\n       return \"retrieve_context\"<\/code><\/pre>\n<h3 class=\"wp-block-heading\" id=\"h-step-8-define-the-graph-function\">Step 8: Define the Graph Function<\/h3>\n<p>Let\u2019s build the function for the graph and assign the nodes and edges to the graph.<\/p>\n<pre class=\"wp-block-code\"><code># --- Graph Definition ---\n\ndef build_agent_graph(vector_store: Chroma) -&gt; StateGraph:\n   \"\"\"Builds the LangGraph agent.\"\"\"\n   graph = StateGraph(AgentState)\n\n   # Add nodes\n   graph.add_node(\"classify_query\", classify_query_node)\n   graph.add_node(\"retrieve_context\", retrieve_context_node)\n   graph.add_node(\"generate_response\", generate_response_node)\n   graph.add_node(\"human_escalation\", human_escalation_node)\n\n   # Set entry point\n   graph.set_entry_point(\"classify_query\")\n\n   # Add edges\n   graph.add_conditional_edges(\n       \"classify_query\", # Source node\n       route_query,      # Function to determine the route\n       {                 # Mapping: output of route_query -&gt; destination node\n           \"retrieve_context\": \"retrieve_context\",\n           \"human_escalation\": \"human_escalation\"\n       }\n   )\n   graph.add_edge(\"retrieve_context\", \"generate_response\")\n   graph.add_edge(\"generate_response\", END)\n   graph.add_edge(\"human_escalation\", END)\n\n   # Compile the graph\n   # memory = SqliteSaver.from_conn_string(\":memory:\") # Example for in-memory persistence\n   app = graph.compile() # checkpointer=memory optional for stateful conversations\n   print(\"\\nAgent graph compiled successfully.\")\n   return app<\/code><\/pre>\n<h3 class=\"wp-block-heading\" id=\"h-step-9-initiate-agent-execution\">Step 9: Initiate Agent Execution<\/h3>\n<p>Now, we will be initialising the agent and begin executing the workflow.<\/p>\n<p>1. Let\u2019s start by loading the FAQs.<\/p>\n<pre class=\"wp-block-code\"><code># 1. Load FAQs\nfaqs_data = load_faqs(FAQ_FILES)\n\nif not faqs_data:\n   print(\"ERROR: No FAQ data loaded. Exiting.\")\n   exit()<\/code><\/pre>\n<p><strong>Output:<\/strong><\/p>\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"740\" height=\"142\" src=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/05\/main_execution_1st_output.webp\" alt=\"Chatbot using LangGraph and agentic RAG\" class=\"wp-image-233478\" srcset=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/05\/main_execution_1st_output.webp 740w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/05\/main_execution_1st_output-300x58.webp 300w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/05\/main_execution_1st_output-150x29.webp 150w\" sizes=\"auto, (max-width: 740px) 100vw, 740px\"\/><\/figure>\n<p>2. Set up the embedding models. Here, we\u2019ll be setting up OpenAI embedding models for a faster retrieval.<\/p>\n<pre class=\"wp-block-code\"><code># 2. Setup Vector Store\nembedding_model = OpenAIEmbeddings(api_key=OPENAI_API_KEY)\nvector_store = setup_chroma_vector_store(\n   faqs_data,\n   CHROMA_PERSIST_DIRECTORY,\n   CHROMA_COLLECTION_NAME,\n   embedding_model\n)<\/code><\/pre>\n<p><strong>Output:<\/strong><\/p>\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1129\" height=\"393\" src=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/05\/main_execution_2nd_output.webp.webp\" alt=\"Chatbot using LangGraph and agentic RAG\" class=\"wp-image-233479\" srcset=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/05\/main_execution_2nd_output.webp.webp 1129w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/05\/main_execution_2nd_output.webp-300x104.webp 300w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/05\/main_execution_2nd_output.webp-768x267.webp 768w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/05\/main_execution_2nd_output.webp-150x52.webp 150w\" sizes=\"auto, (max-width: 1129px) 100vw, 1129px\"\/><\/figure>\n<p><em>Also Read: <a href=\"https:\/\/www.analyticsvidhya.com\/blog\/2025\/03\/embedding-for-rag-models\/\" target=\"_blank\" rel=\"noreferrer noopener\">How to Choose the Right Embedding for Your RAG Model?<\/a><\/em><\/p>\n<p>3. Now, build the agent using the predefined function, visualizing the agent flow using the mermaid diagram.<\/p>\n<pre class=\"wp-block-code\"><code># 3. Build the Agent Graph\nagent_app = build_agent_graph(vector_store)\n\nfrom IPython.display import display, Image, Markdown\n\ndisplay(Image(agent_app.get_graph().draw_mermaid_png()))<\/code><\/pre>\n<p><strong>Output:<\/strong><\/p>\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"591\" height=\"681\" src=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/05\/main_execution_3rd_output-1.webp-1.webp\" alt=\"FAQ Chatbot using LangGraph and agentic RAG\" class=\"wp-image-233482\" style=\"width:423px;height:auto\" srcset=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/05\/main_execution_3rd_output-1.webp-1.webp 591w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/05\/main_execution_3rd_output-1.webp-1-260x300.webp 260w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/05\/main_execution_3rd_output-1.webp-1-150x173.webp 150w\" sizes=\"auto, (max-width: 591px) 100vw, 591px\"\/><\/figure>\n<h3 class=\"wp-block-heading\" id=\"h-step-10-testing-the-agent\">Step 10: Testing the Agent<\/h3>\n<p>We have arrived at the last part of our workflow. So far we have built several nodes and functions. Now is the time to test our agent and see the output.<\/p>\n<p>1. First let\u2019s define the test queries.<\/p>\n<pre class=\"wp-block-code\"><code># Test the Agent\ntest_queries = [\n   \"How do I track my order?\",\n   \"What is the return policy?\",\n   \"Tell me about the 'Urban Explorer' jacket materials.\",\n]<\/code><\/pre>\n<p>2. Now let\u2019s test the agent.<\/p>\n<pre class=\"wp-block-code\"><code>print(\"\\n--- Testing Agent ---\")\nfor query in test_queries:\n   print(f\"\\nInput Query: {query}\")\n   # Define the input for the graph invocation\n   inputs = {\"query\": query}\n   # try:\n   # Invoke the graph\n   # The config argument is optional but useful for stateful execution if needed\n   # config = {\"configurable\": {\"thread_id\": \"user_123\"}} # Example config\n   final_state = agent_app.invoke(inputs) #, config=config)\n\n   print(f\"Final State Department: {final_state.get('department')}\")\n   print(f\"Final State Sentiment: {final_state.get('sentiment')}\")\n   print(f\"Agent Response: {final_state.get('response')}\")\n   if final_state.get('error'):\n         print(f\"Error encountered: {final_state.get('error')}\")\n\n   # except Exception as e:\n   #     print(f\"ERROR running agent graph for query '{query}': {e}\")\n   #     import traceback\n   #     traceback.print_exc() # Print detailed traceback for debugging\n\nprint(\"\\n--- Agent Testing Complete ---\")<\/code><\/pre>\n<ol class=\"wp-block-list\"\/>\n<p>print(\u201c\\n\u2014 Testing Agent \u2014\u201c)<\/p>\n<p><strong>Output:<\/strong><\/p>\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"547\" height=\"794\" src=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/05\/Testing_agent-1.webp\" alt=\"Final output\" class=\"wp-image-233483\" srcset=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/05\/Testing_agent-1.webp 547w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/05\/Testing_agent-1-207x300.webp 207w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/05\/Testing_agent-1-150x218.webp 150w\" sizes=\"auto, (max-width: 547px) 100vw, 547px\"\/><\/figure>\n<p>We can see in the output that our agent is performing well. Firstly, it classifies the query and then routes the decision to the retrieval node or the human node. Then, the retrieval part comes it successfully retrieves the context from the vector database. In the last, generating the response as needed. Hence, we have made our intelligent FAQ Chatbot.<\/p>\n<p>You can access the Colab Notebook with all the code <a href=\"https:\/\/colab.research.google.com\/drive\/1Z4u03Pb0sts35Tvl2_tjYk5J9t-B_6Jm?usp=sharing\" target=\"_blank\" rel=\"nofollow noopener\">here<\/a>.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2>\n<p>If you have reached this far, it means you have learned how to build an intelligent FAQ chatbot using agentic RAG and LangGraph. Here, we saw that building an intelligent agent which can reason and make a decision, is not that hard. The agentic chatbot that we built is cost efficient, fast, and is capable of fully understanding the context of the questions or input queries. The architecture we\u2019ve used here is fully customizable which means one can edit any node of the agent for their particular use case. With agentic RAG, LangGraph, and ChromaDB, making agents has never been this easy. never so easy before. I\u2019m sure what we have covered in this guide has given you the foundational knowledge to build more complex system using these tools.<\/p>\n<div class=\"border-top py-3 author-info my-4\">\n<div class=\"author-card d-flex align-items-center\">\n<div class=\"flex-shrink-0 overflow-hidden\">\n                                    <a href=\"https:\/\/www.analyticsvidhya.com\/blog\/author\/harsh9480979\/\" class=\"text-decoration-none active-avatar\"><br \/>\n                                                                       <img decoding=\"async\" src=\"https:\/\/av-eks-lekhak.s3.amazonaws.com\/media\/lekhak-profile-images\/converted_image_0fBqNLi.webp\" width=\"48\" height=\"48\" alt=\"Harsh Mishra\" loading=\"lazy\" class=\"rounded-circle\"\/><\/p>\n<p>                                <\/a>\n                                <\/div>\n<\/p><\/div>\n<p>Harsh Mishra is an AI\/ML Engineer who spends more time talking to Large Language Models than actual humans. Passionate about GenAI, NLP, and making machines smarter (so they don\u2019t replace him just yet). When not optimizing models, he\u2019s probably optimizing his coffee intake. \ud83d\ude80\u2615<\/p>\n<\/p><\/div>\n<\/p><\/div>\n<p><h4 class=\"fs-24 text-dark\">Login to continue reading and enjoy expert-curated content.<\/h4>\n<p>                        <button class=\"btn btn-primary mx-auto d-table\" data-bs-toggle=\"modal\" data-bs-target=\"#loginModal\" id=\"readMoreBtn\">Keep Reading for Free<\/button>\n                    <\/p>\n\n","protected":false},"excerpt":{"rendered":"<p>AI agents are now a part of enterprises big and small. From filling forms at hospitals and checking legal documents to analyzing video footage and handling customer support \u2013 we have AI agents for all kinds of tasks. Companies often spend hundreds of thousands of dollars on hiring customer support staff who can understand the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":223054,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12033],"tags":[25423,5293,28812,13129,24700,32726],"dealstore":[],"offerexpiration":[],"class_list":["post-223053","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-analytics","tag-agentic","tag-build","tag-chatbot","tag-faq","tag-intelligent","tag-rag"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Build an Intelligent FAQ Chatbot Using Agentic RAG - Som2ny Network<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/fivemor.com\/?p=223053\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Build an Intelligent FAQ Chatbot Using Agentic RAG - Som2ny Network\" \/>\n<meta property=\"og:description\" content=\"AI agents are now a part of enterprises big and small. From filling forms at hospitals and checking legal documents to analyzing video footage and handling customer support \u2013 we have AI agents for all kinds of tasks. Companies often spend hundreds of thousands of dollars on hiring customer support staff who can understand the [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fivemor.com\/?p=223053\" \/>\n<meta property=\"og:site_name\" content=\"Som2ny Network\" \/>\n<meta property=\"article:published_time\" content=\"2025-05-04T15:08:28+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/05\/Building-an-Intelligent-FAQ-Assistant-Using-LangGraph-1.webp.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"872\" \/>\n\t<meta property=\"og:image:height\" content=\"473\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"16 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/fivemor.com\/?p=223053#article\",\"isPartOf\":{\"@id\":\"https:\/\/fivemor.com\/?p=223053\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371\"},\"headline\":\"How to Build an Intelligent FAQ Chatbot Using Agentic RAG\",\"datePublished\":\"2025-05-04T15:08:28+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/fivemor.com\/?p=223053\"},\"wordCount\":1475,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/fivemor.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/?p=223053#primaryimage\"},\"thumbnailUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/05\/Building-an-Intelligent-FAQ-Assistant-Using-LangGraph-1.webp.webp\",\"keywords\":[\"agentic\",\"Build\",\"chatbot\",\"FAQ\",\"intelligent\",\"RAG\"],\"articleSection\":[\"Analytics\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/fivemor.com\/?p=223053#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/fivemor.com\/?p=223053\",\"url\":\"https:\/\/fivemor.com\/?p=223053\",\"name\":\"How to Build an Intelligent FAQ Chatbot Using Agentic RAG - Som2ny Network\",\"isPartOf\":{\"@id\":\"https:\/\/fivemor.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/fivemor.com\/?p=223053#primaryimage\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/?p=223053#primaryimage\"},\"thumbnailUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/05\/Building-an-Intelligent-FAQ-Assistant-Using-LangGraph-1.webp.webp\",\"datePublished\":\"2025-05-04T15:08:28+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/fivemor.com\/?p=223053#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/fivemor.com\/?p=223053\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/fivemor.com\/?p=223053#primaryimage\",\"url\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/05\/Building-an-Intelligent-FAQ-Assistant-Using-LangGraph-1.webp.webp\",\"contentUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/05\/Building-an-Intelligent-FAQ-Assistant-Using-LangGraph-1.webp.webp\",\"width\":872,\"height\":473},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/fivemor.com\/?p=223053#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/fivemor.com\/?bp_activities=1\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Build an Intelligent FAQ Chatbot Using Agentic RAG\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/fivemor.com\/#website\",\"url\":\"https:\/\/fivemor.com\/\",\"name\":\"Som2ny Network\",\"description\":\"Daily Deals\",\"publisher\":{\"@id\":\"https:\/\/fivemor.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/fivemor.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/fivemor.com\/#organization\",\"name\":\"Som2ny Network\",\"url\":\"https:\/\/fivemor.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2026\/07\/4a0953c4-logo-300x86-1.png\",\"contentUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2026\/07\/4a0953c4-logo-300x86-1.png\",\"width\":300,\"height\":86,\"caption\":\"Som2ny Network\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/729ae85bf62b9917e93538db2f2688ca?s=96&r=g&default=https%3A%2F%2Ffivemor.com%2Fwp-content%2Fplugins%2Fbuddypress-first-letter-avatar%2Fimages%2Fdefault%2F96%2Flatin_a.png\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/729ae85bf62b9917e93538db2f2688ca?s=96&r=g&default=https%3A%2F%2Ffivemor.com%2Fwp-content%2Fplugins%2Fbuddypress-first-letter-avatar%2Fimages%2Fdefault%2F96%2Flatin_a.png\",\"caption\":\"admin\"},\"sameAs\":[\"https:\/\/fivemor.com\"],\"url\":\"https:\/\/fivemor.com\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Build an Intelligent FAQ Chatbot Using Agentic RAG - Som2ny Network","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/fivemor.com\/?p=223053","og_locale":"en_US","og_type":"article","og_title":"How to Build an Intelligent FAQ Chatbot Using Agentic RAG - Som2ny Network","og_description":"AI agents are now a part of enterprises big and small. From filling forms at hospitals and checking legal documents to analyzing video footage and handling customer support \u2013 we have AI agents for all kinds of tasks. Companies often spend hundreds of thousands of dollars on hiring customer support staff who can understand the [&hellip;]","og_url":"https:\/\/fivemor.com\/?p=223053","og_site_name":"Som2ny Network","article_published_time":"2025-05-04T15:08:28+00:00","og_image":[{"width":872,"height":473,"url":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/05\/Building-an-Intelligent-FAQ-Assistant-Using-LangGraph-1.webp.webp","type":"image\/webp"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"16 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fivemor.com\/?p=223053#article","isPartOf":{"@id":"https:\/\/fivemor.com\/?p=223053"},"author":{"name":"admin","@id":"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371"},"headline":"How to Build an Intelligent FAQ Chatbot Using Agentic RAG","datePublished":"2025-05-04T15:08:28+00:00","mainEntityOfPage":{"@id":"https:\/\/fivemor.com\/?p=223053"},"wordCount":1475,"commentCount":0,"publisher":{"@id":"https:\/\/fivemor.com\/#organization"},"image":{"@id":"https:\/\/fivemor.com\/?p=223053#primaryimage"},"thumbnailUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/05\/Building-an-Intelligent-FAQ-Assistant-Using-LangGraph-1.webp.webp","keywords":["agentic","Build","chatbot","FAQ","intelligent","RAG"],"articleSection":["Analytics"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fivemor.com\/?p=223053#respond"]}]},{"@type":"WebPage","@id":"https:\/\/fivemor.com\/?p=223053","url":"https:\/\/fivemor.com\/?p=223053","name":"How to Build an Intelligent FAQ Chatbot Using Agentic RAG - Som2ny Network","isPartOf":{"@id":"https:\/\/fivemor.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/fivemor.com\/?p=223053#primaryimage"},"image":{"@id":"https:\/\/fivemor.com\/?p=223053#primaryimage"},"thumbnailUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/05\/Building-an-Intelligent-FAQ-Assistant-Using-LangGraph-1.webp.webp","datePublished":"2025-05-04T15:08:28+00:00","breadcrumb":{"@id":"https:\/\/fivemor.com\/?p=223053#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fivemor.com\/?p=223053"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fivemor.com\/?p=223053#primaryimage","url":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/05\/Building-an-Intelligent-FAQ-Assistant-Using-LangGraph-1.webp.webp","contentUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/05\/Building-an-Intelligent-FAQ-Assistant-Using-LangGraph-1.webp.webp","width":872,"height":473},{"@type":"BreadcrumbList","@id":"https:\/\/fivemor.com\/?p=223053#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/fivemor.com\/?bp_activities=1"},{"@type":"ListItem","position":2,"name":"How to Build an Intelligent FAQ Chatbot Using Agentic RAG"}]},{"@type":"WebSite","@id":"https:\/\/fivemor.com\/#website","url":"https:\/\/fivemor.com\/","name":"Som2ny Network","description":"Daily Deals","publisher":{"@id":"https:\/\/fivemor.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/fivemor.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/fivemor.com\/#organization","name":"Som2ny Network","url":"https:\/\/fivemor.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fivemor.com\/#\/schema\/logo\/image\/","url":"https:\/\/fivemor.com\/wp-content\/uploads\/2026\/07\/4a0953c4-logo-300x86-1.png","contentUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2026\/07\/4a0953c4-logo-300x86-1.png","width":300,"height":86,"caption":"Som2ny Network"},"image":{"@id":"https:\/\/fivemor.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fivemor.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/729ae85bf62b9917e93538db2f2688ca?s=96&r=g&default=https%3A%2F%2Ffivemor.com%2Fwp-content%2Fplugins%2Fbuddypress-first-letter-avatar%2Fimages%2Fdefault%2F96%2Flatin_a.png","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/729ae85bf62b9917e93538db2f2688ca?s=96&r=g&default=https%3A%2F%2Ffivemor.com%2Fwp-content%2Fplugins%2Fbuddypress-first-letter-avatar%2Fimages%2Fdefault%2F96%2Flatin_a.png","caption":"admin"},"sameAs":["https:\/\/fivemor.com"],"url":"https:\/\/fivemor.com\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/posts\/223053","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=223053"}],"version-history":[{"count":0,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/posts\/223053\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/media\/223054"}],"wp:attachment":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=223053"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=223053"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=223053"},{"taxonomy":"dealstore","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fdealstore&post=223053"},{"taxonomy":"offerexpiration","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fofferexpiration&post=223053"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}