Skip to content

Comments

feat (core): Add finishReason field to NoObjectGeneratedError#5541

Merged
lgrammel merged 3 commits intovercel:mainfrom
BramMeerten:add-finish-reason-to-no-object-generated-error
Apr 4, 2025
Merged

feat (core): Add finishReason field to NoObjectGeneratedError#5541
lgrammel merged 3 commits intovercel:mainfrom
BramMeerten:add-finish-reason-to-no-object-generated-error

Conversation

@BramMeerten
Copy link
Contributor

Add finishReason field to NoObjectGeneratedError, this can help clarify why an error occurred. cause is not always enough to determine the exact reason.

For example if the max token size was reached, the (JSON) response will be incomplete. cause will be a JSONParseError, but the root cause is the token size which has been reached.
By adding finishReason (which info is already available where we throw the error) we can see that the value is 'length' and that the max token size has been reached.

@BramMeerten BramMeerten force-pushed the add-finish-reason-to-no-object-generated-error branch 3 times, most recently from 11d4c7e to 3c39f33 Compare April 3, 2025 20:00
@BramMeerten BramMeerten changed the title Add finishReason field to NoObjectGeneratedError feat: Add finishReason field to NoObjectGeneratedError Apr 3, 2025
@lgrammel lgrammel changed the title feat: Add finishReason field to NoObjectGeneratedError feat (core): Add finishReason field to NoObjectGeneratedError Apr 4, 2025
@lgrammel
Copy link
Collaborator

lgrammel commented Apr 4, 2025

Please add a patch changeset for ai with the PR description as content.

indicate why an error such as JsonParseError occured, for example if
finishReason is 'length' because max token size has been reached.
@BramMeerten BramMeerten force-pushed the add-finish-reason-to-no-object-generated-error branch from 3c39f33 to 3c1d40b Compare April 4, 2025 11:40
@BramMeerten
Copy link
Contributor Author

Oke, I updated the commit.
I was not familiar with this, hope I did it correctly.

@BramMeerten BramMeerten force-pushed the add-finish-reason-to-no-object-generated-error branch from 920b44a to e7f0e59 Compare April 4, 2025 13:00
@lgrammel lgrammel merged commit 772a2d7 into vercel:main Apr 4, 2025
6 of 7 checks passed
lgrammel pushed a commit that referenced this pull request Apr 4, 2025
Co-authored-by: Bram Meerten <bram.meerten@acagroup.be>
jacobkerber pushed a commit to jacobkerber/ai that referenced this pull request Jul 15, 2025
…#5541)

Co-authored-by: Bram Meerten <bram.meerten@acagroup.be>
jacobkerber pushed a commit to jacobkerber/ai that referenced this pull request Jul 15, 2025
…#5541)

Co-authored-by: Bram Meerten <bram.meerten@acagroup.be>
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.

3 participants