Auto-mode commit 7aa33cd accidentally deleted 78 files (14,814 lines) during M005
execution. Subsequent commits rebuilt some frontend files but backend/, alembic/,
tests/, whisper/, docker configs, and prompts were never restored in this repo.
This commit restores the full project tree by syncing from ub01's working directory,
which has all M001-M007 features running in production containers.
Restored: backend/ (config, models, routers, database, redis, search_service, worker),
alembic/ (6 migrations), docker/ (Dockerfiles, nginx, compose), prompts/ (4 stages),
tests/, whisper/, README.md, .env.example, chrysopedia-spec.md
111 lines
4.4 KiB
Python
111 lines
4.4 KiB
Python
"""Mock LLM and embedding responses for pipeline integration tests.
|
|
|
|
Each response is a JSON string matching the Pydantic schema for that stage.
|
|
The sample transcript has 5 segments about gain staging, so mock responses
|
|
reflect that content.
|
|
"""
|
|
|
|
import json
|
|
import random
|
|
|
|
# ── Stage 2: Segmentation ───────────────────────────────────────────────────
|
|
|
|
STAGE2_SEGMENTATION_RESPONSE = json.dumps({
|
|
"segments": [
|
|
{
|
|
"start_index": 0,
|
|
"end_index": 1,
|
|
"topic_label": "Introduction",
|
|
"summary": "Introduces the episode about mixing basics and gain staging.",
|
|
},
|
|
{
|
|
"start_index": 2,
|
|
"end_index": 4,
|
|
"topic_label": "Gain Staging Technique",
|
|
"summary": "Covers practical steps for gain staging including setting levels and avoiding clipping.",
|
|
},
|
|
]
|
|
})
|
|
|
|
# ── Stage 3: Extraction ─────────────────────────────────────────────────────
|
|
|
|
STAGE3_EXTRACTION_RESPONSE = json.dumps({
|
|
"moments": [
|
|
{
|
|
"title": "Setting Levels for Gain Staging",
|
|
"summary": "Demonstrates the process of setting proper gain levels across the signal chain to maintain headroom.",
|
|
"start_time": 12.8,
|
|
"end_time": 28.5,
|
|
"content_type": "technique",
|
|
"plugins": ["Pro-Q 3"],
|
|
"raw_transcript": "First thing you want to do is set your levels. Make sure nothing is clipping on the master bus.",
|
|
},
|
|
{
|
|
"title": "Master Bus Clipping Prevention",
|
|
"summary": "Explains how to monitor and prevent clipping on the master bus during a mix session.",
|
|
"start_time": 20.1,
|
|
"end_time": 35.0,
|
|
"content_type": "settings",
|
|
"plugins": [],
|
|
"raw_transcript": "Make sure nothing is clipping on the master bus. That wraps up this quick overview.",
|
|
},
|
|
]
|
|
})
|
|
|
|
# ── Stage 4: Classification ─────────────────────────────────────────────────
|
|
|
|
STAGE4_CLASSIFICATION_RESPONSE = json.dumps({
|
|
"classifications": [
|
|
{
|
|
"moment_index": 0,
|
|
"topic_category": "Mixing",
|
|
"topic_tags": ["gain staging", "eq"],
|
|
"content_type_override": None,
|
|
},
|
|
{
|
|
"moment_index": 1,
|
|
"topic_category": "Mixing",
|
|
"topic_tags": ["gain staging", "bus processing"],
|
|
"content_type_override": None,
|
|
},
|
|
]
|
|
})
|
|
|
|
# ── Stage 5: Synthesis ───────────────────────────────────────────────────────
|
|
|
|
STAGE5_SYNTHESIS_RESPONSE = json.dumps({
|
|
"pages": [
|
|
{
|
|
"title": "Gain Staging in Mixing",
|
|
"slug": "gain-staging-in-mixing",
|
|
"topic_category": "Mixing",
|
|
"topic_tags": ["gain staging"],
|
|
"summary": "A comprehensive guide to gain staging in a mixing context, covering level setting and master bus management.",
|
|
"body_sections": {
|
|
"Overview": "Gain staging ensures each stage of the signal chain operates at optimal levels.",
|
|
"Steps": "1. Set input levels. 2. Check bus levels. 3. Monitor master output.",
|
|
},
|
|
"signal_chains": [
|
|
{"chain": "Input -> Channel Strip -> Bus -> Master", "notes": "Keep headroom at each stage."}
|
|
],
|
|
"plugins": ["Pro-Q 3"],
|
|
"source_quality": "structured",
|
|
}
|
|
]
|
|
})
|
|
|
|
# ── Embedding response ───────────────────────────────────────────────────────
|
|
|
|
|
|
def make_mock_embedding(dim: int = 768) -> list[float]:
|
|
"""Generate a deterministic-seeded mock embedding vector."""
|
|
rng = random.Random(42)
|
|
return [rng.uniform(-1, 1) for _ in range(dim)]
|
|
|
|
|
|
def make_mock_embeddings(n: int, dim: int = 768) -> list[list[float]]:
|
|
"""Generate n distinct mock embedding vectors."""
|
|
return [
|
|
[random.Random(42 + i).uniform(-1, 1) for _ in range(dim)]
|
|
for i in range(n)
|
|
]
|