GraphRAG-Local-UI v1.0.12 - API-Centric Architecture and Indexing/Prompt Tuning UI
Overview
This release marks a significant shift in the GraphRAG project architecture, moving towards an API-centric design that separates the indexing process from querying. This new approach provides a more robust, scalable, and flexible framework for working with GraphRAG.
Key Changes
1. Introduction of api.py
I've introduced a new api.py
file that serves as the central hub for all GraphRAG operations. This FastAPI-based server provides endpoints for:
- Chat completions (supporting various models)
- Indexing operations
- Prompt tuning
- Model listing
- Health checks
This API-first approach allows for better integration with various front-ends and services, enhancing the overall flexibility of the system.
2. New Indexing UI (index_app.py
)
To complement the API, I've developed a dedicated Gradio-based user interface for managing indexing and prompt tuning processes. This UI (index_app.py
) offers:
- Intuitive controls for configuring and running indexing tasks
- A separate interface for prompt tuning
- Data management capabilities for input files and output folders
- Real-time status updates and logs
3. Separation of Concerns
By decoupling the indexing process from querying, I've achieved:
- Better resource management: Indexing and querying can now be scaled independently
- Improved maintainability: Each component (API, indexing UI, future query UI) can be developed and updated separately
- Enhanced flexibility: The API can be easily integrated with various front-ends or services
New Features
- API Endpoints: New endpoints for indexing, prompt tuning, and status checks
- Background Tasks: Long-running operations like indexing and prompt tuning are now handled as background tasks
- Configurable Settings: Easy configuration through environment variables and YAML files
- Improved Error Handling: Comprehensive error catching and logging throughout the API and UI
- File Management: Built-in tools for managing input files and exploring output data
Upgrade Instructions
- Update your local repository to access the new files (
api.py
andindex_app.py
) - Install new dependencies:
pip install fastapi uvicorn gradio pyyaml
- Set up the required environment variables as detailed in the README
- Start the API server:
python api.py
- Launch the indexing UI:
python index_app.py
Future Directions
This release lays the groundwork for further enhancements, including:
- A dedicated querying UI that interacts with the API
- Extended API capabilities for more granular control over GraphRAG operations
- Improved documentation and examples for API usage
Closing Thoughts
This architectural shift represents a significant step forward for the GraphRAG project. By embracing an API-centric design, I've set the stage for more scalable, maintainable, and flexible development in the future. I'm excited to see how this new approach will enable novel use cases and integrations for GraphRAG. The original app.py doesn't use the new API, just to note.
This shift took inspiration and used the GraphRAG4OpenWebUI repository by win4r (https://github.com/win4r/GraphRAG4OpenWebUI) as a starting point for the API implementation. The original work provided valuable insights into integrating Microsoft's GraphRAG technology with Open WebUI, which helped shape the foundation of this API-centric approach.