LightRAG is a simple and fast retrieval-augmented generation (RAG) framework that supports graph-based knowledge retrieval. The current stable version is 1.4.15, with a release candidate 1.5.0rc1 introducing breaking changes. Releases are frequent (weekly/monthly).
pip install lightrag-hkuVerified import paths — ran on the pinned version, not inferred.
Initialize LightRAG with OpenAI LLM and embedding, insert a document, and query.
Set ENTITY_TYPE_PROMPT_FILE instead of ENTITY_TYPES in your environment or .env file.
Provide separate LLM configurations for each role (e.g., EXTRACT_LLM_MODEL, QUERY_LLM_MODEL) or use the new role-specific settings.
Use async methods (ainsert, aquery, etc.) with asyncio.run() or run the sync methods inside a running event loop.
Ensure the working directory exists and is writable, or use an absolute path that the application has permission to write to.
Use await directly if inside an async function, or use nest_asyncio.apply() in Jupyter.
Run: pip install lightrag-hku
Set the OPENAI_API_KEY environment variable or pass it via LLM configuration.
Use await on async methods: await rag.ainsert('...') instead of rag.insert('...').