# Leveraging Retrieval-Augmented Generation for Swahili Language Conversation Systems
## 3 Proposed Method
### System Architecture  
The system architecture, as illustrated in Figure 1, is designed to process user queries in Swahili and generate accurate, contextually relevant responses. At the center of the architecture is the User Chatbot Interface, which serves as the primary interaction point for users to input their questions and receive responses. Supporting this interaction is the Manager UI, which provides administrative oversight for the system's operations and knowledge base updates. The Admin Interface, through the Manager UI, ensures the quality, reliability, and relevance of the system's knowledge base. Administrators validate, update, and manage digital resources dynamically using tools like web scraping and API integration. Extracted documents are processed into smaller chunks for efficient embedding and storage in the vector database. The dataset used for this system represents Swahili's linguistic diversity by including major dialects such as Tanzanian, Kenyan, and Congolese Swahili. It spans multiple domains, including culture, healthcare, education, and everyday communication, ensuring adaptability across a variety of use cases. The dataset curation process prioritizes inclusivity, reflecting Swahili's linguistic richness and enhancing the system's applicability. When a user submits a query, the system converts the query into vector embeddings and compares it against stored embeddings in the vector database. Relevant chunks are retrieved and passed, along with the user query, to the pre-trained large language model (LLM) for response generation. If no relevant information is found in the database, the system defaults to generating responses based on the LLM's internal knowledge, maintaining conversational continuity. The generated response is returned to the user through the User Chatbot Interface. This architecture integrates user interaction, dynamic knowledge management, and advanced NLP techniques to provide a robust solution for Swahili conversational AI. By com  
Figure 1: System architecture which illustrates the interaction between the User Chatbot Interface, Manager UI, Knowledge Manager, vector database, and the RAG system for seamless query handling and response generation. bining automated processes, manual validation, and comprehensive datasets, the system addresses the challenges of low-resource languages like Swahili while ensuring high standards of quality and relevance. A key feature of the system is the automatic preprocessing workflow, which streamlines the preparation of raw Swahili data for integration into the knowledge base. This workflow, illustrated in Figure 2, is implemented using Python scripts tailored to the unique characteristics of the Swahili language. The automated process reduces manual workload while ensuring the data meet quality standards. The preprocessing begins with noise removal, where irrelevant characters, symbols, and HTML tags are filtered out to retain only meaningful content. A language detection algorithm then identifies and removes non-Swahili text, ensuring that the dataset remains focused on Swahili content. Abbreviations and shorthand terms are expanded into their full forms to improve clarity and readability. Text normalization ensures consistency in punctuation, casing, and spacing while harmonizing spelling variations. Grammar and spelling corrections are applied using predefined Swahili linguistic rules to enhance the text's linguistic accuracy. Finally, duplicate entries are detected and removed to avoid redundancy and optimize storage efficiency. These automated steps are critical for preparing high-quality data while minimizing manual intervention. Once preprocessing is complete, the cleaned data are passed to the Admin Interface for final validation. Administrators review the data for authenticity and relevance, verifying that it aligns with the system's objectives. Metadata, such as topic tags and source annotations, is added during this stage to improve retrieval accuracy and context relevance.