motorhead icon indicating copy to clipboard operation
motorhead copied to clipboard

Add message-id to messages list in API response

Open sarfudheen opened this issue 1 year ago • 1 comments

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
}

sarfudheen avatar Oct 09 '23 14:10 sarfudheen

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.

jasgeo75 avatar Oct 18 '23 01:10 jasgeo75