Skip to content

Simplify ToolCallAdvisor stream aggregation by removing publish() multicast#6195

Merged
tzolov merged 2 commits into
spring-projects:mainfrom
tzolov:fix-6017
May 28, 2026
Merged

Simplify ToolCallAdvisor stream aggregation by removing publish() multicast#6195
tzolov merged 2 commits into
spring-projects:mainfrom
tzolov:fix-6017

Conversation

@tzolov
Copy link
Copy Markdown
Contributor

@tzolov tzolov commented May 28, 2026

Replace the publish()-based dual-branch pattern with a straightforward sequential aggregation: aggregate the response first, then defer the tool-call recursion.
Also extract ChatClientMessageAggregator as a static field to avoid repeated instantiation per stream invocation.

Closes #6017

…ticast

Replace the publish()-based dual-branch pattern with a straightforward
sequential aggregation: aggregate the response first, then defer the
tool-call recursion. Also extract ChatClientMessageAggregator as a
static field to avoid repeated instantiation per stream invocation.

Closes spring-projects#6017

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
@tzolov tzolov added this to the 2.0.0-RC1 milestone May 28, 2026
Comment on lines +260 to +261
// Propagate this round's observation as the parent for inner-chain advisors
// (e.g. ChatModelStreamAdvisor) so their spans are correctly nested.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This comment doesn't seem justified or reflecting what actually happens? I mean it might be the case but it couples the comment with whatever happens in the chainCopy.nextStream if that is the internal behaviour. Let's bring back the previous comment maybe?

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
@tzolov tzolov merged commit cf39007 into spring-projects:main May 28, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ToolCallAdvisor >= 1.1.3 streamWithToolCallResponses Bug

2 participants