getmetal / motorhead

🧠 Motorhead is a memory and information retrieval server for LLMs.
https://getmetal.io
Apache License 2.0
846 stars 79 forks source link

Extending context types #36

Open uyasarkocal opened 1 year ago

uyasarkocal commented 1 year ago

Would it be possible to integrate Knowledge Graph or Entity type context into motörhead?

Czechh commented 1 year ago

@uyasarkocal can you give me an example of a query<>response, also a use case?

If it makes sense for the project we can do it.

Thanks for the issue!

uyasarkocal commented 1 year ago

KG is usable with langchain, which has been the best memory type to overcome token limits for my case. Langchain Knowledge Graph Integration Code Langchain KG and Entity Mem. prompts This is how it uses KG, this memory type might be a little more complex since it loads into a networkx graph. (storing it is a bit more difficult but has a lot of options like pickle, json etc.)

Entity type memory is easier, since a prompt extracts entities from chats with a simpler structure (Just "entity:knowledge") and does not need to load into any library to work.

Incorporating both KG and Entity type memory into Motörhead would greatly enhance the quality of knowledge and information that can be retrieved and shared during chat interactions.

Example for KG knowledge triplets with conversation from Motörhead's Readme.md: <|>(Electronic music, encompasses, many different styles) <|>(People, dance to, electronic music) <|>(Colombia, has, a vibrant electronic music scene) <|>(Colombian DJs, have gained, international recognition) <|>(Baum, is one of, the most popular clubs for electronic music in Bogotá)

As you may notice, as this knowledge triplets extend with the chat it supplies a much more sophisticated context with relations while storing much more smaller data.

@Czechh Thanks for your attention and this product 🤘🏼

Czechh commented 1 year ago

This is awesome @uyasarkocal - I'm currently working on log term memory with a semantic index. I can start looking into this right after that.

Need to build a working example to understand it better.