Skip to content

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 added the area-ai Microsoft.Extensions.AI libraries label Oct 12, 2024
@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
@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

area-ai Microsoft.Extensions.AI libraries

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CachingChatClient is building up a string with concatenation

3 participants