Skip to content

Commit e393250

Browse files
committed
Merge branch 'dev' into audio_upload_extend
2 parents 2e4473d + 267e3bc commit e393250

File tree

19 files changed

+1813
-1680
lines changed

19 files changed

+1813
-1680
lines changed

.github/workflows/advanced-docker-compose-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ jobs:
199199
cd ../../extras/asr-services
200200
for cuda_variant in cu121 cu126 cu128; do
201201
echo "Building parakeet-asr-${cuda_variant}"
202-
export CUDA_VERSION="${cuda_variant}"
202+
export PYTORCH_CUDA_VERSION="${cuda_variant}"
203203
docker compose build parakeet-asr
204204
205205
img_id=$(docker compose images -q parakeet-asr | head -n1)

.github/workflows/robot-tests.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,14 @@ jobs:
6363
python-version: "3.12"
6464
cache: 'pip'
6565

66+
- name: Install uv
67+
uses: astral-sh/setup-uv@v4
68+
with:
69+
version: "latest"
70+
6671
- name: Install Robot Framework and dependencies
6772
run: |
68-
pip install --upgrade pip
69-
pip install robotframework robotframework-requests python-dotenv websockets
73+
uv pip install --system robotframework robotframework-requests python-dotenv websockets
7074
7175
- name: Create test environment file
7276
working-directory: tests/setup

Docs/init-system.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,33 @@ uv run --with-requirements setup-requirements.txt python services.py start backe
148148
# Check service status
149149
uv run --with-requirements setup-requirements.txt python services.py status
150150

151+
# Restart all services
152+
uv run --with-requirements setup-requirements.txt python services.py restart --all
153+
154+
# Restart specific services
155+
uv run --with-requirements setup-requirements.txt python services.py restart backend
156+
151157
# Stop all services
152158
uv run --with-requirements setup-requirements.txt python services.py stop --all
153159

154-
# Stop specific services
160+
# Stop specific services
155161
uv run --with-requirements setup-requirements.txt python services.py stop asr-services openmemory-mcp
156162
```
157163

164+
**Convenience Scripts:**
165+
```bash
166+
# Quick start (from project root)
167+
./start.sh
168+
169+
# Quick restart (from project root)
170+
./restart.sh
171+
```
172+
173+
**Important Notes:**
174+
- **Restart** restarts containers without rebuilding - use for configuration changes (.env updates)
175+
- **For code changes**, use `stop` + `start --build` to rebuild images
176+
- Example: `uv run --with-requirements setup-requirements.txt python services.py stop --all && uv run --with-requirements setup-requirements.txt python services.py start --all --build`
177+
158178
### Manual Service Management
159179
You can also manage services individually:
160180

Docs/ports-and-access.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,24 @@ uv run --with-requirements setup-requirements.txt python services.py start --all
101101
# Start only specific services
102102
uv run --with-requirements setup-requirements.txt python services.py start backend speaker-recognition
103103

104+
# Restart all services
105+
uv run --with-requirements setup-requirements.txt python services.py restart --all
106+
107+
# Restart specific services
108+
uv run --with-requirements setup-requirements.txt python services.py restart backend
109+
104110
# Stop all services
105111
uv run --with-requirements setup-requirements.txt python services.py stop --all
106112
```
107113

114+
**Convenience Scripts:**
115+
```bash
116+
./start.sh # Quick start all configured services
117+
./restart.sh # Quick restart all configured services
118+
```
119+
120+
**Important:** Use `restart` for configuration changes (.env updates). For code changes, use `stop` + `start --build` to rebuild images.
121+
108122
---
109123

110124
## Microphone Access Requirements
@@ -128,7 +142,7 @@ If you encounter port conflicts:
128142
1. **Check running services**: `uv run --with-requirements setup-requirements.txt python services.py status`
129143
2. **Stop conflicting services**: `uv run --with-requirements setup-requirements.txt python services.py stop --all`
130144
3. **Change ports in .env files** if needed
131-
4. **Restart services**: `uv run --with-requirements setup-requirements.txt python services.py start --all`
145+
4. **Restart services**: `uv run --with-requirements setup-requirements.txt python services.py restart --all` or `./restart.sh`
132146

133147
---
134148

backends/advanced/docker-compose.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ services:
1818
- MISTRAL_MODEL=${MISTRAL_MODEL}
1919
- TRANSCRIPTION_PROVIDER=${TRANSCRIPTION_PROVIDER}
2020
- PARAKEET_ASR_URL=${PARAKEET_ASR_URL}
21-
- OFFLINE_ASR_TCP_URI=${OFFLINE_ASR_TCP_URI}
2221
- OLLAMA_BASE_URL=${OLLAMA_BASE_URL}
2322
- HF_TOKEN=${HF_TOKEN}
2423
- SPEAKER_SERVICE_URL=${SPEAKER_SERVICE_URL}

