mbudisic commited on
Commit
9cf293e
Β·
1 Parent(s): 6c6c541

doc: reorganize and update DEVELOPER.md for codebase accuracy, module coverage, and theming details

Browse files
Files changed (1) hide show
  1. docs/DEVELOPER.md +39 -29
docs/DEVELOPER.md CHANGED
@@ -1,5 +1,7 @@
1
  # πŸ› οΈ Developer Documentation
2
 
 
 
3
  ## πŸ“¦ Project Structure
4
 
5
  ```
@@ -13,10 +15,11 @@
13
  β”œβ”€β”€ pstuts_rag/ # Package directory
14
  β”‚ β”œβ”€β”€ pstuts_rag/ # Source code
15
  β”‚ β”‚ β”œβ”€β”€ __init__.py # Package initialization
16
- β”‚ β”‚ β”œβ”€β”€ configuration.py # Application configuration settings
17
  β”‚ β”‚ β”œβ”€β”€ datastore.py # Vector database and document management
18
  β”‚ β”‚ β”œβ”€β”€ rag.py # RAG chain implementation and factories
19
- β”‚ β”‚ β”œβ”€β”€ graph.py # LangGraph multi-agent implementation
 
20
  β”‚ β”‚ β”œβ”€β”€ state.py # Team state management for agents
21
  β”‚ β”‚ β”œβ”€β”€ prompts.py # System prompts for different agents
22
  β”‚ β”‚ β”œβ”€β”€ evaluator_utils.py # RAG evaluation utilities
@@ -44,6 +47,7 @@
44
  β”‚ β”œβ”€β”€ TODO.md # Development TODO list
45
  β”‚ └── chainlit.md # Chainlit welcome message
46
  β”œβ”€β”€ scripts/ # Utility scripts (currently empty)
 
47
  └── README.md # User-facing documentation
48
  ```
49
 
@@ -82,6 +86,8 @@ pip install -e ".[dev,web]" # Core + dev + web server
82
  - **`DatastoreManager`** (`datastore.py`): Manages Qdrant vector store, document loading, and semantic chunking
83
  - **`RAGChainFactory`** (`rag.py`): Creates retrieval-augmented generation chains with reference compilation
84
  - **`RAGChainInstance`** (`rag.py`): Encapsulates complete RAG instances with embeddings and vector stores
 
 
85
 
86
  #### πŸ•ΈοΈ Multi-Agent System
87
  - **`PsTutsTeamState`** (`state.py`): TypedDict managing multi-agent conversation state
@@ -138,49 +144,28 @@ This feature enables controlled access to external resources while maintaining a
138
 
139
  ### Sepia Theme Implementation πŸ–ΌοΈ
140
 
141
- The application features a custom **sepia-toned color scheme** implemented through CSS variables and theme switching:
142
 
143
  #### πŸ“ Theme Files
144
- - **`public/sepia-theme.css`**: Custom CSS file with sepia color schemes
145
- - **`.chainlit/config.toml`**: Configuration enabling custom CSS and default theme
146
 
147
  #### 🎨 Color Palette Design
148
- ```css
149
- /* Light Sepia Colors */
150
- --sepia-lightest: #faf6f0 /* Warm cream background */
151
- --sepia-lighter: #f4ede1 /* Secondary background */
152
- --sepia-light: #e8d5b7 /* Tertiary background */
153
- --sepia-medium: #d4b896 /* Border and accent */
154
- --sepia-dark: #c19a6b /* Darker accents */
155
- --sepia-darker: #a67c52 /* Strong borders */
156
- --sepia-darkest: #8b5a3c /* Deep contrast */
157
-
158
- /* Dark Sepia Colors */
159
- --sepia-dark-bg: #2c1810 /* Rich coffee background */
160
- --sepia-dark-bg-secondary: #3a2318 /* Warmer secondary */
161
- --sepia-dark-bg-tertiary: #4a2d20 /* Amber tertiary */
162
- ```
163
-
164
- #### πŸ”§ Technical Implementation
165
- - **CSS Variables**: Dynamic theming with `--custom-property` pattern
166
- - **Theme Detection**: `[data-theme="light"]` and `[data-theme="dark"]` selectors
167
- - **Smooth Transitions**: `transition` properties for seamless theme switching
168
- - **Component Styling**: Custom styling for chat messages, buttons, inputs, sidebar
169
- - **Image Treatment**: Subtle `filter: sepia(20%)` on images for visual consistency
170
 
