Spaces:
Sleeping
Sleeping
Commit History
-
feat(rag): switch to rich context judge with reasoning (D3 strategy)
Replace score gap + boolean judge with Gemini Flash rich context judge that returns story names + reasoning. Benchmarked as best strategy: 58% exact match, 90% within ±1 vs ground truth, ~2s latency. Score floor (-9.0) still handles off-topic queries instantly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>96d78cc -
tune(rag): calibrate relevance filter for raw logit scores
- GAP_THRESHOLD: 0.3 → 5.0 (raw cross-encoder logits, not normalized) - SCORE_FLOOR: add -9.0 threshold for off-topic detection - Improved LLM judge prompt with archive scope context - Benchmark comparison mode in benchmark_filter.py - Results: recall 0.95, latency P50 777ms (vs ~10s before) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>0110ecb -
feat(api): replace Gemini generation filter with score gap + LLM fallback
Swaps the slow Gemini text generation (~8s) for the adaptive relevance filter using reranker score gaps (~0ms) with LLM-as-judge fallback (~1-2s). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>2025e44 -
feat(rag): add adaptive relevance filter (score gap + LLM fallback)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>10d159f -
fix(rag): only rerank semantic queries, skip filter intents
Reranker (ms-marco cross-encoder) improves semantic recall but hurts filter queries (temporal, genre, awards) that rely on metadata matching. Now only applied to semantic intents (general, person, country, recommendation). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1df539f -
feat: add LRU-cached embed_query to avoid re-embedding repeated searches
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>2bf4d05 -
feat(rag): integrate cross-encoder reranker into hybrid retrieval pipeline
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>2e5ec7a -
chore: add missing __init__.py to all packages
Add empty __init__.py files to src/mediastorm and all subpackages (ingest, enrich, vectorize, rag) for explicit Python package declaration. Ensures proper module discovery and import paths. Test results: 190 passed, 10 failed (pre-existing failures unrelated to imports). All test collection errors resolved. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>485de3e -
chore: remove unused _drop_distant method from retriever
89a77dc
-
feat(eval): include expected IDs and missed UIDs in eval results
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>51fa501 -
feat(eval): add display module for console formatting and diffs
f318b64 -
feat(eval): add runner module for eval orchestration and JSON storage
8647392 -
feat: search catalogue UI, data cleanup, router decade detection
- Replace Results.svelte with inline cards below landing search bar - Add gradient overlay, tooltip fix, card placeholder, clear button - Remove 34 non-story items from ChromaDB/BM25 (stubs, forms, meta pages) - Add _EXCLUDED_SLUGS to fetcher.py to prevent re-ingestion - Add decade detection to router (e.g. "2010s" → year range filter) - top_k_final 8 → 6 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>0c9dd38 -
refactor: remove streaming generator and rewriter
4e4db5e -
feat(api): replace SSE chat with sync POST /api/search
4bb26eb -
feat(ui): view transitions, story grid 2x2, logo links, scroll UX
- Replace fade transition with View Transitions API for smooth search bar morph from landing center to chat bottom - Reduce retriever top_k_final from 5 to 4 for clean 2x2 card grid - Auto-scroll stops at first card instead of bottom of chat - Logo links to mediastorm.com in both landing and chat views - Make full StoryCard clickable, wrap loading/text in bubbles Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>16a41fb -
feat(mosaic): horizontal scrolling rows, random order, click-through links
- Rewrite mosaic as 3 horizontal rows with alternating scroll directions - Each row scrolls at different speeds for organic feel - Images preserve aspect ratio, fade in on load, hidden on error - Click opens story on mediastorm.com (link from nav_config API) - Hover pauses row, shows tooltip with formatted metadata - Randomized query suggestions on landing page - Autofocus on search input - Stats: "100+ Awards" instead of "4 Emmy Awards" Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>e383749
-
fix: pass token_type_ids to ONNX model when expected
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>fe1a174 -
feat: correct story links, loading UX, slug-based card filtering
- Build link lookup from mediastorm.com nav_config at startup (uid → full path) - Cards only display for stories actually cited by Gemini - Loading dots animation during streaming, cards-or-text display - Updated system prompt: use exact URLs from context, conversational no-match - Added done flag to messages for proper streaming/done state handling - Markdown rendering with marked library Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>c2b75fa -
feat: conditional query rewriting for conversational follow-ups
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>4323ffa -
feat: metadata routing for structural queries (most awarded, newest, oldest)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>d22b592 -
feat: integrate cross-encoder reranker into hybrid retriever
Adds optional Reranker to HybridRetriever (applied after soft boost, before top-k slice). Updates api.py lifespan and benchmark fixture to pass a Reranker instance. Adds false-positive test for 'jazz' query. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>f2386a1 -
feat: cross-encoder reranker with ONNX inference
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>f3bd99e -
feat: suggest related topics when no stories match
Remove duplicate 'no matching stories' message. Instead, the system prompt now instructs Gemini to suggest related topics the user can explore when no relevant stories are found. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>069bd29 -
feat: show cards only for stories Gemini actually cites
Instead of displaying all retrieved cards or using a separate Flash judge, we now stream the text response first, then only send cards for stories whose slug appears in the generated text. This aligns cards with the text response perfectly: - Edge cases (pasta, Taylor Swift): 0 cards - Single-result queries (Salgado): 1 card - Multi-result queries (Congo): 3-5 cards Removes the unreliable Flash relevance filter (relevance.py). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1f9c756 -
feat: LLM-as-judge relevance filter for story cards
Gemini Flash scores retrieved stories against the query and filters out irrelevant results before displaying cards. Handles multi-facet queries like "Photo essays about Africa" (5 cards → 1 relevant card). 24/26 eval queries unchanged, 2 minor recall drops (acceptable precision/recall trade-off for card display quality). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>c4679a5 -
fix: reduce media_type soft boost to prevent multi-facet query issues
media_type boost reduced from +3 to +1 (tiebreaker only). For queries like "Photo essays about Africa", the old +3 boost caused non-African photo essays to dominate over African non-photo-essay results. Also stores RRF scores on docs for potential future use. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>94e1702 -
fix: remove media_type from hard filter intents
media_type as a hard ChromaDB WHERE clause was too restrictive — multi-facet queries like "Photo essays about Africa" got filtered down before semantic search could find relevant results. Keep media_type as soft boost only. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>022756e -
feat: /api/chat SSE endpoint with hybrid RAG
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>ea63c1f -
feat: /api/stories endpoint for landing mosaic
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>de2956c -
feat: FastAPI skeleton with health endpoint
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>61a9b93 -
feat: hard filters for structured intents (awards, dates, media_type)
Router-detected scalar filters (awards_count_min, published_year range, media_type) now applied as ChromaDB WHERE clauses instead of soft boosts. Non-scalar filters (award_names) stay as soft boosts for ranking. Benchmark: Filter R@5 0.255 → 0.390, Awards R@5 0.25 → 0.56. Zero regression on semantic queries (P@1=0.929, R@5=0.738). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>3688dca -
refactor: remove cross-encoder reranker, RRF handles ranking alone
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>195890d -
feat: replace sentence-transformers with ONNX Runtime embedder (bge-small 384d)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>0de90e8
-
feat: streaming responses with Flash, remove story cards
- Switch generation from Gemini Pro to Flash (2s vs 16s first chunk) - Stream responses progressively via generate_response_stream - Remove story card images from chat responses (links in text suffice) - Strengthen citation prompt for Flash compliance - Handle None responses from Gemini with fallback message - Increase max_output_tokens to 4096 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>6845476 -
feat: retrieval evaluation script with router improvements
- Add eval_retrieval.py with 30 ground truth queries across 7 categories (geographic, thematic, temporal, people, genre, awards, edge cases) - Metrics: Precision@1, Recall@5, MRR, NDCG@5 with separate reporting for core semantic vs filter queries - Router: detect specific award names (Emmy, Webby, World Press Photo) and media types (photo essay, video documentary, interactive) - Retriever: soft boost for award_names and media_type from router - Results: semantic P@1=0.93, MRR=0.96, R@5=0.75 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>9d271a0 -
fix: add dotenv loading, enrichment retry logic, and graceful error handling
- Load .env automatically via python-dotenv in config.py - Retry Gemini calls up to 3 times with exponential backoff on empty responses - Skip failed enrichments in CLI instead of crashing the full pipeline Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>bb84ada -
fix: pipeline cleanup + retrieval improvements
- Remove Vimeo dependency (vimeo.py, config, tests) - Simplify merger to wrap_speaker_turns (no timestamps) - Update Gemini models to 2.5-flash/pro - Fix KeyQuote schema to coerce null → empty string - Fix audit.py: use HybridRetriever, remove segments_count - Soft filters: router-inferred filters boost instead of exclude - Cross-filter countries/regions in post-filter - Date range ±3 years for approximate queries - Expose rerank_score, filter low-relevance cards in UI - Fix Gradio chat history format for multi-turn - Stricter RAG prompt (no tangential connections) - Increase transcript window 3K→15K chars for enrichment - Add key_quotes to embedded text for better retrieval - RRF k=60 (was k=20) per best practices Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>b03128f
-
fix: address code review issues (theme/css, reranker condense, cli serve)
- Fix Reranker._condense to use doc["text"][:300] instead of nonexistent metadata["summary"] and metadata["short_description"] - Fix cli.py serve to pass theme and CSS to demo.launch() - Keep theme/css in launch() only (Gradio 6.x deprecation) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>3d083e1 -
feat: Gradio UI with hybrid retriever, filter accordion, updated examples
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>97c181e -
feat: update prompts for stories-only context with enriched metadata
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>47d1484 -
feat: rewrite retriever as HybridRetriever with dense+BM25+RRF+reranking
Replaces the old two-phase Retriever with HybridRetriever: dense (ChromaDB) + sparse (BM25) retrieval fused via RRF, cross-encoder reranking, and scalar/ list metadata filtering. Filter invariant enforced in _attach_metadata so BM25 results outside the ChromaDB scalar filter cannot surface. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>fed3af1 -
feat: add QueryRouter with regex-first intent classification
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>b37b4cb -
feat: add Reranker with cross-encoder ms-marco-MiniLM-L-12-v2
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>ceb9c4e -
feat: expand chunk_story metadata (20+ fields), remove chunk_segments
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>69f0e6b -
feat: add BM25Store with tokenization, stemming, save/load
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>6dd9291 -
refactor: remove segments collection from VectorStore, add get_all_metadata
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>594e33c -
feat: expand enrichment prompt with themes, countries, event_period, media_type, is_subject + cache invalidation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>ec53434 -
feat: expand StoryEnrichment with themes, countries, regions, event_period, media_type, is_subject
New hybrid RAG fields in StoryEnrichment: - themes: list of thematic tags - countries: geographic coverage list - regions: regional specification list - event_period: temporal scope (e.g., "1994") - media_type: content classification (e.g., "video documentary") PersonMention enriched with is_subject boolean flag. All new fields default to empty collections/strings for backward compatibility. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>f6eba8b -
feat: enrich pipeline story dict with awards, director, content_type, year/decade
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>728b736