Commit graph

8 commits

Author SHA1 Message Date
michael
7d0d72b974 Add documentation for post-deploy background init fixes
Documents the two bugs found after initial deploy (double startup hook
execution and blocking event loop) with root cause analysis and fixes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 17:52:18 -06:00
michael
4ee2075eab Run GraphRAG background init in a thread instead of asyncio task
Neo4j operations (connect, get_triplets, upsert_nodes,
build_communities) are synchronous blocking calls. When run as an
asyncio.ensure_future() task, they block the event loop and prevent
Hypercorn from binding to the port or accepting connections.

Fix: launch GraphRAG init in a daemon thread with its own event loop
so the main event loop stays free to serve HTTP requests immediately
after Phase 1 completes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 17:45:52 -06:00
michael
7cd8f26c37 Fix double startup: remove startup_event from Hypercorn hooks
startup_event was registered as a Hypercorn startup hook AND called
manually in run_server_with_startup(), causing it to execute twice.
The second execution blocked the server from accepting connections
until vector init completed again.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 17:38:01 -06:00
michael
fe0d881341 Speed up GraphRAG startup with triple caching and background init
Server now starts serving vector-only queries in ~1-2 minutes instead of
30-60 minutes. GraphRAG initializes in a background task and its tool is
dynamically added to the agent when ready.

- Cache extracted triples to disk (neo4j_triples.pickle) so Neo4j can be
  repopulated without expensive LLM re-extraction
- Split initialize_global_index() into initialize_vector_index() (fast) and
  initialize_graphrag_components() (background)
- Add graphrag_ready/graphrag_initializing status flags to shared_state
- Launch GraphRAG init as asyncio background task in main.py
- Report GraphRAG status in /status endpoint for frontend awareness
- Add comprehensive migration guide for applying to other projects

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 17:33:19 -06:00
michael
fc22a9712c Fix ToolOutput calls for newer llama_index compatibility
The metadata parameter was removed from ToolOutput in recent
llama_index versions. Moved metadata fields into raw_input and
use is_error flag for error cases.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 16:23:37 -06:00
michael
29134011be Add docker-compose for Neo4j with APOC plugin
Pinned to neo4j:5 to match the Python driver. Uses named volumes
and restart policy for production use.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 16:22:13 -06:00
michael
49b0ba9c74 Update OpenAI models to gpt-4.1 and gpt-4.1-mini
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 15:13:41 -06:00
michael
236d1ddbd8 Initial commit: Netflix GraphRAG marketing chatbot
Full-stack application combining LlamaIndex vector search with Neo4j
knowledge graph (GraphRAG) for answering queries about Netflix marketing
materials. Flask/Hypercorn backend with custom ReAct agent, React frontend.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 10:28:33 -06:00