Welcome to Portkey Forum

Updated last week

Unexpected Error While Calling Portkey Gateway

Here is the full traceback:
Plain Text
2025-02-27 08:09:14.751
stream=stdout
2025-02-27 13:09:14.737 | ERROR | ai_core.llms.open_ai_wrapper:generate_text_response_async:436 | [Portkey Gateway] Unexpected error while calling Portkey Gateway with config pc-opeai-5393d5: 'ConnectTimeout' object has no attribute 'response'
2025-02-27 08:09:14.730
stream=stdout
AttributeError: 'ConnectTimeout' object has no attribute 'response'
2025-02-27 08:09:14.730
stream=stdout
β”” 1
2025-02-27 08:09:14.730
stream=stdout
β”‚ β””
2025-02-27 08:09:14.730
stream=stdout
β”‚ β”‚ β””
2025-02-27 08:09:14.730
stream=stdout
if remaining_retries > 0 and self._should_retry(err.response):
2025-02-27 08:09:14.730
stream=stdout
File "/app/.venv/lib/python3.12/site-packages/portkey_ai/_vendor/openai/_base_client.py", line 1601, in _request
2025-02-27 08:09:14.730
stream=stdout
β””
2025-02-27 08:09:14.730
stream=stdout
β”‚ β””
2025-02-27 08:09:14.730
stream=stdout
return await self._request(
2025-02-27 08:09:14.730
stream=stdout
File "/app/.venv/lib/python3.12/site-packages/portkey_ai/_vendor/openai/_base_client.py", line 1554, in request
2025-02-27 08:09:14.730
stream=stdout
β””
2025-02-27 08:09:14.730
stream=stdout
β”‚ β””
2025-02-27 08:09:14.730
stream=stdout
β”‚ β”‚ β””
2025-02-27 08:09:14.730
stream=stdout
β”‚ β”‚ β”‚ β”” FinalRequestOptions(method='post', url='/chat/completions', params={}, headers={'X-Stainless-Raw-Response': 'true'}, max_retr...
2025-02-27 08:09:14.730
stream=stdout
β”‚ β”‚ β”‚ β”‚ β”” False
2025-02-27 08:09:14.730
stream=stdout
β”‚ β”‚ β”‚ β”‚ β”‚ β”” openai.AsyncStream[portkey_ai._vendor.openai.types.chat.chat_completion_chunk.ChatCompletionChunk]
2025-02-27 08:09:14.730
stream=stdout
return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)
2025-02-27 08:09:14.730
stream=stdout
File "/app/.venv/lib/python3.12/site-packages/portkey_ai/_vendor/openai/_base_client.py", line 1860, in post
s
A
15 comments
Hey @Arya can jump on a quick 5 min call if required
Hey @Arya
@Chandeep | Portkey is making a change so that this error is not thrown after timeout
that said, I'm still surprised your code reaches this block because the default timeout in the SDK is 10 minutes
how are you doing concurrent requests?
that is super odd, the whole execution of the process is about 2 min. It has a bunch of concurrent request though
.. the client is being created per request
I'm still not sure why the SDK is throwing a httpx.TimeoutException, checking that
the rationale is that a client can use different config based on the workflow, so for the sake of simplicity I am taking the overhead of creating a new client. (Unless there is an option to pass config at request level)
PS: this was not an issue with using openai sdk directly before integrating portkey.
It's weird that you're getting a connectionTimeout, but you're getting a log, that should simply not be possible
I think the logs you're seeing and the requests that are erroring out are non overlapping
huh, may be its not the same request, just one of those other concurrent request within the same time window.
let me get the exact timestamps, on when i noticed this first
I think you are right the logs are for other requests in the same timewindow, so basically error happens in sdk and possibly never propogates to the gateway. So in gateway logs I saw no errors.
Add a reply
Sign up and join the conversation on Discord