Skip to content

Conversation

@MrGeniusProgrammer
Copy link

Type

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

This pull request adds 3 new ai response parts--TextAccumulatedPart, ReasoningAccumulatedPart, and ToolPart--and utilities to convert from streaming and normal parts to accumulated parts.

  • TextAccumulatedPart: same as TextPart but with state field representing either "streaming" or "done"
  • ReasoningAccumulatedPart: same as ReasoningPart but with state field representing either "streaming" or "done"
  • ToolPart combines all of the other tool parts into one part, keeping each previous context, and distinguish each state by their value.state field, where it holds values such as:
    • "params-start": when params are started to streaming in
    • "params-streaming": when params are streaming in
    • "params-malformed": when params are malformed
    • "params-done": when params are done streaming
    • "result-error": when the tool returned an error result
    • "result-done": when the tool call result is returned

These all accumulated parts and other necessary parts are represented by AccumulatedPart.

utilities:

  • mergeAccumulatedParts: merges two accumulated parts into one accumulated parts
  • accumulateParts: accumulate over normal parts given already existing accumulated parts
  • accumulateStreamParts: accumulate over stream parts given already existing accumulated parts

Related

  • Related Issue #
  • Closes #

@changeset-bot
Copy link

changeset-bot bot commented Oct 31, 2025

🦋 Changeset detected

Latest commit: bb3c86e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@effect/ai Minor
@effect/ai-amazon-bedrock Major
@effect/ai-anthropic Major
@effect/ai-google Major
@effect/ai-openai Major
@effect/ai-openrouter Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Discussion Ongoing

Development

Successfully merging this pull request may close these issues.

1 participant