@@ -110,20 +110,20 @@ async def get_ai_completion_from_mito_server(
110
110
"Content-Type" : "application/json" ,
111
111
}
112
112
113
- # The HTTP client timesout after 20 seconds by default. We update this to match the timeout
114
- # we give to OpenAI. The OpenAI timeouts are denoted in seconds, wherease the HTTP client
115
- # expects milliseconds. We also give the HTTP client a 10 second buffer to account for
116
- # the time it takes to send the request, etc.
117
- http_client_timeout = timeout * 1000 * max_retries + 10000
118
113
119
- # If we are running in a test environment, we want a short timeout to prevent tests from hanging
120
- # for too long, but still give enough time for simple responses.
114
+
121
115
if is_running_test ():
122
- # Increase timeout specifically for CI environments to prevent kernel shutdown issues
123
- # CI environments tend to be slower and need more time to process requests
124
- http_client_timeout = 60000 # 60 seconds for CI tests
125
-
126
- http_client = AsyncHTTPClient (defaults = dict (user_agent = "Mito-AI client" ), request_timeout = http_client_timeout )
116
+ # If we are running in a test environment, setting the request_timeout fails for some reason.
117
+ http_client = AsyncHTTPClient (defaults = dict (user_agent = "Mito-AI client" ))
118
+ else :
119
+
120
+ # The HTTP client timesout after 20 seconds by default. We update this to match the timeout
121
+ # we give to OpenAI. The OpenAI timeouts are denoted in seconds, wherease the HTTP client
122
+ # expects milliseconds. We also give the HTTP client a 10 second buffer to account for
123
+ # the time it takes to send the request, etc.
124
+ http_client_timeout = timeout * 1000 * max_retries + 10000
125
+ http_client = AsyncHTTPClient (defaults = dict (user_agent = "Mito-AI client" ), request_timeout = http_client_timeout )
126
+
127
127
try :
128
128
res = await http_client .fetch (
129
129
# Important: DO NOT CHANGE MITO_AI_URL. If you want to use the dev endpoint,
0 commit comments