Knowledge Graph Project

October 2024
Python, Pandas, Plotly
3 weeks
Knowledge Graph With LLM

Project Overview

An AI project that extracts knowledge from text and visualizes it as an interactive graph. It uses OpenAI's GPT-4 to identify entities and relationships, then creates a beautiful, interactive visualization.

Key Features

  • Extracts entities (people, companies, products, concepts)
  • Identifies relationships between entities (Subject-Predicate-Object triples)
  • Standardizes entity names (e.g., "Apple", "tech giant", "Apple Inc." → "apple inc")
  • Visualizes everything as an interactive knowledge graph

How It Works

You give it a sample text like this:

"Apple Inc. announced a new iPhone model yesterday. The tech giant, based in Cupertino, said the device would be available next month. Tim Cook, CEO of Apple, presented the new product. The iPhone features an improved camera system and longer battery life. Apple's stock price rose following the announcement. Analysts predict strong sales for the holiday season. Meanwhile, Samsung Electronics is preparing its own product launch. The South Korean company plans to unveil a new Galaxy smartphone next week. Industry experts expect intense competition between the two tech giants in the coming months. Both companies are investing heavily in research and development. The smartphone market has become increasingly competitive in recent years."

It will then create a knowledge graph drawing relationships from the text; for example:

Tim Cook → CEO of → Apple Inc.
Apple Inc. → announced → iPhone
iPhone → features → improved camera
Samsung → competes with → Apple Inc.