Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve CachingChatClient's coalescing of streaming updates #5514

Merged
merged 2 commits into from
Oct 12, 2024

Conversation

stephentoub
Copy link
Member

@stephentoub stephentoub commented Oct 11, 2024

  • Avoid O(N^2) memory allocation in the length of the received text
  • Propagate additional metadata from coalesced nodes
  • Propagate metadata on the coalesced TextContent, like ModelId
  • Expose whether to coalesce as a setting on the client

Fixes #5481

Microsoft Reviewers: Open in CodeFlow

- Avoid O(N^2) memory allocation in the length of the received text
- Propagate additional metadata from coalesced nodes
- Propagate metadata on the coalesced TextContent, like ModelId
- Expose whether to coalesce as a setting on the client
Copy link
Member

@joperezr joperezr left a comment

Choose a reason for hiding this comment

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

Code changes LGTM but not familiar with the area so I'll defer to experts. FWIW and given this is a perf-oriented change, We do have benchmark projects added here but they are only running manually for now. We could look into having these benchmarks run daily so we can track the impact of changes as time goes by.

@SteveSandersonMS
Copy link
Member

Everything else looks great!

@stephentoub stephentoub enabled auto-merge (squash) October 12, 2024 11:25
@stephentoub stephentoub disabled auto-merge October 12, 2024 11:25
@stephentoub stephentoub enabled auto-merge (squash) October 12, 2024 11:26
@stephentoub stephentoub disabled auto-merge October 12, 2024 11:27
@stephentoub stephentoub merged commit e0c9a82 into dotnet:main Oct 12, 2024
6 checks passed
@stephentoub stephentoub deleted the improvecoalescing branch October 12, 2024 11:31
@github-actions github-actions bot locked and limited conversation to collaborators Nov 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CachingChatClient is building up a string with concatenation
3 participants