backends/advanced/init.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def setup_transcription(self):
191191
self.console.print("[yellow][WARNING][/yellow] No API key provided - transcription will not work")
192192

193193
elif choice == "3":
194-
self.config["TRANSCRIPTION_PROVIDER"] = "offline"
194+
self.config["TRANSCRIPTION_PROVIDER"] = "parakeet"
195195
self.console.print("[blue][INFO][/blue] Offline Parakeet ASR selected")
196196
parakeet_url = self.prompt_value("Parakeet ASR URL", "http://host.docker.internal:8767")
197197
self.config["PARAKEET_ASR_URL"] = parakeet_url

backends/advanced/run-test.sh

Lines changed: 72 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -39,33 +39,74 @@ print_info "Advanced Backend Integration Test Runner"
3939
print_info "========================================"
4040

4141
# Load environment variables (CI or local)
42-
if [ -f ".env" ] && [ -z "$DEEPGRAM_API_KEY" ]; then
42+
# Priority: CI environment > .env.test > .env
43+
if [ -n "$DEEPGRAM_API_KEY" ]; then
44+
print_info "Using environment variables from CI/environment..."
45+
elif [ -f ".env.test" ]; then
46+
print_info "Loading environment variables from .env.test..."
47+
set -a
48+
source .env.test
49+
set +a
50+
elif [ -f ".env" ]; then
4351
print_info "Loading environment variables from .env..."
4452
set -a
4553
source .env
4654
set +a
47-
elif [ -n "$DEEPGRAM_API_KEY" ]; then
48-
print_info "Using environment variables from CI..."
4955
else
50-
print_error "Neither .env file nor CI environment variables found!"
51-
print_info "For local development: cp .env.template .env and configure API keys"
52-
print_info "For CI: ensure DEEPGRAM_API_KEY and OPENAI_API_KEY secrets are set"
56+
print_error "Neither .env.test nor .env file found, and no environment variables set!"
57+
print_info "For local development: cp .env.template .env and configure required API keys"
58+
print_info "For CI: ensure required API keys are set based on configured providers"
5359
exit 1
5460
fi
5561

56-
# Verify required environment variables
57-
if [ -z "$DEEPGRAM_API_KEY" ]; then
58-
print_error "DEEPGRAM_API_KEY not set"
59-
exit 1
60-
fi
61-
62-
if [ -z "$OPENAI_API_KEY" ]; then
63-
print_error "OPENAI_API_KEY not set"
64-
exit 1
65-
fi
66-
67-
print_info "DEEPGRAM_API_KEY length: ${#DEEPGRAM_API_KEY}"
68-
print_info "OPENAI_API_KEY length: ${#OPENAI_API_KEY}"
62+
# Verify required environment variables based on configured providers
63+
TRANSCRIPTION_PROVIDER=${TRANSCRIPTION_PROVIDER:-deepgram}
64+
LLM_PROVIDER=${LLM_PROVIDER:-openai}
65+
66+
print_info "Configured providers:"
67+
print_info " TRANSCRIPTION_PROVIDER: $TRANSCRIPTION_PROVIDER"
68+
print_info " LLM_PROVIDER: $LLM_PROVIDER"
69+
70+
# Check transcription provider API key
71+
case "$TRANSCRIPTION_PROVIDER" in
72+
deepgram)
73+
if [ -z "$DEEPGRAM_API_KEY" ]; then
74+
print_error "DEEPGRAM_API_KEY not set (required for TRANSCRIPTION_PROVIDER=deepgram)"
75+
exit 1
76+
fi
77+
print_info "DEEPGRAM_API_KEY length: ${#DEEPGRAM_API_KEY}"
78+
;;
79+
mistral)
80+
if [ -z "$MISTRAL_API_KEY" ]; then
81+
print_error "MISTRAL_API_KEY not set (required for TRANSCRIPTION_PROVIDER=mistral)"
82+
exit 1
83+
fi
84+
print_info "MISTRAL_API_KEY length: ${#MISTRAL_API_KEY}"
85+
;;
86+
offline|parakeet)
87+
print_info "Using offline/local transcription - no API key required"
88+
;;
89+
*)
90+
print_warning "Unknown TRANSCRIPTION_PROVIDER: $TRANSCRIPTION_PROVIDER"
91+
;;
92+
esac
93+
94+
# Check LLM provider API key (for memory extraction)
95+
case "$LLM_PROVIDER" in
96+
openai)
97+
if [ -z "$OPENAI_API_KEY" ]; then
98+
print_error "OPENAI_API_KEY not set (required for LLM_PROVIDER=openai)"
99+
exit 1
100+
fi
101+
print_info "OPENAI_API_KEY length: ${#OPENAI_API_KEY}"
102+
;;
103+
ollama)
104+
print_info "Using Ollama for LLM - no API key required"
105+
;;
106+
*)
107+
print_warning "Unknown LLM_PROVIDER: $LLM_PROVIDER"
108+
;;
109+
esac
69110

