customer_service.json
Overview
The customer_service.json file defines a structured conversational flow designed for an AI-powered customer service chatbot. This flow orchestrates how user inputs are received, categorized, and responded to, using multiple specialized nodes that handle tasks such as answering queries, casual chatting, complaint handling, information retrieval from knowledge bases, and requesting customer contact details when needed.
The file is formatted as a graph consisting of nodes and edges, where each node represents a discrete functional unit or operation in the chatbot's logic, and edges describe the transitions between these nodes. The architecture supports dynamic conversation routing based on user intent classification, leveraging language models and retrieval-augmented generation (RAG) techniques to provide relevant and context-aware responses.
Detailed Explanation of Nodes and Flow
Nodes
Each node has an id, type, position, and data containing configuration or operational parameters. The main node types are:
beginNode: Starting point of the conversation.
ragNode: Nodes that involve retrieval-augmented generation or message generation.
categorizeNode: Node that categorizes user input into predefined categories.
relevantNode: Node that assesses the relevance of retrieved information.
messageNode (modeled here as ragNode with label "Message"): Nodes that send predefined messages.
1. Begin Node
ID:
beginType:
beginNodePurpose: Initiates the conversation.
Data:
label: "Begin"name: "LegalPoetsAttack"form.prologue: "Hi! How can I help you?" — initial greeting.
Functionality: The chatbot welcomes the user and awaits input to start the flow.
2. Answer Node
ID:
answer:0Type: ragNode
Purpose: Central node that routes user input after initial reception.
Data:
label: "Answer"name: "ThreeGeeseBehave"
Functionality: Acts as a junction to pass the conversation to the categorize node.
3. Categorize Node
ID: categorize:0
Type:
categorizeNodePurpose: Classifies user input into categories to determine response strategy.
Data:
label: "Categorize"name: "PublicComicsHammer"form.llm_id: "deepseek-chat" — LLM model used for classification.form.category_description: Defines four categories:product_related: Questions about product usage, appearance, or function.
casual: Non-product casual chat.
complain: Non-specific complaints or curses about product/service.
answer: Requests for specific contact information.
form.message_history_window_size: 8 — number of past messages considered during categorization.
Functionality: Uses an LLM to interpret user intent and routes the conversation accordingly.
4. RAG and Generation Nodes
These nodes generate responses based on the categorized intent.
a) Generate Casual Chat Response
ID:
generate:casualType: ragNode
Purpose: Generates friendly, humorous, and enthusiastic replies for casual chat.
Data:
llm_id:deepseek-chatprompt: Instruction to behave as a customer support engaging in casual conversation.temperature: 0.9 (higher creativity)message_history_window_size: 12cite: false
Example Usage: Responding to "How are you doing?" with a lighthearted answer.
b) Generate Complaint Handling Response
ID:
generate:complainType: ragNode
Purpose: Replies to vague complaints, asking for specific details patiently.
Data:
Similar attributes to casual generation but with prompts focused on soothing and eliciting more details.
Example Usage: Responding to "It sucks" with, "Can you please tell me more about the problem?"
c) Generate Answer from Knowledge Base
ID: generate:answer
Type: ragNode
Purpose: Answers product-related questions using knowledge base content.
Data:
prompt: Instructions to answer based on knowledge base; includes fallback message if no relevant info is found.temperature: 0.02 (low creativity to ensure accuracy)
Example Usage: Answering "How to install the product?" based on retrieved documents.
d) Generate Request for Contact Info
Type: ragNode
Purpose: Requests user contact information when the system cannot provide an answer.
Data:
Prompt instructs to ask for contact details politely without repeating questions.
temperature: 0.9
Example Usage: "Could you please provide your email so our experts can assist you further?"
5. Retrieval Node
ID: retrieval:0
Type: ragNode
Purpose: Retrieves relevant documents from a knowledge base.
Data:
similarity_threshold: 0.2keywords_similarity_weight: 0.3top_n: 6 (number of documents to retrieve)top_k: 1024 (max candidates considered)rerank_id: "BAAI/bge-reranker-v2-m3" (reranking model for better relevance)kb_ids: List of knowledge base IDs used.
Functionality: Fetches relevant data to support answer generation.
6. Relevant Node
ID:
relevant:0Type:
relevantNodePurpose: Determines if retrieved documents are relevant to the user query.
Data:
Uses LLM (
deepseek-chat) with low temperature (0.02) for binary decision.Routes to either:
generate:answer if relevant.
generate:ask_contact if not relevant.
Functionality: Ensures only meaningful knowledge base content is used for responses.
7. Message Node for Contact Confirmation
ID:
message:get_contactType: ragNode (message)
Purpose: Sends polite acknowledgment messages after user provides contact info.
Data:
Contains multiple predefined messages to maintain natural conversation flow.
Example Messages:
"Okay, I've already write this down. What else I can do for you?"
"Thanks for your trust! Our expert will contact ASAP. So, anything else I can do for you?"
Conversation Flow Summary
Conversation starts at Begin node with greeting.
User input is passed to Answer node, then to Categorize node.
The Categorize node classifies input into one of four categories:
product_related: routes to Retrieval node → Relevant node → either Generate Answer or Ask Contact.casual: routes to Generate Casual.complain: routes to Generate Complain.answer: routes to Message Get Contact.
Responses are generated or messages sent accordingly.
After requesting contact, the bot sends a polite confirmation message.
The flow loops as necessary to handle ongoing conversation.
Important Implementation Details
LLM usage: The system extensively uses the "deepseek-chat" LLM for classification, generation, and relevance checking with different prompt engineering and temperature settings tailored per task.
Retrieval-augmented generation (RAG): The architecture combines knowledge base retrieval with generative models to provide accurate and context-aware answers.
Message history window: Different nodes consider different lengths of conversation history (
message_history_window_size) to maintain context.Categorization with handles: The categorize node uses sourceHandle in edges to route the conversation based on classification results.
Fallback strategy: If the knowledge base retrieval is irrelevant, the system gracefully requests user contact details for expert follow-up.
Interaction with Other System Components
Knowledge Base: The retrieval node connects to a knowledge base (
kb_ids) to fetch documents relevant to product-related queries.Language Models: The "deepseek-chat" LLM is central for NLP tasks — categorization, generation, and relevance evaluation.
User Interface / Chat Platform: This JSON likely feeds into a chatbot engine that interprets the nodes and edges to manage user interactions.
Expert System / CRM: When contact information is collected, it presumably passes to customer service experts or CRM systems for follow-up.
Usage Example
Consider a user query: "How to install the product on the wall?"
The chatbot greets the user at
begin.The user input is sent to
answer:0.The categorize:0 node classifies this as
product_related.The flow goes to retrieval:0 to fetch relevant documents.
The
relevant:0node finds the retrieved documents relevant.The generate:answer node formulates an answer based on knowledge base content.
The answer is sent back to the user.
Visual Diagram
flowchart TD
Begin["Begin (LegalPoetsAttack)"]
Answer["Answer (ThreeGeeseBehave)"]
Categorize["Categorize (PublicComicsHammer)"]
Retrieval["Retrieval (ShinyPathsDraw)"]
Relevant["Relevant (LegalPotsLick)"]
GenAnswer["Generate Answer (YellowGamesReport)"]
GenAskContact["Generate Ask Contact (FamousChefsRetire)"]
GenCasual["Generate Casual (SourKnivesPay)"]
GenComplain["Generate Complain (TameLlamasSniff)"]
MsgGetContact["Message Get Contact (BlueBooksTan)"]
Begin --> Answer
Answer --> Categorize
Categorize -- product_related --> Retrieval
Categorize -- casual --> GenCasual
Categorize -- complain --> GenComplain
Categorize -- answer --> MsgGetContact
Retrieval --> Relevant
Relevant -- yes --> GenAnswer
Relevant -- no --> GenAskContact
GenAskContact --> MsgGetContact
Summary
The customer_service.json file is a well-structured conversational flow definition for a customer service chatbot. It integrates advanced NLP components to classify intents, retrieve knowledge, generate context-aware responses, and handle different user scenarios such as casual chat, complaints, product inquiries, and contact info collection. The design leverages modular nodes and edges to maintain clarity, scalability, and adaptability to diverse customer interactions.