# KnowledgeGraph GPT - Converting unstructured text into a Knowledge graph

**URL:** <https://community.openai.com/t/knowledgegraph-gpt-converting-unstructured-text-into-a-knowledge-graph/48941>\
**Category:** Community\
**Tags:** semantic-triple, rdf-triple\
**Created:** [February 5, 2023, 3:50pm UTC](https://community.openai.com/t/knowledgegraph-gpt-converting-unstructured-text-into-a-knowledge-graph/48941 "2023-02-05T15:50:01Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![ammartahircs](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/ammartahircs/32/25264_2.png) [@ammartahircs](https://community.openai.com/u/ammartahircs)\
**Post date:** [February 5, 2023, 3:50pm UTC](https://community.openai.com/t/knowledgegraph-gpt-converting-unstructured-text-into-a-knowledge-graph/48941/1 "2023-02-05T15:50:01Z")

</div>

Transform plain text into a visually stunning knowledge graph with GPT-3 technology! This app converts text into RDF tuples and colors them based on frequency, creating a dynamic and informative representation of your data. Download the resultant RDF Tuples as a JSON file for easy integration and analysis.

Example Prompt: Bob is Anna’s father. Anna’s mother is Angela. Anna also has a brother John son of Bob. Show me all the relationships that exist.

Github Repo: [GitHub - iAmmarTahir/KnowledgeGraphGPT: Transform plain text into a visually stunning Knowledge Graph with GPT-4 (latest preview)! It converts text into RDF tuples, and highlights the most frequent connections with a vibrant color-coding system. Download the results as a convenient JSON file for easy integration into your own projects.](https://github.com/iAmmarTahir/KnowledgeGraphGPT)  
Website: [KnowledgeGraph GPT](https://celebrated-kitten-367f1f.netlify.app/)

 ![Screenshot 2023-02-05 at 2.11.46 PM](https://us1.discourse-cdn.com/openai1/original/3X/7/a/7a2813bdc67dadfefe9c098935b43622d71d9c1b.jpeg)

---

<div class="post-metadata">

**Author:** ![thinkofsomethingclev](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/thinkofsomethingclev/32/87_2.png) [@thinkofsomethingclev](https://community.openai.com/u/thinkofsomethingclev)\
**Post date:** [February 6, 2023, 9:35pm UTC](https://community.openai.com/t/knowledgegraph-gpt-converting-unstructured-text-into-a-knowledge-graph/48941/2 "2023-02-06T21:35:08Z")

</div>

Wow, nice work! Great idea. Did you host it somewhere? I’d love to play with it.

---

<div class="post-metadata">

**Author:** ![ammartahircs](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/ammartahircs/32/25264_2.png) [@ammartahircs](https://community.openai.com/u/ammartahircs)\
**Post date:** [February 6, 2023, 11:57pm UTC](https://community.openai.com/t/knowledgegraph-gpt-converting-unstructured-text-into-a-knowledge-graph/48941/3 "2023-02-06T23:57:02Z")

</div>

Thanks!! Here’s the link: [https://celebrated-kitten-367f1f.netlify.app/](https://celebrated-kitten-367f1f.netlify.app/). You have to provide your OpenAI API key and you can generate the graphs by entering the prompt

---

<div class="post-metadata">

**Author:** ![dtroetsc](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/dtroetsc/32/35552_2.png) [@dtroetsc](https://community.openai.com/u/dtroetsc)\
**Post date:** [March 29, 2023, 3:06am UTC](https://community.openai.com/t/knowledgegraph-gpt-converting-unstructured-text-into-a-knowledge-graph/48941/4 "2023-03-29T03:06:36Z")

</div>

Any way you could make an option for exporting the resulting visuals to high resolution PNG? Works great otherwise!

---

<div class="post-metadata">

**Author:** ![shawonskh11](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/shawonskh11/32/283742_2.png) [@shawonskh11](https://community.openai.com/u/shawonskh11)\
**Post date:** [January 9, 2024, 3:32pm UTC](https://community.openai.com/t/knowledgegraph-gpt-converting-unstructured-text-into-a-knowledge-graph/48941/5 "2024-01-09T15:32:36Z")

</div>

I see you using gpt4 would it work with 3.5?

---

<div class="post-metadata">

**Author:** ![EricGT](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/ericgt/32/20571_2.png) [@EricGT](https://community.openai.com/u/EricGT)\
**Post date:** [January 9, 2024, 3:48pm UTC](https://community.openai.com/t/knowledgegraph-gpt-converting-unstructured-text-into-a-knowledge-graph/48941/6 "2024-01-09T15:48:36Z")

</div>

Note: The noted prompt does work with GPT-3.5 however the [triples](https://en.wikipedia.org/wiki/Semantic_triple) (tuples as the OP states) it creates could be more refined, they are more often phrases than just single words.

The prompt used is noted

> <https://github.com/iAmmarTahir/KnowledgeGraphGPT/blob/master/src/prompt/prompt.main>

the rest appears to be freeware

1. `npm >= v7.19.1`
2. `node >= v14.17.4`

> **[GitHub - iAmmarTahir/KnowledgeGraphGPT: Transform plain text into a visually...](https://github.com/iAmmarTahir/KnowledgeGraphGPT/tree/master?tab=readme-ov-file#required-verisons)**
>
> master

---

<div class="post-metadata">

**Author:** ![shawonskh11](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/shawonskh11/32/283742_2.png) [@shawonskh11](https://community.openai.com/u/shawonskh11)\
**Post date:** [January 9, 2024, 11:02pm UTC](https://community.openai.com/t/knowledgegraph-gpt-converting-unstructured-text-into-a-knowledge-graph/48941/7 "2024-01-09T23:02:44Z")

</div>

Module parse failed: Unexpected token (1:4)  
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. It tells me to see webpack concept of loaders

> You are given a prompt. Extrapolate as many relationships as you can from the prompt and generate tuples like (source, relation, target). Make sure there are always source, relation and target in the tuple.  
> | Example:  
> | prompt: John knows React, Golang, and Python. John is good at Software Engineering and Leadership

this is the error i get

---

<div class="post-metadata">

**Author:** ![ammartahircs](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/ammartahircs/32/25264_2.png) [@ammartahircs](https://community.openai.com/u/ammartahircs)\
**Post date:** [January 10, 2024, 2:56am UTC](https://community.openai.com/t/knowledgegraph-gpt-converting-unstructured-text-into-a-knowledge-graph/48941/8 "2024-01-10T02:56:05Z")

</div>

Yes, it works with GPT-3.5 as well.

---

<div class="post-metadata">

**Author:** ![ammartahircs](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/ammartahircs/32/25264_2.png) [@ammartahircs](https://community.openai.com/u/ammartahircs)\
**Post date:** [January 10, 2024, 2:56am UTC](https://community.openai.com/t/knowledgegraph-gpt-converting-unstructured-text-into-a-knowledge-graph/48941/9 "2024-01-10T02:56:36Z")

</div>

I have fixed this issue and merged the PR into the master.

---

<div class="post-metadata">

**Author:** ![ammartahircs](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/ammartahircs/32/25264_2.png) [@ammartahircs](https://community.openai.com/u/ammartahircs)\
**Post date:** [January 10, 2024, 2:58am UTC](https://community.openai.com/t/knowledgegraph-gpt-converting-unstructured-text-into-a-knowledge-graph/48941/10 "2024-01-10T02:58:11Z")

</div>

Feel free to contribute an enhanced version of the prompt if you can make improvements.

---

<div class="post-metadata">

**Author:** ![EricGT](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/ericgt/32/20571_2.png) [@EricGT](https://community.openai.com/u/EricGT)\
**Post date:** [May 31, 2025, 11:11am UTC](https://community.openai.com/t/knowledgegraph-gpt-converting-unstructured-text-into-a-knowledge-graph/48941/11 "2025-05-31T11:11:24Z")

</div>

FYI as this is the only topic currently with tags: `semantic-triple` or `rdf-triple`

If using [MCP](https://modelcontextprotocol.io/introduction) take a look at

> **[servers/src/memory at main · modelcontextprotocol/servers](https://github.com/modelcontextprotocol/servers/tree/main/src/memory)**
>
> Model Context Protocol Servers. Contribute to modelcontextprotocol/servers development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![EricGT](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/ericgt/32/20571_2.png) [@EricGT](https://community.openai.com/u/EricGT)\
**Post date:** [June 7, 2025, 9:42pm UTC](https://community.openai.com/t/knowledgegraph-gpt-converting-unstructured-text-into-a-knowledge-graph/48941/12 "2025-06-07T21:42:09Z")

</div>

Just found this

> **[GitHub - robert-mcdermott/ai-knowledge-graph: AI Powered Knowledge Graph Generator](https://github.com/robert-mcdermott/ai-knowledge-graph)**
>
> AI Powered Knowledge Graph Generator

> This system takes an unstructured text document, and uses an LLM of your choice to extract knowledge in the form of Subject-Predicate-Object (SPO) triplets, and visualizes the relationships as an interactive knowledge graph. A demo of a knowledge graph created with this project can be found here: [Industrial-Revolution Knowledge Graph](https://robert-mcdermott.github.io/ai-knowledge-graph/)