70111
# Ensure memory_config.yaml exists
71112
if [ ! -f "memory_config.yaml" ] && [ -f "memory_config.yaml.template" ]; then
@@ -119,9 +160,19 @@ export DOCKER_BUILDKIT=0
119160

120161
# Run the integration test with extended timeout (mem0 needs time for comprehensive extraction)
121162
print_info "Starting integration test (timeout: 15 minutes)..."
122-
timeout 900 uv run pytest tests/test_integration.py::test_full_pipeline_integration -v -s --tb=short --log-cli-level=INFO
163+
if timeout 900 uv run pytest tests/test_integration.py::test_full_pipeline_integration -v -s --tb=short --log-cli-level=INFO; then
164+
print_success "Integration tests completed successfully!"
165+
else
166+
TEST_EXIT_CODE=$?
167+
print_error "Integration tests FAILED with exit code: $TEST_EXIT_CODE"
123168

124-
print_success "Integration tests completed successfully!"
169+
# Clean up test containers before exiting
170+
print_info "Cleaning up test containers after failure..."
171+
docker compose -f docker-compose-test.yml down -v || true
172+
docker system prune -f || true
173+
174+
exit $TEST_EXIT_CODE
175+
fi
125176

126177
# Clean up test containers
127178
print_info "Cleaning up test containers..."

backends/advanced/src/advanced_omi_backend/controllers/websocket_controller.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,13 +304,13 @@ async def _initialize_streaming_session(
304304

305305
# Determine transcription provider from environment
306306
transcription_provider = os.getenv("TRANSCRIPTION_PROVIDER", "").lower()
307-
if transcription_provider in ["offline", "parakeet"]:
307+
if transcription_provider == "parakeet":
308308
provider = "parakeet"
309309
elif transcription_provider == "deepgram":
310310
provider = "deepgram"
311311
else:
312312
# Auto-detect: prefer Parakeet if URL is set, otherwise Deepgram
313-
parakeet_url = os.getenv("PARAKEET_ASR_URL") or os.getenv("OFFLINE_ASR_TCP_URI")
313+
parakeet_url = os.getenv("PARAKEET_ASR_URL")
314314
deepgram_key = os.getenv("DEEPGRAM_API_KEY")
315315
if parakeet_url:
316316
provider = "parakeet"

backends/advanced/src/advanced_omi_backend/services/transcription/__init__.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,6 @@ def get_transcription_provider(
7575
else:
7676
return ParakeetProvider(parakeet_url)
7777

78-
elif provider_name == "offline":
79-
# "offline" is an alias for Parakeet ASR
80-
if not parakeet_url:
81-
raise RuntimeError(
82-
"Offline transcription provider requested but PARAKEET_ASR_URL not configured"
83-
)
84-
logger.info(f"Using offline Parakeet transcription provider in {mode} mode")
85-
if mode == "streaming":
86-
return ParakeetStreamingProvider(parakeet_url)
87-
else:
88-
return ParakeetProvider(parakeet_url)
89-
9078
# Auto-select provider based on available configuration (when provider_name is None)
9179
if provider_name is None:
9280
# Check TRANSCRIPTION_PROVIDER environment variable first

backends/advanced/src/advanced_omi_backend/services/transcription/parakeet_stream_consumer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ def __init__(self, redis_client, service_url: str = None, buffer_chunks: int = 3
3535
service_url: Parakeet service URL (defaults to PARAKEET_ASR_URL env var)
3636
buffer_chunks: Number of chunks to buffer before transcribing (default: 30 = ~7.5s)
3737
"""
38-
self.service_url = service_url or os.getenv("PARAKEET_ASR_URL") or os.getenv("OFFLINE_ASR_TCP_URI")
38+
self.service_url = service_url or os.getenv("PARAKEET_ASR_URL")
3939
if not self.service_url:
40-
raise ValueError("PARAKEET_ASR_URL or OFFLINE_ASR_TCP_URI is required")
40+
raise ValueError("PARAKEET_ASR_URL is required")
4141

4242
# Initialize Parakeet provider
4343
self.provider = ParakeetProvider(service_url=self.service_url)

0 commit comments

Comments
 (0)