getmetal / motorhead

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

Add message-id to messages list in API response #83

Open sarfudheen opened 10 months ago

sarfudheen commented 10 months ago

Current Implementation:

Actual call to http://MOTOR_URL/sessions/{session-id}/memory returns a list of messages in the following format:

{
    "messages": [
        {
            "role": "AI",
            "content": "Test."
        },
        {
            "role": "Human",
            "content": "Test"
        },
          ],
    "context": null,
    "tokens": 0
}

Enhancement Request:

In the messages list, it would be beneficial to include a unique message-id for each message. This enhancement would facilitate the ability to delete or update a specific message content. Here's the updated format:

{
    "messages": [
        {
            "role": "AI",
            "content": "Test.",
            "message-id" : "uuid"
        },
        {
            "role": "Human",
            "content": "Test",
            "message-id" : "uuid"
        },
          ],
    "context": null,
    "tokens": 0
}
jasgeo75 commented 10 months ago

Absolutely, this!

It would allow us to manage more efficiently what we're "remembering" (and paying OpenAI for).

Being able to delete messages from the contextual memory is the best feature of the playground, for example. But oddly, you rarely if ever, see it implemented anywhere else.