spring-ai icon indicating copy to clipboard operation
spring-ai copied to clipboard

org.springframework.ai.chat.messages.Message should have a getId() method

Open enricorampazzo opened this issue 6 months ago • 3 comments
trafficstars

Let's say I have a chatbot, and I want the user to be able to give a feedback on whether the assistant message is good or not: it is necessary to have an id to identify that message univocally, but at the moment the Message interface does not have a way to get it.

Of course it would be possible to just have it in the message metadata, however for Document (which has the same super interface of Message, i.e. Content) the id field is provided directly, and not as a part of its metadata

So my suggestion is just to add

String getId(); to org.springframework.ai.model.Content

If you think this is a good idea I can prepare the PR

enricorampazzo avatar Apr 26 '25 11:04 enricorampazzo