Skip to content

handle error parsing when the termination sequence is appended to the end of json#16

Merged
connorch merged 6 commits intomainfrom
better-error-handling
May 30, 2025
Merged

handle error parsing when the termination sequence is appended to the end of json#16
connorch merged 6 commits intomainfrom
better-error-handling

Conversation

@connorch
Copy link
Collaborator

@connorch connorch commented May 30, 2025

Sometimes within a single chunk response there is JSON combined with the [DONE] stop sequence. This causes the json parser to fail and for the error to be treated as a JSON parsing error rather than properly parsing/handling the response.

This PR adds handling for this by attempting to parse JSON chunks that end in the stop sequence.

@changeset-bot
Copy link

changeset-bot bot commented May 30, 2025

🦋 Changeset detected

Latest commit: 0353605

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

This PR includes changesets to release 1 package
Name Type
@hyperbolic/ai-sdk-provider Patch

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

@connorch connorch changed the title handle error parsing when the termination sequence is appended to the… handle error parsing when the termination sequence is appended to the end of json May 30, 2025
@connorch connorch merged commit 78fde27 into main May 30, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant