# Hybrid Multi-Agent GraphRAG for E-Government: Towards a Trustworthy AI Assistant
## 3 Technical Architecture and Solution
### Graph RAG Integration  
The proposed GraphRAG pipeline is composed of two processes. The first is related to the indexing process, and the second one is for data retrieval and text generation, with GPT-4.1-mini. Both are modular, enabling customization and implementation across multiple applications in different contexts, with connections to different LLMs and providers and customizable components based on use case needs. The indexing process is responsible for extracting structured knowledge from unstructured text, using GPT-4.1-mini, with the prompt configuration presented in Table A1 in Appendix A, and indexing it into a graph-based database (Neo4) [37], hosted in Aura in our use case) after the documents are acquired. Before the indexing process itself, various preprocessing steps are applied to prepare the documents in the correct form. The main components of the indexing pipeline include extracting factual triples from the documents, sanitizing entity labels for compatibility with the graph structure, and storing the triples into the Neo4j database. Each extracted triple captures a subject, relation, and object, along with their respective types, ensuring a rich and semantically meaningful representation of the underlying knowledge. Additionally, for each triple, a relation to the source document is generated to retain the connection with the original content. In our use case, for the initial 20 indexed documents, a total of 633 knowledge triples were successfully extracted and indexed from the corpus, resulting in a diverse set of 410 unique relationship types and 259 unique entity types represented within the knowledge graph. The triples display a broad coverage of entities, with 222 unique subjects and 597 unique objects identified. Based on the distribution analysis, each relationship type was observed at least once, with the most frequent relationship type appearing 21 times. Moreover, the triple extraction and indexing pipeline operated robustly, while no errors were encountered during the ingestion process, ensuring comprehensive and reliable graph construction. The extraction process leverages a dedicated custom component, knowledge graph retrieval, with a dedicated template prompt, presented in Table A2 in Appendix A, provided to a language model, GPT-4.1-mini, in our use case, focusing on generating highly accurate and context-aware triples, proceeding with a Cypher query in Neo4j. To ensure flexibility, the database setup includes full-text indexing for efficient entity retrieval and supports dynamic schema adaptation based on incoming data. Later, the query process is responsible for generating responsive answers to user queries by leveraging the structured knowledge stored in the graph database. For this process, we leveraged the knowledge graph retrieval component, which uses a language model to extract key search terms from the user's question, along with the initially connected document through a relationship (MENTION) approach customized for graph-based documents. Based on these terms, Cypher queries are dynamically generated and executed against the Neo4j database to retrieve relevant entities, their relationships, and associated documents. To enhance the quality of the retrieved and constructed Document types, we enriched the relationship content of each Document with the raw content. Additionally, to maintain a practical and acceptable augmented prompt within the input token and context window limits, we used a reranker with a default of five documents (model in use: \(\text{intfloat/simlm-msmarco-reranker}\)[38]) component, with no predefined thresholds, which is a cross-encoder model that takes a query and a passage together as input and predicts how relevant the passage is to the query, making it especially effective for re-ranking search results. It uses advanced training techniques to understand the relationship between queries and passages, resulting in strong performance on ranking [39].