Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Azure AI Studio API or ChatGPT OpenAI selection + API calls implementation #40

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
# GraphGPT
### Natural Language → Knowledge Graph

## Intro
**GraphGPT** converts unstructured natural language into a knowledge graph.
Pass in the synopsis of your favorite movie, a passage from a confusing Wikipedia page, or transcript from a video to generate a graph visualization of entities and their relationships.

Successive queries can update the existing state of the graph or create an entirely new structure. For example, updating the current state could involve injecting new information through nodes and edges or changing the color of certain nodes.

The current few-shot prompt guides GPT-3 in accurately understanding the JSON formatting GraphGPT or Azure AI Studio API requires for proper rendering. You can see the entire prompt in `public/prompts/main.prompt`. A major issue at the moment is latency. Due to the nature of OpenAI API calls, it takes up to 20 seconds to receive a response.


## How it works?

### Natural Language → Knowledge Graph (demo first version)

![demo](demo.gif)

*Note: this is a toy project I built out over a weekend. If you want to use knowledge graphs in your project, check out [GPT Index](https://github.com/jerryjliu/gpt_index).*
### Natural Language → Knowledge Graph (demo version with Azure AI Studio switch)

GraphGPT converts unstructured natural language into a knowledge graph. Pass in the synopsis of your favorite movie, a passage from a confusing Wikipedia page, or transcript from a video to generate a graph visualization of entities and their relationships.
![screen-with-azure-switch](screen-with-azure-switch.png)

Successive queries can update the existing state of the graph or create an entirely new structure. For example, updating the current state could involve injecting new information through nodes and edges or changing the color of certain nodes.
*Note: this is a toy project I built out over a weekend. If you want to use knowledge graphs in your project, check out [GPT Index](https://github.com/jerryjliu/gpt_index).*

The current few-shot prompt guides GPT-3 in accurately understanding the JSON formatting GraphGPT requires for proper rendering. You can see the entire prompt in `public/prompts/main.prompt`. A major issue at the moment is latency. Due to the nature of OpenAI API calls, it takes up to 20 seconds to receive a response.

## Prompts

Expand Down
62 changes: 1 addition & 61 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "graphgpt",
"version": "0.1.0",
"version": "0.2.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.16.5",
Expand Down Expand Up @@ -36,4 +36,4 @@
"last 1 safari version"
]
}
}
}
2 changes: 1 addition & 1 deletion public/prompts/stateless.prompt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ If an update is a relationship, provide [ENTITY 1, RELATIONSHIP, ENTITY 2]. The

If an update is related to a color, provide [ENTITY, COLOR]. Color is in hex format.

If an update is related to deleting an entity, provide ["DELETE", ENTITY].
If an update is related to deleting an entity, provide [DELETE, ENTITY].

Example:
prompt: Alice is Bob's roommate. Make her node green.
Expand Down
Binary file added screen-with-azure-switch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
margin-bottom: 50px;
}

.searchBar {
.searchBar, .apiURI {
border: 1px solid rgb(0, 0, 0);
border-radius: 5px;
box-shadow: 0 0 5px rgb(0 0 0 / 10%);
Expand Down Expand Up @@ -150,4 +150,4 @@

.clearButton:hover {
background-color: rgba(239, 239, 239, 0.8);
}
}
Loading