Open-Assistant
Open-Assistant copied to clipboard
Include a GraphGPT into OA
GraphGPT will convert the OA natural language into a knowledge graph utilizing this repo: https://github.com/varunshenoy/GraphGPT. The app to demo the GraphGPT is graphgpt.vercel.app
Acceptance Criterion: Similar to GraphGPT, the few-shot prompt will guide Open-Assistant in accurately understanding the JSON formatting GraphGPT requires for proper rendering. An Example of the prompt is below where $state and $prompt are passed from App.js (front-end-user) and the new state is returned by OA.
You are given the current state of a graph and a prompt. Extrapolate as many relationships as you can from the prompt and update the state. Every node has an id, label, and color (in hex). Every edge has a to and from with node ids, and a label. Edges are directed, so the order of the from and to is important.
Examples: current state: { "counter": 1, "graph": { "nodes": [ { "id": 1, "label": "Bob", "color": "#ffffff" } ], "edges": [] } }
prompt: Alice is Bob's roommate. Make her node green.
new state: { "counter": 2, "graph": { "nodes": [ { "id": 1, "label": "Bob", "color": "#ffffff" }, { "id": 2, "label": "Alice", "color": "#ff7675" } ], "edges": [ { "from": 1, "to": 2, "label": "roommate" }}, ] } }
current state: $state
prompt: $prompt
new state:
This is cool. You could use networkx and other python graph drawing too. I think it would be cool to extract these knoweledge graphs as triples sentences (A is X to B) as well so we can feed it back into data augmentation. And it's a way to test what knowledge the model can output if we have it in canonical form. might behelpful: https://colab.research.google.com/github/jdwittenauer/ipython-notebooks/blob/master/notebooks/libraries/NetworkX.ipynb
also i think graphgpt might not have a license so if we use their code, ping them to put a license like apache or mit on their repo. thank you!
I have made an issue on GraphGPT asking them to add an open source licence. Feel free to add comments to show support for the idea https://github.com/varunshenoy/GraphGPT/issues/10
Thank you @olliestanley and @ontocord I got basic python code working in my local using the NetworkX colab notebook example that @ontocord shared above. Thank you.
Next, I would need a similar OA API endpoint such that, I can fetch the response
e.g., when I send POST request to OA model endpoint, similar to the below code -
# Fetch results from OA API e.g., a model-serving endpoint
response = fetch("https://www.some_api.com/v1/completions", request_options)
@ontocord, The response
needs to be in the following JSON format. Who should I work with such that OA model can spit out response in that format (example below)?
I am not blocked because I can continue to test the new code with a manual test example such as given below.
new state: { "counter": 2, "graph": { "nodes": [ { "id": 1, "label": "Bob", "color": "#ffffff" }, { "id": 2, "label": "Alice", "color": "#ff7675" } ], "edges": [ { "from": 1, "to": 2, "label": "roommate" }, ] } }
Also, I am thinking of checking in the code to a new branch 1060_ggpt_OA, and organize the new code-files in a new folder in the inference/ folder such as /repo-root/inference/graphgpt
/*. Or else, please let me know the folder structure for this functionality before I create a pull request.
Great work @MohitJuneja! We aren't running a bot (yet). Can you test this with an LLM you can run form colab or your local machine. E.g., gpt-J, pythia or neox?
Sure will do @ontocord; Thank you for the direction. 🙏 I have been busy the last week and a half with work deadlines and was also experimenting with LangChain to use LLM embedding & Faiss search API. Next week, I am planning to continue on this item and build a local test env on my RTX 3090 as suggested with gpt-J, pythia or neox and will keep this thread updated.
Closing old data issue.