Spaces:
Runtime error
Runtime error
Commit History
-
fix(agent): rank gaps by score, fuzzy topic filter, stream in web API
sourabh guptaThree issues surfaced from query logs against live data: 1. gap_analysis returned 0 rows. top_gaps gated on quadrant='priority_gap', but no topic qualifies (all 316 are 'watch', 3 'well_covered' — none reach the demand>=0.5 threshold for a priority label). Dropped the quadrant gate: now MATCH all topics with a gap_score, ORDER BY gap_score DESC. The score already encodes demand×(1−coverage); label is descriptive, not a filter. Fixes both gap_analysis and the /api/gaps endpoint. 2. trending_topics(filter='AI healthcare') returned 'drainage', 'mountains', 'airports' — because 'ai' substring-matched them. Replaced CONTAINS-word filtering with a Neo4j full-text index + fuzzy Lucene query (tokenised, so 'ai' no longer matches 'drainage'; fuzzy ~ tolerates typos: 'imigration' → immigration). New _fulltext_query() + ensure_fulltext_index() (asserted on every build()). Note: the vocabulary has no AI/healthcare/tariff topics, so those filters correctly return …bb5095f -
feat(observability): INFO-level logging across all agent components
sourabh guptaEvery layer now logs by default (LOG_LEVEL=INFO): - agent_cli: invoke→stream with per-step [TOOL CALL]/[THINK]/[TOOL RESULT] logs — the ReAct chain is now fully visible per turn with elapsed time - tools: all five tools log their return value (row count, top result, answer_chars) in addition to entry args - llm_openai: logs sys_chars/user_chars, token usage (prompt+completion+total), and answer preview (150 chars) - rag: logs source titles, context_chars before LLM call, raw vs stripped char counts and answer preview - retrieval: logs qdrant_hits + top-3 scores/titles after search; reranked count + top/bottom scores after cross-encoder - gap: logs per-topic demand/coverage/gap/label inline; logs top-1 result after sort - signals_pytrends: replaces all print() with log; INFO per batch (anchor_mean, keywords), INFO per keyword (volume, velocity), WARNING on 429b8196ed
-
feat(agent): implement production-ready LangGraph ReAct agent
sourabh gupta- docs/adr/0001-agent-architecture.md: Add ADR detailing prebuilt agent trade-offs - packages/vantage_core/adapters/graph_neo4j.py: Add case-insensitive entities_for_topic search - packages/vantage_core/agent/tools.py: Implement tools (RAG, signals, gaps, graph lookup) and gap_log logging - packages/vantage_core/agent/graph.py: Build ChatOpenAI + tools compiled LangGraph agent with MemorySaver - scripts/agent_cli.py: Add interactive REPL and Mermaid chart exporter39afcd3