Development of a Context-Aware Customer Service Chatbot with Automated Tool Selection Using Large Language Models and LangChain
Main Article Content
Abstract
Customer service organizations often face challenges in managing fragmented information scattered across internal systems and various types of documents. These issues are further compounded by the loss of procedural knowledge resulting from high employee turnover. This study presents the design and development of an automated chatbot system that integrates a large language model (LLM) with two categories of external tools: Retrieval-Augmented Generation (RAG) for extracting information from documents, and APIs for accessing external systems. The system is built on the LangChain framework, which enables agent orchestration and modular integration of tools. The RAG-based tools are designed to implement a hybrid search approach, combining keyword-based and semantic retrieval, with result ranking performed using Reciprocal Rank Fusion to identify the most relevant information. The chatbot is capable of automatically selecting the appropriate tools based on the context of each user query. Evaluation results show that the system achieved a tool call accuracy of 0.88 and an answer correctness rate of 0.80. Additionally, user and staff satisfaction rates were reported at 85.77% and 85.04%, respectively, highlighting the system’s effectiveness in addressing data retrieval complexity and facilitating knowledge integration in service environments.
Article Details

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
References
C. C. Chang, W. S. Cheng, and S. Hsiao, "Customer Service Chatbot Enhanced with Conversational Language Understanding and Knowledge Base". IEEE 4th Eurasia Conference on IOT, Communication and Engineering (ECICE). 28-30 October. Yunlin, Taiwan : pp. 231-234, 2022. doi: 10.1109/ECICE55674.2022.10042940.
H. C. Lee, K. Hung, G. M. T. Man, R. Ho, and M. Leung, "Development of an RAG-Based LLM Chatbot for Enhancing Technical Support Service". IEEE Region 10 Conference (TENCON). 1-4 December. Singapore : pp. 1080-1083, 2024. doi: 10.1109/TENCON61640.2024.10902801
M. Guettala, S. Bourekkache, O. Kazar, and S. Harous, "Building Advanced RAG Q&A with Multiple Data Sources Using Langchain: A Multi-Search Agent RAG Application in Ubiquitous Learning". International Conference on Computing and Data Analytics (ICCDA). 12-13 November. Shinas, Oman : pp. 1-7, 2024. doi: 10.1109/ICCDA64887.2024.10867361
C. P. Ezenkwu, "Towards Expert Systems for Improved Customer Services Using ChatGPT as an Inference Engine". International Conference on Digital Applications, Transformation & Economy (ICDATE). 14-16 July, Miri, Sarawak, Malaysia : pp. 1-5, 2023. doi: 10.1109/ICDATE58146.2023.10248647
T. Zheng et al. (2 May 2025). From Automation to Autonomy: A Survey on Large Language Models in Scientific Discovery. [Online] Available : http://arxiv.org/abs/2505.13259
MongoDB Inc. (14 July 2025). How to Perform Hybrid Search. [Online] Available : https://www.mongodb.com/docs/atlas/atlas-vector-search/hybrid-search
MongoDB Inc. (14 July 2025). Perform Hybrid Search with Atlas Vector Search and Atlas Search. [Online] Available : https://www.mongodb.com/docs/atlas/atlas-vector-search/hybrid-search/vector-search-with-full-text-search
OpenAi. (10 April 2025). New Embedding Models and API Updates. [Online] Available : https://openai.com/index/new-embedding-models-and-api-updates
X. Dong, X. Zhang, W. Bu, D. Zhang, and F. Cao, "A Survey of LLM-based Agents: Theories, Technologies, Applications and Suggestions". International Conference on Artificial Intelligence, Internet of Things and Cloud Computing Technology (AIoTC). 13-15 September. Wuhan, China : pp. 407-413, 2024. doi: 10.1109/AIoTC63215.2024.10748304
LangChain. (14 July 2025). Tools. [Online] Available : https://js.langchain.com/docs/concepts/tools
S. Es, J. James, L. Espinosa-Anke, and S. Schockaert. (2 May 2025). RAGAS: Automated Evaluation of Retrieval Augmented Generation. [Online] Available : http://arxiv.org/abs/2309.15217