Welcome to Portkey Forum

Updated 3 weeks ago

Troubleshooting connection errors and quota issues

I've been facing an issue from the past few weeks where some of my requests end up in a connection error. But I see those requests in https://app.portkey.ai/organisation/org-uuid/logs

I see isQuotaExceeded : false in one of portkey's api calls.

Any suggestions?
R
S
M
7 comments
Here's the stack trace
Plain Text
  File "somefile.py", line 51, in somefunc
    return self.client.with_options(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rahul/someenv/lib/python3.12/site-packages/portkey_ai/api_resources/apis/chat_complete.py", line 110, in create
    return self.normal_create(
           ^^^^^^^^^^^^^^^^^^^
  File "/Users/rahul/someenv/lib/python3.12/site-packages/portkey_ai/api_resources/apis/chat_complete.py", line 75, in normal_create
    response = self.openai_client.with_raw_response.chat.completions.create(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rahul/someenv/lib/python3.12/site-packages/portkey_ai/_vendor/openai/_legacy_response.py", line 350, in wrapped
    return cast(LegacyAPIResponse[R], func(*args, **kwargs))
                                      ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rahul/someenv/lib/python3.12/site-packages/portkey_ai/_vendor/openai/_utils/_utils.py", line 274, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rahul/someenv/lib/python3.12/site-packages/portkey_ai/_vendor/openai/resources/chat/completions.py", line 650, in create
    return self._post(
           ^^^^^^^^^^^
  File "/Users/rahul/someenv/lib/python3.12/site-packages/portkey_ai/_vendor/openai/_base_client.py", line 1259, in post
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rahul/someenv/lib/python3.12/site-packages/portkey_ai/_vendor/openai/_base_client.py", line 936, in request
    return self._request(
           ^^^^^^^^^^^^^^
  File "/Users/rahul/someenv/lib/python3.12/site-packages/portkey_ai/_vendor/openai/_base_client.py", line 1006, in _request
    raise APIConnectionError(request=request) from err
openai.APIConnectionError: Connection error.
Did not understand this completely.
Are you saying you get an exception in your client, but you can see a successful log for the same request in the UI?
Yeah
Connection times out on client, but I can see the successful log on UI.
Haven't had time to check this in-depth, might be something specific to my env. Just wanted to know if you guys have seen this happening before.
no, I've not come across this before
if you think this is an issue with the portkey client, you can attach the relevant code snippets in this thread and we can take a look at it
Maybe you need to increase timeout on your http request?
Add a reply
Sign up and join the conversation on Discord