# jorge1150/sri_ia_multimodal architecture

> Architecture diagram of the GitHub repository jorge1150/sri_ia_multimodal, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jorge1150/sri_ia_multimodal
- Repository: https://github.com/jorge1150/sri_ia_multimodal

## Overview

SRI IA Multimodal is a tax-regulation assistant whose main workflow accepts text, voice, images, or video; coordinates optional query refinement and validation; retrieves normative passages and optionally tax-knowledge graph context; generates cited answers; and can synthesize speech. The graph preserves ingestion, GraphRAG, memory/guardrail, and evaluation capabilities documented in the README. Evidence is limited to the supplied excerpts, SOURCE INDEX references, and README; unshown wiring is omitted or marked unverified.

Main entry points: [`agents/coordinator.py`](https://github.com/jorge1150/sri_ia_multimodal/blob/main/agents/coordinator.py) (Query coordinator), [`graph/graph_builder.py`](https://github.com/jorge1150/sri_ia_multimodal/blob/main/graph/graph_builder.py) (Graph builder), [`ui/interface.py`](https://github.com/jorge1150/sri_ia_multimodal/blob/main/ui/interface.py) (Gradio interface), [`app.py`](https://github.com/jorge1150/sri_ia_multimodal/blob/main/app.py) (Application entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_ui["Gradio interface<br/>[interface.py]"]
  node_app["Application entry<br/>[app.py]"]
end

subgraph group_orchestration["Agent orchestration"]
  node_coordinator["Query coordinator<br/>[coordinator.py]"]
  node_planner["Graph planner<br/>[planner_agent.py]"]
  node_refiner["Query refiner"]
  node_validator["Query validator"]
  node_memory[("Query memories")]
  node_logger["Stage logging<br/>[log_agent.py]"]
  node_response["Cited response generation<br/>[response_agent.py]"]
end

subgraph group_knowledge["Knowledge retrieval"]
  node_rag["Vector retrieval<br/>[rag_agent.py]"]
  node_hybrid["Hybrid retriever"]
  node_vectorstore[("Chroma vector store<br/>[config.py]")]
  node_chunker["Document chunking<br/>[chunker.py]"]
  node_ingesta["Vector ingestion<br/>[ingesta.py]"]
  node_graphbuilder["Graph builder<br/>[graph_builder.py]"]
  node_entities["Entity extraction"]
  node_relations["Relation extraction"]
  node_graphstore[("Tax knowledge graph<br/>[graph_store.py]")]
  node_graphretriever["Graph retrieval<br/>[graph_retriever.py]"]
end

subgraph group_media["Multimodal I/O"]
  node_voice["Speech recognition<br/>[voice_agent.py]"]
  node_vision["Image understanding<br/>[vision_agent.py]"]
  node_video["Video processing<br/>[video_agent.py]"]
  node_tts["Speech synthesis<br/>[tts_agent.py]"]
end

subgraph group_evaluation["Evaluation"]
  node_benchmark["Benchmark formatting"]
  node_ragas["RAGAS evaluation<br/>[ragas_local.py]"]
end

node_user(("User"))

node_user -->|"submits query"| node_ui
node_ui -.->|"uses interface"| node_app
node_app -->|"initializes"| node_coordinator
node_app -.->|"launches"| node_ui
node_coordinator -->|"transcribes"| node_voice
node_coordinator -->|"analyzes images"| node_vision
node_coordinator -->|"processes video"| node_video
node_video -->|"uses"| node_vision
node_coordinator -->|"refines query"| node_refiner
node_coordinator -->|"validates query"| node_validator
node_validator -->|"tests retrieval"| node_rag
node_refiner -->|"uses examples"| node_memory
node_coordinator -->|"plans retrieval"| node_planner
node_coordinator -->|"retrieves context"| node_hybrid
node_hybrid -->|"retrieves passages"| node_rag
node_hybrid -->|"retrieves graph"| node_graphretriever
node_rag -.->|"queries"| node_vectorstore
node_coordinator -.->|"generates answer"| node_response
node_coordinator -->|"synthesizes answer"| node_tts
node_ingesta -->|"chunks documents"| node_chunker
node_ingesta -->|"writes embeddings"| node_vectorstore
node_graphbuilder -->|"reads chunks"| node_chunker
node_graphbuilder -->|"extracts entities"| node_entities
node_graphbuilder -->|"extracts relations"| node_relations
node_graphbuilder -->|"stores graph"| node_graphstore
node_graphretriever -->|"detects query entities"| node_entities
node_graphretriever -->|"queries graph"| node_graphstore
node_graphstore -->|"uses relation types"| node_relations
node_coordinator -->|"records stages"| node_logger
node_ui -->|"shows metrics"| node_benchmark
node_benchmark -.->|"formats evaluation"| node_ragas

click node_ui "https://github.com/jorge1150/sri_ia_multimodal/blob/main/ui/interface.py"
click node_app "https://github.com/jorge1150/sri_ia_multimodal/blob/main/app.py"
click node_coordinator "https://github.com/jorge1150/sri_ia_multimodal/blob/main/agents/coordinator.py"
click node_planner "https://github.com/jorge1150/sri_ia_multimodal/blob/main/agents/planner_agent.py"
click node_refiner "https://github.com/jorge1150/sri_ia_multimodal/blob/main/agents/query_refiner_agent.py"
click node_validator "https://github.com/jorge1150/sri_ia_multimodal/blob/main/agents/query_validator_agent.py"
click node_memory "https://github.com/jorge1150/sri_ia_multimodal/blob/main/agents/similarity_memory.py"
click node_logger "https://github.com/jorge1150/sri_ia_multimodal/blob/main/agents/log_agent.py"
click node_rag "https://github.com/jorge1150/sri_ia_multimodal/blob/main/agents/rag_agent.py"
click node_hybrid "https://github.com/jorge1150/sri_ia_multimodal/blob/main/services/hybrid_retriever.py"
click node_vectorstore "https://github.com/jorge1150/sri_ia_multimodal/blob/main/config.py"
click node_chunker "https://github.com/jorge1150/sri_ia_multimodal/blob/main/rag/chunker.py"
click node_ingesta "https://github.com/jorge1150/sri_ia_multimodal/blob/main/rag/ingesta.py"
click node_graphbuilder "https://github.com/jorge1150/sri_ia_multimodal/blob/main/graph/graph_builder.py"
click node_entities "https://github.com/jorge1150/sri_ia_multimodal/blob/main/graph/entity_extractor.py"
click node_relations "https://github.com/jorge1150/sri_ia_multimodal/blob/main/graph/relation_extractor.py"
click node_graphstore "https://github.com/jorge1150/sri_ia_multimodal/blob/main/graph/graph_store.py"
click node_graphretriever "https://github.com/jorge1150/sri_ia_multimodal/blob/main/graph/graph_retriever.py"
click node_response "https://github.com/jorge1150/sri_ia_multimodal/blob/main/agents/response_agent.py"
click node_voice "https://github.com/jorge1150/sri_ia_multimodal/blob/main/agents/voice_agent.py"
click node_vision "https://github.com/jorge1150/sri_ia_multimodal/blob/main/agents/vision_agent.py"
click node_video "https://github.com/jorge1150/sri_ia_multimodal/blob/main/agents/video_agent.py"
click node_tts "https://github.com/jorge1150/sri_ia_multimodal/blob/main/agents/tts_agent.py"
click node_benchmark "https://github.com/jorge1150/sri_ia_multimodal/blob/main/services/benchmark_format.py"
click node_ragas "https://github.com/jorge1150/sri_ia_multimodal/blob/main/scripts/ragas_local.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_ui,node_app,node_user toneBlue
class node_coordinator,node_planner,node_refiner,node_validator,node_memory,node_logger,node_response toneAmber
class node_rag,node_hybrid,node_vectorstore,node_chunker,node_ingesta,node_graphbuilder,node_entities,node_relations,node_graphstore,node_graphretriever toneMint
class node_voice,node_vision,node_video,node_tts toneRose
class node_benchmark,node_ragas toneIndigo
```

## Components

### User experience

- [Gradio interface](https://github.com/jorge1150/sri_ia_multimodal/blob/main/ui/interface.py): `ui/interface.py`
- [Application entry](https://github.com/jorge1150/sri_ia_multimodal/blob/main/app.py): `app.py`

### Agent orchestration

- [Query coordinator](https://github.com/jorge1150/sri_ia_multimodal/blob/main/agents/coordinator.py): `agents/coordinator.py`
- [Graph planner](https://github.com/jorge1150/sri_ia_multimodal/blob/main/agents/planner_agent.py): `agents/planner_agent.py`
- [Query refiner](https://github.com/jorge1150/sri_ia_multimodal/blob/main/agents/query_refiner_agent.py): `agents/query_refiner_agent.py`
- [Query validator](https://github.com/jorge1150/sri_ia_multimodal/blob/main/agents/query_validator_agent.py): `agents/query_validator_agent.py`
- [Query memories](https://github.com/jorge1150/sri_ia_multimodal/blob/main/agents/similarity_memory.py): `agents/similarity_memory.py`
- [Stage logging](https://github.com/jorge1150/sri_ia_multimodal/blob/main/agents/log_agent.py): `agents/log_agent.py`
- [Cited response generation](https://github.com/jorge1150/sri_ia_multimodal/blob/main/agents/response_agent.py): `agents/response_agent.py`

### Knowledge retrieval

- [Vector retrieval](https://github.com/jorge1150/sri_ia_multimodal/blob/main/agents/rag_agent.py): `agents/rag_agent.py`
- [Hybrid retriever](https://github.com/jorge1150/sri_ia_multimodal/blob/main/services/hybrid_retriever.py): `services/hybrid_retriever.py`
- [Chroma vector store](https://github.com/jorge1150/sri_ia_multimodal/blob/main/config.py): `config.py`
- [Document chunking](https://github.com/jorge1150/sri_ia_multimodal/blob/main/rag/chunker.py): `rag/chunker.py`
- [Vector ingestion](https://github.com/jorge1150/sri_ia_multimodal/blob/main/rag/ingesta.py): `rag/ingesta.py`
- [Graph builder](https://github.com/jorge1150/sri_ia_multimodal/blob/main/graph/graph_builder.py): `graph/graph_builder.py`
- [Entity extraction](https://github.com/jorge1150/sri_ia_multimodal/blob/main/graph/entity_extractor.py): `graph/entity_extractor.py`
- [Relation extraction](https://github.com/jorge1150/sri_ia_multimodal/blob/main/graph/relation_extractor.py): `graph/relation_extractor.py`
- [Tax knowledge graph](https://github.com/jorge1150/sri_ia_multimodal/blob/main/graph/graph_store.py): `graph/graph_store.py`
- [Graph retrieval](https://github.com/jorge1150/sri_ia_multimodal/blob/main/graph/graph_retriever.py): `graph/graph_retriever.py`

### Multimodal I/O

- [Speech recognition](https://github.com/jorge1150/sri_ia_multimodal/blob/main/agents/voice_agent.py): `agents/voice_agent.py`
- [Image understanding](https://github.com/jorge1150/sri_ia_multimodal/blob/main/agents/vision_agent.py): `agents/vision_agent.py`
- [Video processing](https://github.com/jorge1150/sri_ia_multimodal/blob/main/agents/video_agent.py): `agents/video_agent.py`
- [Speech synthesis](https://github.com/jorge1150/sri_ia_multimodal/blob/main/agents/tts_agent.py): `agents/tts_agent.py`

### Evaluation

- [Benchmark formatting](https://github.com/jorge1150/sri_ia_multimodal/blob/main/services/benchmark_format.py): `services/benchmark_format.py`
- [RAGAS evaluation](https://github.com/jorge1150/sri_ia_multimodal/blob/main/scripts/ragas_local.py): `scripts/ragas_local.py`

### Other components

- **User**

## Connections

- User → Gradio interface: submits query
- Gradio interface → Application entry: uses interface (evidence: `app.py`)
- Application entry → Query coordinator: initializes (evidence: `app.py`)
- Application entry → Gradio interface: launches (evidence: `app.py`)
- Query coordinator → Speech recognition: transcribes (evidence: `agents/coordinator.py`)
- Query coordinator → Image understanding: analyzes images (evidence: `agents/coordinator.py`)
- Query coordinator → Video processing: processes video (evidence: `agents/coordinator.py`)
- Video processing → Image understanding: uses (evidence: `agents/video_agent.py`)
- Query coordinator → Query refiner: refines query (evidence: `agents/coordinator.py`)
- Query coordinator → Query validator: validates query (evidence: `agents/coordinator.py`)
- Query validator → Vector retrieval: tests retrieval (evidence: `agents/query_validator_agent.py`)
- Query refiner → Query memories: uses examples (evidence: `agents/query_refiner_agent.py`)
- Query coordinator → Graph planner: plans retrieval (evidence: `agents/coordinator.py`)
- Query coordinator → Hybrid retriever: retrieves context (evidence: `agents/coordinator.py`)
- Hybrid retriever → Vector retrieval: retrieves passages (evidence: `services/hybrid_retriever.py`)
- Hybrid retriever → Graph retrieval: retrieves graph (evidence: `services/hybrid_retriever.py`)
- Vector retrieval → Chroma vector store: queries (evidence: `agents/rag_agent.py`)
- Query coordinator → Cited response generation: generates answer (evidence: `agents/coordinator.py`)
- Query coordinator → Speech synthesis: synthesizes answer (evidence: `agents/coordinator.py`)
- Vector ingestion → Document chunking: chunks documents (evidence: `rag/ingesta.py`)
- Vector ingestion → Chroma vector store: writes embeddings (evidence: `rag/ingesta.py`)
- Graph builder → Document chunking: reads chunks (evidence: `graph/graph_builder.py`)
- Graph builder → Entity extraction: extracts entities (evidence: `graph/graph_builder.py`)
- Graph builder → Relation extraction: extracts relations (evidence: `graph/graph_builder.py`)
- Graph builder → Tax knowledge graph: stores graph (evidence: `graph/graph_builder.py`)
- Graph retrieval → Entity extraction: detects query entities (evidence: `graph/graph_retriever.py`)
- Graph retrieval → Tax knowledge graph: queries graph (evidence: `graph/graph_retriever.py`)
- Tax knowledge graph → Relation extraction: uses relation types (evidence: `graph/graph_store.py`)
- Query coordinator → Stage logging: records stages (evidence: `agents/coordinator.py`)
- Gradio interface → Benchmark formatting: shows metrics (evidence: `ui/interface.py`)
- Benchmark formatting → RAGAS evaluation: formats evaluation
