Skip to main content

brainwires_rag/rag/types/
statistics.rs

1use serde::{Deserialize, Serialize};
2
3/// Request to get statistics about the index
4#[derive(Debug, Clone, Serialize, Deserialize, schemars::JsonSchema)]
5pub struct StatisticsRequest {}
6
7/// Statistics about the indexed codebase
8#[derive(Debug, Clone, Serialize, Deserialize, schemars::JsonSchema)]
9pub struct StatisticsResponse {
10    /// Total number of indexed files
11    pub total_files: usize,
12    /// Total number of code chunks
13    pub total_chunks: usize,
14    /// Total number of embeddings
15    pub total_embeddings: usize,
16    /// Size of the vector database in bytes
17    pub database_size_bytes: u64,
18    /// Breakdown by programming language
19    pub language_breakdown: Vec<LanguageStats>,
20}
21
22#[derive(Debug, Clone, Serialize, Deserialize, schemars::JsonSchema)]
23/// Statistics for a single programming language in the index.
24pub struct LanguageStats {
25    /// Language name.
26    pub language: String,
27    /// Number of indexed files for this language.
28    pub file_count: usize,
29    /// Number of code chunks for this language.
30    pub chunk_count: usize,
31}
32
33/// Request to clear the index
34#[derive(Debug, Clone, Serialize, Deserialize, schemars::JsonSchema)]
35pub struct ClearRequest {}
36
37/// Response from clear operation
38#[derive(Debug, Clone, Serialize, Deserialize, schemars::JsonSchema)]
39pub struct ClearResponse {
40    /// Whether the operation was successful
41    pub success: bool,
42    /// Optional message
43    pub message: String,
44}