graph TD
subgraph Input[" "]
direction LR
RawDocs[Knowledge]
Query[User Query]
end
subgraph IndexerAgent["Indexer Agent"]
direction TB
FileReader[Content Extractor]
TypeDetector[Content Type Detector]
subgraph PdfToMarkdown[" "]
direction TB
PdfAnalyzer[Pdf Analyzer]
JsonToMarkdown[JSON to Markdown]
end
subgraph Splitters["AST"]
direction LR
TextSplitter[Text Splitter]
MarkdownSplitter[Markdown Splitter]
CodeSplitter[Code Splitter]
CueSplitter[CUE Splitter]
end
ChunkGenerator[Chunk Generator]
end
subgraph EmbeddingService["Embedding Service"]
EmbeddingModel[Embedding Model]
end
subgraph Storage["_"]
SurrealDB[(SurrealDB)]
end
subgraph RetrieverAgent["Retriever Agent"]
SemanticSearch[Semantic Search]
InitialRetrieval[Initial Retrieval]
end
subgraph RerankService["Rerank Service"]
RerankModel[Rerank Model]
end
subgraph ChatAgent["Chat Agent"]
ContextFormatter[Context Formatter]
ResponseGenerator[Response Generator]
end
subgraph LLMService["LLM Service"]
OllamaChat[Ollama Chat]
end
RawDocs --> FileReader
FileReader --> TypeDetector
TypeDetector -->|PDF| PdfAnalyzer
PdfAnalyzer -->|JSON| JsonToMarkdown
TypeDetector -->|Text| TextSplitter
TypeDetector -->|Markdown| MarkdownSplitter
JsonToMarkdown -->|Markdown| MarkdownSplitter
TypeDetector -->|Code| CodeSplitter
TypeDetector -->|CUE| CueSplitter
TextSplitter --> ChunkGenerator
MarkdownSplitter --> ChunkGenerator
CodeSplitter --> ChunkGenerator
CueSplitter --> ChunkGenerator
ChunkGenerator --> EmbeddingModel
EmbeddingModel --> SurrealDB
Query --> EmbeddingModel
Query --> SemanticSearch
EmbeddingModel -->|Query Embedding| SemanticSearch
SurrealDB -->|Stored Embeddings| SemanticSearch
SemanticSearch --> InitialRetrieval
InitialRetrieval --> RerankModel
RerankModel --> ContextFormatter
ContextFormatter --> ResponseGenerator
ResponseGenerator --> OllamaChat
OllamaChat -->|Final Response| Output
classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px,color:#000;
classDef agent fill:#cce6ff,stroke:#333,stroke-width:2px,color:#000;
classDef service fill:#ccffdd,stroke:#333,stroke-width:2px,color:#000;
classDef storage fill:#f2ccff,stroke:#333,stroke-width:2px,color:#000;
classDef model fill:#ffffcc,stroke:#333,stroke-width:2px,color:#000;
classDef compose fill:#ffffff,stroke:#333,stroke-width:4px,color:#000;
class IndexerAgent,RetrieverAgent,ChatAgent agent;
class EmbeddingService,RerankService,LLMService service;
class SurrealDB storage;
class EmbeddingModel,RerankModel,OllamaChat,TreeSitterRust,TreeSitterPython,TreeSitterCue,TreeSitterCpp model;
class Input,Storage compose;