Tests cover:
- GET /health - health check
- GET /companies - list companies
- GET /companies/{id}/stats - company statistics
- POST /reports/generate - report generation
- Helper functions: get_kg_client, get_llm_provider
21 tests total, all passing.
https://claude.ai/code/session_01PQ6QMnmh1DbR6PH9DaiPpS
add key debates generation to gradio kg based tab; fix failing unit tests
Implements knowledge graph-based report generation that allows generating
reports directly from documents stored in Supabase, without requiring file uploads.
Key changes:
- Reorganize KG services into services/kg/ module (client.py, retrieval.py)
- Add KGRetrievalService with 3 retrieval modes:
* chunks: Vector search for relevant chunks
* full_documents: Use complete parsed_text from documents
* hybrid: Find top docs via chunks, then use full text (default)
- Add api/kg_routes.py with run_kg_generation() and helper functions
- Add "KG Reports" tab to Gradio UI (app.py) with:
* Company dropdown selector
* Data availability stats display
* Retrieval mode selector
* Section generation buttons (TAM, Product, Signals, Team)
- Add get_all_companies() method to KGClient
- Support embedding queries and vector search via OpenAIEmbedding
- Integrate with existing LLM pipeline and tracing infrastructure
The new flow allows users to select a company from the knowledge graph,
choos…