Skip to content

Conversation

@YunKuiLu
Copy link
Contributor

No description provided.

Comment on lines -156 to -159
List<Message> messageHistory = new ArrayList<>(prompt.copy().getInstructions());
messageHistory.add(new AssistantMessage(assistantMessage.getText(), assistantMessage.getMetadata(),
assistantMessage.getToolCalls()));

Copy link
Contributor Author

@YunKuiLu YunKuiLu Jun 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The messageHistory in the buildToolContext method is actually unused. The real messageHistory construction happens in the buildConversationHistoryBeforeToolExecution method.

private static List<Message> buildConversationHistoryBeforeToolExecution(Prompt prompt,
			AssistantMessage assistantMessage) {
  List<Message> messageHistory = new ArrayList<>(prompt.copy().getInstructions());
  messageHistory.add(new AssistantMessage(assistantMessage.getText(), assistantMessage.getMetadata(),
		  assistantMessage.getToolCalls()));
  return messageHistory;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@YunKuiLu Good catch. Thanks for the cleanup!

@YunKuiLu YunKuiLu changed the title Remove code that's actually unused. Remove unused messageHistory Jun 18, 2025
@ilayaperumalg ilayaperumalg self-assigned this Jun 18, 2025
@ilayaperumalg ilayaperumalg modified the milestone: 1.1.x Jun 18, 2025
@ilayaperumalg ilayaperumalg merged commit 3b94838 into spring-projects:main Jun 18, 2025
2 checks passed
spring-builds pushed a commit that referenced this pull request Jun 18, 2025
Fixes #3574

Signed-off-by: YunKui Lu <[email protected]>
(cherry picked from commit 3b94838)
@YunKuiLu YunKuiLu deleted the fix-code-1 branch June 18, 2025 10:10
scionaltera pushed a commit to scionaltera/spring-ai that referenced this pull request Sep 3, 2025
chedim pushed a commit to couchbaselabs/spring-ai that referenced this pull request Sep 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants