AI prompts
base on Converts text input or URL into knowledge graph and displays Note for non-coders: you can sign up for the waitlist at [instagraph.ai](https://instagraph.ai).
# InstaGraph ๐
Hello there, adventurous coder! Welcome to InstaGraph, your go-to application for converting text or URLs into insightful knowledge graphs. Curious about the relationships between entities in a complex topic? Feed the text to InstaGraph and voila! A beautiful knowledge graph is at your fingertips.
See example flowcharts generated by InstaGraph [here](https://twitter.com/yoheinakajima/status/1701351068817301922).
Powered by OpenAI's GPT-3.5, this Flask application turns your text into a vividly colored graph, making it easier to visualize relationships between various entities. Enough talkingโlet's get started!
***Author's TL;DR**: If you're just looking for how the knowledge graph is generated, check out the function call parameters taking up half of main.py.*
## Table of Contents ๐
- [Features](#features-)
- [Installation](#installation-%EF%B8%8F)
- [Usage](#usage-)
- [Contributing](#contributing-)
- [License](#license-)
## Features ๐
- Dynamic Text to Graph conversion.
- Color-coded graph nodes and edges.
- Responsive designโuse it on any device.
- Super-duper user-friendly!
## Installation ๐ ๏ธ
To get started, you'll need Python and pip installed.
#### 1. Clone the repository
```bash
git clone https://github.com/yoheinakajima/instagraph.git
```
#### 2. Navigate to the project directory
```bash
cd instagraph
```
#### 3. Install the required Python packages
```bash
pip install -r requirements.txt
```
#### 4. Set up your OpenAI API Key
Change .env.example to .env
```text
mv .env.example .env
```
Add your OpenAI API key to .env file:
```text
OPENAI_API_KEY=your-api-key-here
```
##### Optional - Set a Graph Database
Use: `[--graph neo4j|falkordb]` to select the Graph Database driver
- Neo4J
Add Neo4J username, password and URL in the `*.env` file as well by creating an instance of [neo4j](https://neo4j.com/cloud/platform/aura-graph-database).
```text
NEO4J_USERNAME=
NEO4J_PASSWORD=
NEO4J_URI=
```
- FalkorDB
Add FalkorDB URL in the `*.env` file as well by creating an instance of [FlakorDB](https://www.falkordb.com/try-free).
```text
FALKORDB_URL=
```
#### 5. Run the Flask app
```bash
python main.py [--graph neo4j|falkordb] [--port port] [--debug]
```
Navigate to `http://localhost:8080` to see your app running.
## Run as Container
#### 1. Clone the repository
```bash
git clone https://github.com/yoheinakajima/instagraph.git
```
#### 2. Navigate to the project docker directory
```bash
cd instagraph/docker
```
#### 3.1 Run in Dev mode
```bash
docker-compose -f docker-compose-dev.yml up # Add -d flag at the end to run in background/daemon mode.
```
#### 3.2 Run in Prod - Create the docker image
- Using the `gunicorn==21.2.0` to run the application in production mode
```bash
docker-compose -f docker-compose.yml up --build -d
```
## Usage ๐
### Web Interface
- Open your web browser and navigate to `http://localhost:8080`.
- Type your text or paste a URL in the input box.
- Click "Submit" and wait for the magic to happen!
### API Endpoints
1. **GET Response Data**: `/get_response_data`
- Method: `POST`
- Data Params: `{"user_input": "Your text here"}`
- Response: GPT-3.5 processed data
2. **GET Graph Data**: `/get_graph_data`
- Method: `POST`
- Response: Graph Data
3. **GET History Data**: `/get_graph_history`
- Method: `GET`
- Response: Graph Data
## Contributing ๐ค
Best way to chat with me is on Twitter at [@yoheinakajima](https://twitter.com/yoheinakajima). I usually only code on the weekends or at night, and in pretty small chunks. I have lots ideas on what I want to add here, but obviously this would move faster with everyone. Not sure I can manage Github well given my time constraints, so please reach out if you want to help me run the Github. Now, here are a few ideas on what I think we should add based on comments...
- ~~Store knowledge graph~~ (thx [@tomasonjo](https://github.com/tomasonjo)! 9/13/23)
- ~~Pull knowledge graph from storage~~ (thx [@tomasonjo](https://github.com/tomasonjo)! 9/13/23)
- Show history
- Ability to combine two graphs
- Ability to combine 2+ graphs from history
- ~~Ability to expand on a graph~~ (thx [@tomasonjo](https://github.com/tomasonjo)! 9/13/23)
- Ability to expand on graph from specific nodes
- Fuzzy matching of nodes for combining graphs (vector match + LLM confirmation)
There are a lot of "build a chart" tools out there, so instead of doing user account and custom charts, it sounds more fun for me to work on building the largest knowledge graph ever...
Before creating an Issue please refer the [ISSUE_TEMPLATE](https://github.com/yoheinakajima/instagraph/tree/main/.github/ISSUE_TEMPLATE) provided.
## License ๐
MIT License. See [LICENSE](LICENSE) for more information.
---
Enjoy using InstaGraph! ๐
", Assign "at most 3 tags" to the expected json: {"id":"1455","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"