This example demonstrates how to achieve GraphRAG using just 10 lines of core code. The steps outlined in this example guide you through setting up the environment, handling dependencies, and executing the core code to build and query a knowledge graph. Below are the main sections and steps involved in this process.
- Setting
- Dependencies
- Prerequisites
- Core Code
- Part 1: Indexing
- Set OpenAI and DSPy
- Load Raw Wikipedia Page
- Extract Raw Wikipedia Page to Knowledge Graph
- Let's Show the Graph
- Save Graph to TiDB Serverless
- Part 2: Retrieve
- Ask Question
- Find Entities and Relationships
- Part 3: Generate Answer
- Part 1: Indexing
Try it in the Google colab.