171
  #### βš™οΈ Configuration Setup
172
  ```toml
173
  # .chainlit/config.toml
174
  [UI]
175
  default_theme = "light" # Set light theme as default
176
- custom_css = "/public/sepia-theme.css" # Enable custom styling
177
  ```
178
 
179
  #### 🎯 Features
180
  - **Responsive Design**: Adapts to both light and dark preferences
181
  - **Accessibility**: Maintains sufficient contrast ratios in both themes
182
  - **Visual Cohesion**: Unified sepia treatment across all UI elements
183
- - **Performance**: CSS-only implementation with minimal runtime overhead
184
  - **User Control**: Native Chainlit theme switcher toggles between variants
185
 
186
  The sepia theme creates a warm, nostalgic atmosphere perfect for Adobe Photoshop tutorials, giving the application a distinctive visual identity that stands out from standard blue/gray interfaces. πŸ“Έβœ¨
@@ -297,6 +282,31 @@ When LangGraph Studio accesses the `graph` function, it automatically triggers l
297
  - **State management**: LangGraph for multi-agent coordination
298
  - **Evaluation**: RAGAS framework for retrieval and generation metrics
299
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
300
  ## πŸ“š Resources
301
 
302
  - [Chainlit Documentation](https://docs.chainlit.io) πŸ“–
 
1
  # πŸ› οΈ Developer Documentation
2
 
3
+ > **Note:** The root-level `DEVELOPER.md` is deprecated. This is the canonical developer documentation. 🚦
4
+
5
  ## πŸ“¦ Project Structure
6
 
7
  ```
 
15
  β”œβ”€β”€ pstuts_rag/ # Package directory
16
  β”‚ β”œβ”€β”€ pstuts_rag/ # Source code
17
  β”‚ β”‚ β”œβ”€β”€ __init__.py # Package initialization
18
+ β”‚ β”‚ β”œβ”€β”€ configuration.py # Application configuration settings
19
  β”‚ β”‚ β”œβ”€β”€ datastore.py # Vector database and document management
20
  β”‚ β”‚ β”œβ”€β”€ rag.py # RAG chain implementation and factories
21
+ β”‚ β”‚ β”œβ”€β”€ rag_for_transcripts.py# RAG chain for video transcripts (reference packing)
22
+ β”‚ β”‚ β”œβ”€β”€ graph.py # Agent node creation and LangGraph assembly
23
  β”‚ β”‚ β”œβ”€β”€ state.py # Team state management for agents
24
  β”‚ β”‚ β”œβ”€β”€ prompts.py # System prompts for different agents
25
  β”‚ β”‚ β”œβ”€β”€ evaluator_utils.py # RAG evaluation utilities
 
47
  β”‚ β”œβ”€β”€ TODO.md # Development TODO list
48
  β”‚ └── chainlit.md # Chainlit welcome message
49
  β”œβ”€β”€ scripts/ # Utility scripts (currently empty)
50
+ β”œβ”€β”€ public/ # Theme and static files (see theming section)
51
  └── README.md # User-facing documentation
52
  ```
53
 
 
86
  - **`DatastoreManager`** (`datastore.py`): Manages Qdrant vector store, document loading, and semantic chunking
87
  - **`RAGChainFactory`** (`rag.py`): Creates retrieval-augmented generation chains with reference compilation
88
  - **`RAGChainInstance`** (`rag.py`): Encapsulates complete RAG instances with embeddings and vector stores
89
+ - **`RAG for Transcripts`** (`rag_for_transcripts.py`): Implements the RAG chain for searching video transcripts, including reference packing and post-processing for AIMessage responses. Used for context-rich, reference-annotated answers from video data. 🎬
90
+ - **`Graph Assembly`** (`graph.py`): Handles agent node creation, LangGraph assembly, and integration of multi-agent workflows. Provides utilities for building, initializing, and running the agentic graph. πŸ•ΈοΈ
91
 
92
  #### πŸ•ΈοΈ Multi-Agent System
93
  - **`PsTutsTeamState`** (`state.py`): TypedDict managing multi-agent conversation state
 
144
 
145
  ### Sepia Theme Implementation πŸ–ΌοΈ
146
 
147
+ The application features a custom **sepia-toned color scheme** implemented via `public/theme.json` and Chainlit's theme configuration:
148
 
149
  #### πŸ“ Theme Files
150
+ - **`public/theme.json`**: Defines the sepia color palette and theme variables
151
+ - **`.chainlit/config.toml`**: Configuration enabling the sepia theme as default
152
 
153
  #### 🎨 Color Palette Design
154
+ Theme colors are defined in `theme.json` and applied through Chainlit's theming system. There is no custom CSS file; all theming is handled via JSON and Chainlit configuration.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155
 
156
  #### βš™οΈ Configuration Setup
157
  ```toml
158
  # .chainlit/config.toml
159
  [UI]
160
  default_theme = "light" # Set light theme as default
161
+ custom_theme = "/public/theme.json" # Enable custom sepia theme
162
  ```
163
 
164
  #### 🎯 Features
165
  - **Responsive Design**: Adapts to both light and dark preferences
166
  - **Accessibility**: Maintains sufficient contrast ratios in both themes
167
  - **Visual Cohesion**: Unified sepia treatment across all UI elements
168
+ - **Performance**: JSON-based theme for minimal runtime overhead
169
  - **User Control**: Native Chainlit theme switcher toggles between variants
170
 
171
  The sepia theme creates a warm, nostalgic atmosphere perfect for Adobe Photoshop tutorials, giving the application a distinctive visual identity that stands out from standard blue/gray interfaces. πŸ“Έβœ¨
 
282
  - **State management**: LangGraph for multi-agent coordination
283
  - **Evaluation**: RAGAS framework for retrieval and generation metrics
284
 
285
+ ## πŸ†• Recent Refactors & Enhancements (Spring 2024)
286
+
287
+ ### πŸ—οΈ Modular App Structure & Async Initialization
288
+ - The main application (`app.py`) is now more modular and async-friendly! Initialization of the datastore, agent graph, and session state is handled with care for concurrency and user experience.
289
+ - The agent graph is now referenced as `ai_graph` (formerly `compiled_graph`) for clarity and onboarding ease.
290
+ - Chainlit session and callback management is improved, making it easier to hook into events and extend the app. 🚦
291
+
292
+ ### πŸ€– Robust API/Model Selection Logic
293
+ - All API/model selection (for LLMs and embeddings) is now centralized in `utils.py` via `get_chat_api` and `get_embeddings_api`.
294
+ - These functions robustly parse string input to the `ModelAPI` enum, so you can use any case or format (e.g., "openai", "OPENAI", "Ollama") and it will Just Workβ„’.
295
+ - This eliminates a whole class of bugs from mismatched config strings! πŸŽ‰
296
+
297
+ ### πŸ” Smarter Search Phrase Generation
298
+ - The search phrase generation logic (in `prompts.py` and node code) now uses previous queries and conversation history to generate unique, context-aware search phrases.
299
+ - This means less repetition, more relevance, and a more natural research workflow for the agents. 🧠✨
300
+
301
+ ### βš™οΈ Enhanced LLM API & Configuration
302
+ - The `Configuration` class (`configuration.py`) now supports robust environment variable overrides and easy conversion to/from `RunnableConfig`.
303
+ - All config parameters are logged and managed with dataclass fields, making debugging and onboarding a breeze.
304
+
305
+ ### 🎨 Sepia Theme Update
306
+ - The UI now features a beautiful sepia color palette for a warm, inviting look (see above for details!).
307
+ - Theme files and configuration have been updated for seamless switching between light and dark sepia modes.
308
+ - Perfect for those late-night Photoshop tutorial sessions! β˜•πŸ–ΌοΈ
309
+
310
  ## πŸ“š Resources
311
 
312
  - [Chainlit Documentation](https://docs.chainlit.io) πŸ“–