-
Notifications
You must be signed in to change notification settings - Fork 3
fix: handle errors which occur prior to stream initiation #57
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
Merged
Merged
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
44e2593
chore: renaming fixtures and making tests more specific
dannykopping 1570e2a
chore: add test for upstream errs that occur before stream starts (an…
dannykopping 2b5ba45
chore: implement openai error handling
dannykopping 453992c
chore: self-review
dannykopping f1eebe1
chore: refactor away from atomic to compound mutex + bool
dannykopping d73b3bf
chore: drive-by flake fix
dannykopping 2e492f2
chore: simplify approach
dannykopping 7e07b1d
chore: fix flake due to order of operations
dannykopping d94d846
chore: fixing race
dannykopping 74ab758
chore: headers drive-by race fix
dannykopping File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| Simple request + error which occurs before streaming begins (where applicable). | ||
|
|
||
| -- request -- | ||
| { | ||
| "max_tokens": 8192, | ||
| "messages": [ | ||
| { | ||
| "role": "user", | ||
| "content": [ | ||
| { | ||
| "type": "text", | ||
| "text": "yo" | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| "model": "claude-sonnet-4-0", | ||
| "temperature": 1 | ||
| } | ||
|
|
||
| -- streaming -- | ||
| HTTP/2.0 400 Bad Request | ||
| Content-Length: 164 | ||
| Content-Type: application/json | ||
|
|
||
| {"type":"error","error":{"type":"invalid_request_error","message":"prompt is too long: 205429 tokens > 200000 maximum"},"request_id":"req_011CV5Jab6gR3ZNs9Sj6apiD"} | ||
|
|
||
|
|
||
| -- non-streaming -- | ||
| HTTP/2.0 400 Bad Request | ||
| Content-Length: 164 | ||
| Content-Type: application/json | ||
|
|
||
| {"type":"error","error":{"type":"invalid_request_error","message":"prompt is too long: 205429 tokens > 200000 maximum"},"request_id":"req_011CV5Jab6gR3ZNs9Sj6apiD"} | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| Simple request + error which occurs before streaming begins (where applicable). | ||
|
|
||
| -- request -- | ||
| { | ||
| "messages": [ | ||
| { | ||
| "role": "user", | ||
| "content": "how many angels can dance on the head of a pin\n" | ||
| } | ||
| ], | ||
| "model": "gpt-4.1", | ||
| "stream": true | ||
| } | ||
|
|
||
| -- streaming -- | ||
| HTTP/2.0 400 Bad Request | ||
| Content-Length: 281 | ||
| Content-Type: application/json | ||
|
|
||
| { | ||
| "error": { | ||
| "message": "Input tokens exceed the configured limit of 272000 tokens. Your messages resulted in 3148588 tokens. Please reduce the length of the messages.", | ||
| "type": "invalid_request_error", | ||
| "param": "messages", | ||
| "code": "context_length_exceeded" | ||
| } | ||
| } | ||
|
|
||
|
|
||
| -- non-streaming -- | ||
| HTTP/2.0 400 Bad Request | ||
| Content-Length: 281 | ||
| Content-Type: application/json | ||
|
|
||
| { | ||
| "error": { | ||
| "message": "Input tokens exceed the configured limit of 272000 tokens. Your messages resulted in 3148588 tokens. Please reduce the length of the messages.", | ||
| "type": "invalid_request_error", | ||
| "param": "messages", | ||
| "code": "context_length_exceeded" | ||
| } | ||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.