Hacker News new | ask | show | jobs
Show HN: gpt-graph. A simple, GPT-3 text to entity-relation graph generator (github.com)
14 points by mrsernine 1205 days ago
Hi HN!

This is a simple text to entity-relation graph generator, powered by gpt-3 davinci model.

The purpose is to feed it actual written data, to obtain a graph representation of entities and relationships mentioned in the text. Also, being able to identify entity attributes like gender, size, age ...

My initial goal, was to make it able to process a large amount of text into a big single graph. The problem being the 4000 token limit the model has, I decided to take the approach of feeding the text in batches, and try to merge the incoming graph with the existing information each time. This is done by comparing the incoming node labels with those already in the graph, adding the new information to the existing nodes.

This works somewhat, but sometimes entities get duplicated if they are mentioned slightly differently in the text. The comparation method could use some improvement clearly.

A nice feature, is that you get to decide what types you want to extract. So if, for example, you are interested only in people, and companies in the text, you can tell the model to stick to that. You can also leave the types to the model discretion.

Also, the application allows for saving / loading graphs to json files. These files can be used with Cytoscape Desktop Application, which is a nice side effect of using cytoscape.js. in the UI.

I think tools like this can really be of help when going through dense documentation. To have a visual representation of the concepts, entities or whatever, can be really helpful in education, investigation, legal ...

Would love to hear your thoughts on how this could be improved.

1 comments

Any live demo? we can try.

I can't find what prompt was used in code.

I'm afraid this is a desktop application so there's no live demo right now. But yeah maybe I could set something up so it can be demoed online.

There are binaries you can use for windows and linux, you need an OpenAI api key though:

https://github.com/achousa/gpt-graph/releases

As for the prompt you can find it in: scr/config/prompts.js

https://github.com/achousa/gpt-graph/blob/main/src/config/pr...

Thanks a lot.

I don't know much but tried to make a web based version of this with very basic functionality.

https://twitter.com/motyar/status/1632699003061108737

It's amazing how the model is capable of identifying concepts as nodes in the graph, and linking them together. It means it's also useful for concept maps, apart from simply NER.

I've set up a little online demo, however due to browser sandboxing, it's lacking the "load file" functionality. The application loads as a static asset, and API Key get's stored solely in your browser local storage.

https://gpt-graph.loca.lt/

Just tried it, Super cool.