## 3 Methodology  
### Domain Knowledge Base Framework  
Although general-purpose LLMs are trained on vast textual data covering diverse topics, they lack specialized expertise in any specific technical domain. To address the need for in-depth comprehension and practical application knowledge in professional domains such as construction engineering, this study establishes a RAG-based domain-specific knowledge repository, the framework of which is illustrated in Figure 1. By compiling industry-specific standards and specifications within the construction engineering domain into an external knowledge resource, this approach mitigates the limitations of general-purpose LLMs in delivering precise, contextually grounded outputs for specialized technical tasks.  
The entire framework comprises two stages: the construction process and the application process. The construction process involves establishing a professional knowledge retrieval database, enabling the dynamic updating of domain knowledge. The application process refers to the user's utilization phase, where specific tasks are accomplished by integrating professional knowledge with LLMs. These two processes operate independently and can run asynchronously. The specific steps for the construction process are as follows:  
Figure 1: Domain knowledge base framework.  
Data Collection. For a knowledge base in the field of construction engineering, it is necessary to systematically gather and organize relevant standards, regulations, technical guidelines, and best practice cases. This includes, but is not limited to, national and local building codes, industry standards, and internationally recognized best practice guidelines, ensuring comprehensiveness and authority of the collected materials.
2. Document Segmentation. Preprocess the gathered materials, including steps such as file parsing and document segmentation, to facilitate subsequent information retrieval. During this process, original documents are divided into multiple smaller text chunks, enhancing the efficiency and accuracy of information retrieval.
3. Vectorization. Convert each text chunk into vector representations, enabling similarity matching with user queries by calculating the similarity between vectors. This process facilitates the provision of highly relevant information to users based on their queries.
4. Vector Storage. Store these external knowledge text chunks as vectors within a specially designed vector database to enable rapid retrieval and efficient management. This approach effectively supports real-time information queries based on content similarity, thereby enhancing the professionalism and precision of system responses. The application process involves the following steps:  
1. Question Vectorization. When a user poses a question, the first step is to convert this question into a vector. This transformation enables similarity matching within the vector space, preparing the query for subsequent retrieval processes.
2. Semantic Related Chunks. This involves using semantic search methods to identify and retrieve chunk vectors that are closest to the query vector and then converting these vectors back into their original text.
3. Integration Context into Prompt. By integrating the user's question and the retrieved contextual text into prompt, the system ensures that the generated response is grounded in precise and relevant professional knowledge.
4. Professional Response. The questions, along with their contextual text, are fed into a LLM. Leveraging the model's inherent language generation capabilities, it produces response that meets professional requirements.