Closed codylittle closed 1 month ago
Hey @codylittle -- thanks for sharing. That's indeed a bug. I have fixed it and released a new version. Enjoy!
Hey @timoklimmer, thanks for looking at it so quickly, unfortunately this hasn't resolved the issue. I should've been a bit more specific within my issue. I wasn't referring explicitly to non existent deployments, but instead any AOAI returned error.
The error itself occurs when trying to read the response body before reading it on L329 when trying to read the contents of the response before reading the request.
# got http code other than 200
if aoai_response.status_code != 200:
+ # read the response body in case it's a stream
+ await aoai_response.aread()
+
# print infos to console
print(
Is how we've resolved this in our private fork, our testing shows that it's successfully resolved the issue. Apologies for not submitting a PR, unsure if you'd like a test to go along with it, and haven't written one for this customization in our org yet.
Ah ok, I see. Seems like this needs another fix. How about non-streaming requests? Would your suggestion work for those, too?
From our testing, no exceptions are thrown, nor any noticeable degradation in performance
We've decided to change to the below, as to not be run on non-streaming requests.
# got http code other than 200
if aoai_response.status_code != 200:
+ # read the response body in case it's a stream
+ if not routing_slip["is_non_streaming_response_requested"]:
+ await aoai_response.aread()
+
# print infos to console
print(
@codylittle Thank you for your suggestion -- I have adopted it and will have it in the next release.
The next release has been released yesterday, including this fix 🎉
PowerProxy returns "Internal Server Error" when the AOAI endpoint errors.
An easy to replicate example of this is to request a deployment that doesn't exist.
POST: /openai/deployments/**notreal**/chat/completions?api-version=2023-07-01-preview
Expected:
Content-Type: application/json
Returned:
Content-Type: text/plain; charset=utf-8
Stack trace