Skip to content

Commit eb7ca43

Browse files
Update configuration management and enhance file structure, add test-matrix (#237)
* Update configuration management and enhance file structure - Refactored configuration file paths to use a dedicated `config/` directory, including updates to `config.yml` and its template. - Modified service scripts to load the new configuration path for `config.yml`. - Enhanced `.gitignore` to include the new configuration files and templates. - Updated documentation to reflect changes in configuration file locations and usage. - Improved setup scripts to ensure proper creation and management of configuration files. - Added new test configurations for various provider combinations to streamline testing processes. * Add test requirements and clean up imports in wizard.py - Introduced a new `test-requirements.txt` file to manage testing dependencies. - Removed redundant import of `shutil` in `wizard.py` to improve code clarity. * Add ConfigManager for unified configuration management - Introduced a new `config_manager.py` module to handle reading and writing configurations from `config.yml` and `.env` files, ensuring backward compatibility. - Refactored `ChronicleSetup` in `backends/advanced/init.py` to utilize `ConfigManager` for loading and updating configurations, simplifying the setup process. - Removed redundant methods for loading and saving `config.yml` directly in `ChronicleSetup`, as these are now managed by `ConfigManager`. - Enhanced user feedback during configuration updates, including success messages for changes made to configuration files. * Refactor transcription provider configuration and enhance setup process - Updated `.env.template` to clarify speech-to-text configuration and removed deprecated options for Mistral. - Modified `docker-compose.yml` to streamline environment variable management by removing unused Mistral keys. - Enhanced `ChronicleSetup` in `init.py` to provide clearer user feedback and updated the transcription provider selection process to rely on `config.yml`. - Improved error handling in the websocket controller to determine the transcription provider from the model registry instead of environment variables. - Updated health check routes to reflect the new method of retrieving the transcription provider from `config.yml`. - Adjusted `config.yml.template` to include comments on transcription provider options for better user guidance. * Enhance ConfigManager with deep merge functionality - Updated the `update_memory_config` method to perform a deep merge of updates into the memory configuration, ensuring nested dictionaries are merged correctly. - Added a new `_deep_merge` method to handle recursive merging of dictionaries, improving configuration management capabilities. * Refactor run-test.sh and enhance memory extraction tests - Removed deprecated environment variable handling for TRANSCRIPTION_PROVIDER in `run-test.sh`, streamlining the configuration process. - Introduced a new `run-custom.sh` script for executing Robot tests with custom configurations, improving test flexibility. - Enhanced memory extraction tests in `audio_keywords.robot` and `memory_keywords.robot` to include detailed assertions and result handling. - Updated `queue_keywords.robot` to fail fast if a job is in a 'failed' state when expecting 'completed', improving error handling. - Refactored `test_env.py` to load environment variables with correct precedence, ensuring better configuration management. * unify tests to robot test, add some more clean up * Update health check configuration in docker-compose-test.yml (#241) - Increased the number of retries from 5 to 10 for improved resilience during service readiness checks. - Extended the start period from 30s to 60s to allow more time for services to initialize before health checks commence. * Add step to create test configuration file in robot-tests.yml - Introduced a new step in the GitHub Actions workflow to copy the test configuration file from tests/configs/deepgram-openai.yml to a new config/config.yml. - Added logging to confirm the creation of the test config file, improving visibility during the test setup process. * remove cache step since not required * coderabbit comments * Refactor ConfigManager error handling for configuration file loading - Updated the ConfigManager to raise RuntimeError exceptions when the configuration file is not found or is invalid, improving error visibility and user guidance. - Removed fallback behavior that previously returned the current directory, ensuring users are explicitly informed about missing or invalid configuration files. * Refactor _find_repo_root method in ConfigManager - Updated the _find_repo_root method to locate the repository root using the __file__ location instead of searching for config/config.yml, simplifying the logic and improving reliability. - Removed the previous error handling that raised a RuntimeError if the configuration file was not found, as the new approach assumes config_manager.py is always at the repo root.
1 parent d849ebe commit eb7ca43

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1440
-1841
lines changed

.github/workflows/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,6 @@ uv sync --dev
8686
cp .env.template .env.test
8787
# Add your API keys to .env.test
8888

89-
# Run test (modify CACHED_MODE in test_integration.py if needed)
90-
uv run pytest test_integration.py::test_full_pipeline_integration -v -s
89+
# Run Robot Framework integration tests
90+
uv run robot --outputdir test-results --loglevel INFO tests/integration/integration_test.robot
9191
```

.github/workflows/robot-tests.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ jobs:
6161
uses: actions/setup-python@v5
6262
with:
6363
python-version: "3.12"
64-
cache: 'pip'
6564

6665
- name: Install uv
6766
uses: astral-sh/setup-uv@v4
@@ -94,6 +93,14 @@ jobs:
9493
TEST_DEVICE_NAME=robot-test
9594
EOF
9695
96+
- name: Create test config.yml
97+
run: |
98+
echo "Copying test configuration file..."
99+
mkdir -p config
100+
cp tests/configs/deepgram-openai.yml config/config.yml
101+
echo "✓ Test config.yml created from tests/configs/deepgram-openai.yml"
102+
ls -lh config/config.yml
103+
97104
- name: Start test environment
98105
working-directory: backends/advanced
99106
env:

.gitignore

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,16 @@
44
!**/.env.template
55
**/memory_config.yaml
66
!**/memory_config.yaml.template
7-
config.yml
8-
!config.yml.template
7+
tests/setup/.env.test
8+
9+
# Main config (user-specific)
10+
config/config.yml
11+
!config/config.yml.template
12+
13+
# Config backups
14+
config/*.backup.*
15+
config/*.backup*
16+
917
example/*
1018
**/node_modules/*
1119
**/ollama-data/*

CLAUDE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,11 @@ cp .env.template .env # Configure API keys
116116

117117
# Manual test execution (for debugging)
118118
source .env && export DEEPGRAM_API_KEY && export OPENAI_API_KEY
119-
uv run pytest tests/test_integration.py::test_full_pipeline_integration -v -s
119+
uv run robot --outputdir test-results --loglevel INFO ../../tests/integration/integration_test.robot
120120

121121
# Leave test containers running for debugging (don't auto-cleanup)
122122
CLEANUP_CONTAINERS=false source .env && export DEEPGRAM_API_KEY && export OPENAI_API_KEY
123-
uv run pytest tests/test_integration.py::test_full_pipeline_integration -v -s
123+
uv run robot --outputdir test-results --loglevel INFO ../../tests/integration/integration_test.robot
124124

125125
# Manual cleanup when needed
126126
docker compose -f docker-compose-test.yml down -v
@@ -390,7 +390,7 @@ docker compose up --build -d
390390

391391
### Testing Strategy
392392
- **Local Test Scripts**: Simplified scripts (`./run-test.sh`) mirror CI workflows for local development
393-
- **End-to-End Integration**: `test_integration.py` validates complete audio processing pipeline
393+
- **End-to-End Integration**: Robot Framework tests (`tests/integration/integration_test.robot`) validate complete audio processing pipeline
394394
- **Speaker Recognition Tests**: `test_speaker_service_integration.py` validates speaker identification
395395
- **Environment Flexibility**: Tests work with both local .env files and CI environment variables
396396
- **Automated Cleanup**: Test containers are automatically removed after execution

Docs/getting-started.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,9 @@ After configuration, verify everything works with the integration test suite:
179179

180180
# Alternative: Manual test with detailed logging
181181
source .env && export DEEPGRAM_API_KEY OPENAI_API_KEY && \
182-
uv run pytest tests/test_integration.py -vv -s --log-cli-level=INFO
182+
uv run robot --outputdir ../../test-results --loglevel INFO ../../tests/integration/integration_test.robot
183183
```
184-
This end-to-end test validates the complete audio processing pipeline.
184+
This end-to-end test validates the complete audio processing pipeline using Robot Framework.
185185

186186
## Using the System
187187

@@ -342,7 +342,7 @@ curl -X POST "http://localhost:8000/api/process-audio-files" \
342342

343343
**Implementation**:
344344
- **Memory System**: `src/advanced_omi_backend/memory/memory_service.py` + `src/advanced_omi_backend/controllers/memory_controller.py`
345-
- **Configuration**: memory settings in `config.yml` (memory section)
345+
- **Configuration**: memory settings in `config/config.yml` (memory section)
346346

347347
### Authentication & Security
348348
- **Email Authentication**: Login with email and password
@@ -541,10 +541,10 @@ OPENMEMORY_MCP_URL=http://host.docker.internal:8765
541541

542542
> 🎯 **New to memory configuration?** Read our [Memory Configuration Guide](./memory-configuration-guide.md) for a step-by-step setup guide with examples.
543543
544-
The system uses **centralized configuration** via `config.yml` for all models (LLM, embeddings, vector store) and memory extraction settings.
544+
The system uses **centralized configuration** via `config/config.yml` for all models (LLM, embeddings, vector store) and memory extraction settings.
545545

546546
### Configuration File Location
547-
- **Path**: repository `config.yml` (override with `CONFIG_FILE` env var)
547+
- **Path**: repository `config/config.yml` (override with `CONFIG_FILE` env var)
548548
- **Hot-reload**: Changes are applied on next processing cycle (no restart required)
549549
- **Fallback**: If file is missing, system uses safe defaults with environment variables
550550

@@ -613,7 +613,7 @@ If you experience JSON parsing errors in fact extraction:
613613

614614
2. **Enable fact extraction** with reliable JSON output:
615615
```yaml
616-
# In config.yml (memory section)
616+
# In config/config.yml (memory section)
617617
fact_extraction:
618618
enabled: true # Safe to enable with GPT-4o
619619
```
@@ -727,5 +727,5 @@ curl -H "Authorization: Bearer $ADMIN_TOKEN" \
727727
- **Connect audio clients** using the WebSocket API
728728
- **Explore the dashboard** to manage conversations and users
729729
- **Review the user data architecture** for understanding data organization
730-
- **Customize memory extraction** by editing the `memory` section in `config.yml`
730+
- **Customize memory extraction** by editing the `memory` section in `config/config.yml`
731731
- **Monitor processing performance** using debug API endpoints

backends/advanced/.env.template

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,14 @@ OPENAI_MODEL=gpt-4o-mini
4545
# CHAT_TEMPERATURE=0.7
4646

4747
# ========================================
48-
# SPEECH-TO-TEXT CONFIGURATION (Choose one)
48+
# SPEECH-TO-TEXT CONFIGURATION (API Keys Only)
4949
# ========================================
50+
# Provider selection is in config.yml (defaults.stt)
5051

51-
# Option 1: Deepgram (recommended for best transcription quality)
52+
# Deepgram (cloud-based, recommended)
5253
DEEPGRAM_API_KEY=
5354

54-
# Option 2: Parakeet ASR service from extras/asr-services
55-
# PARAKEET_ASR_URL=http://host.docker.internal:8767
56-
57-
# Optional: Specify which provider to use ('deepgram' or 'parakeet')
58-
# If not set, will auto-select based on available configuration (Deepgram preferred)
59-
# TRANSCRIPTION_PROVIDER=
55+
# Note: Parakeet ASR URL configured in config.yml
6056

6157
# ========================================
6258
# SPEECH DETECTION CONFIGURATION

backends/advanced/Docs/README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Welcome to chronicle! This guide provides the optimal reading sequence to unders
1313
- What the system does (voice → memories)
1414
- Key features and capabilities
1515
- Basic setup and configuration
16-
- **Code References**: `src/advanced_omi_backend/main.py`, `config.yml`, `docker-compose.yml`
16+
- **Code References**: `src/advanced_omi_backend/main.py`, `config/config.yml`, `docker-compose.yml`
1717

1818
### 2. **[System Architecture](./architecture.md)**
1919
**Read second** - Complete technical architecture with diagrams
@@ -70,7 +70,7 @@ Welcome to chronicle! This guide provides the optimal reading sequence to unders
7070

7171
## 🔍 **Configuration & Customization**
7272

73-
### 6. **Configuration File**`../config.yml`
73+
### 6. **Configuration File**`../config/config.yml`
7474
**Central configuration for all extraction**
7575
- Memory extraction settings and prompts
7676
- Quality control and debug settings
@@ -86,11 +86,11 @@ Welcome to chronicle! This guide provides the optimal reading sequence to unders
8686
1. [quickstart.md](./quickstart.md) - System overview
8787
2. [architecture.md](./architecture.md) - Technical architecture
8888
3. `src/advanced_omi_backend/main.py` - Core imports and setup
89-
4. `config.yml` - Configuration overview
89+
4. `config/config.yml` - Configuration overview
9090

9191
### **"I want to work on memory extraction"**
9292
1. [memories.md](./memories.md) - Memory system details
93-
2. `../config.yml` - Models and memory configuration
93+
2. `../config/config.yml` - Models and memory configuration
9494
3. `src/advanced_omi_backend/memory/memory_service.py` - Implementation
9595
4. `src/advanced_omi_backend/controllers/memory_controller.py` - Processing triggers
9696

@@ -130,7 +130,7 @@ backends/advanced-backend/
130130
│ │ └── memory_service.py # Memory system (Mem0)
131131
│ └── model_registry.py # Configuration loading
132132
133-
├── config.yml # 📋 Central configuration
133+
├── config/config.yml # 📋 Central configuration
134134
├── MEMORY_DEBUG_IMPLEMENTATION.md # Debug system details
135135
```
136136

@@ -148,7 +148,7 @@ backends/advanced-backend/
148148

149149
### **Configuration**
150150
- **Loading**: `src/advanced_omi_backend/model_registry.py`
151-
- **File**: `config.yml`
151+
- **File**: `config/config.yml`
152152
- **Usage**: `src/advanced_omi_backend/memory/memory_service.py`
153153

154154
### **Authentication**
@@ -162,7 +162,7 @@ backends/advanced-backend/
162162

163163
1. **Follow the references**: Each doc links to specific code files and line numbers
164164
2. **Use the debug API**: `GET /api/debug/memory/stats` shows live system status
165-
3. **Check configuration first**: Many behaviors are controlled by `config.yml`
165+
3. **Check configuration first**: Many behaviors are controlled by `config/config.yml`
166166
4. **Understand the memory pipeline**: Memories (end-of-conversation)
167167
5. **Test with curl**: All API endpoints have curl examples in the docs
168168

@@ -175,20 +175,20 @@ backends/advanced-backend/
175175
1. **Set up the system**: Follow [quickstart.md](./quickstart.md) to get everything running
176176
2. **Test the API**: Use the curl examples in the documentation to test endpoints
177177
3. **Explore the debug system**: Check `GET /api/debug/memory/stats` to see live data
178-
4. **Modify configuration**: Edit `config.yml` (memory section) to see how it affects extraction
178+
4. **Modify configuration**: Edit `config/config.yml` (memory section) to see how it affects extraction
179179
5. **Read the code**: Start with `src/advanced_omi_backend/main.py` and follow the references in each doc
180180

181181
### **Contributing Guidelines**
182182

183183
- **Add code references**: When updating docs, include file paths and line numbers
184184
- **Test your changes**: Use the debug API to verify your modifications work
185-
- **Update configuration**: Add new settings to `config.yml` when needed
185+
- **Update configuration**: Add new settings to `config/config.yml` when needed
186186
- **Follow the architecture**: Keep memories in their respective services
187187

188188
### **Getting Help**
189189

190190
- **Debug API**: `GET /api/debug/memory/*` endpoints show real-time system status
191-
- **Configuration**: Check `config.yml` for behavior controls
191+
- **Configuration**: Check `config/config.yml` for behavior controls
192192
- **Logs**: Check Docker logs with `docker compose logs chronicle-backend`
193193
- **Documentation**: Each doc file links to relevant code sections
194194

backends/advanced/Docs/contribution.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
1. Docs/quickstart.md (15 min)
22
2. Docs/architecture.md (20 min)
33
3. main.py - just the imports and WebSocket sections (15 min)
4-
4. config.yml (memory section) (10 min)
4+
4. config/config.yml (memory section) (10 min)
55

66
🔧 "I want to work on memory extraction"
77

88
1. Docs/quickstart.md → Docs/memories.md
9-
2. config.yml (memory.extraction section)
9+
2. config/config.yml (memory.extraction section)
1010
3. main.py lines 1047-1065 (trigger)
1111
4. main.py lines 1163-1195 (processing)
1212
5. src/memory/memory_service.py

backends/advanced/Docs/memories.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This document explains how to configure and customize the memory service in the
1010
- **Repository Layer**: `src/advanced_omi_backend/conversation_repository.py` (clean data access)
1111
- **Processing Manager**: `src/advanced_omi_backend/processors.py` (MemoryProcessor class)
1212
- **Conversation Management**: `src/advanced_omi_backend/conversation_manager.py` (lifecycle coordination)
13-
- **Configuration**: `config.yml` (memory section) + `src/model_registry.py`
13+
- **Configuration**: `config/config.yml` (memory section) + `src/model_registry.py`
1414

1515
## Overview
1616

@@ -180,7 +180,7 @@ OPENAI_MODEL=gpt-5-mini # Recommended for reliable JSON output
180180
# OPENAI_MODEL=gpt-3.5-turbo # Budget option
181181
```
182182

183-
Or configure via `config.yml` (memory block):
183+
Or configure via `config/config.yml` (memory block):
184184

185185
```yaml
186186
memory_extraction:

backends/advanced/Docs/memory-configuration-guide.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ This guide helps you set up and configure the memory system for the Friend Advan
66

77
1. **Copy the template configuration**:
88
```bash
9-
Edit the `memory` section of `config.yml`.
9+
Edit the `memory` section of `config/config.yml`.
1010
```
1111

12-
2. **Edit `config.yml`** with your preferred settings in the `memory` section:
12+
2. **Edit `config/config.yml`** with your preferred settings in the `memory` section:
1313
```yaml
1414
memory:
1515
provider: "mem0" # or "basic" for simpler setup
@@ -127,6 +127,6 @@ memory:
127127

128128
## Next Steps
129129

130-
- Configure action items detection in `config.yml` (memory.extraction)
130+
- Configure action items detection in `config/config.yml` (memory.extraction)
131131
- Set up custom prompt templates for your use case
132132
- Monitor memory processing in the debug dashboard

0 commit comments

Comments
 (0)