spring-projects / spring-projects/spring-ai

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

Open
#2,902 3 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: to-discuss
Dominant language
Java
Stars
9.5k
Forks
2.9k
Avg merge
1d 7h
Merged PRs (30d)
6

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the org.springframework.ai.model.Content interface and its Message and Document subtypes, which the issue identifies as the relevant entry points. Check how the existing Document id is exposed and determine the affected implementations before evaluating the proposed String getId() API. Done means the identifier is consistently available through Content without relying on metadata.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
ai, api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.