Skip to main content

OpenAI request timeout?

Retrying langchain.chat_models.openai.ChatOpenAI.completion_with_retry.<locals>._completion_with_retry in 4.0 seconds as it raised ServiceUnavailableError: The server is overloaded or not ready yet..

Try increasing the timeout parameter.  For example, 

llm = ChatOpenAI(temperature=0, model_name=model)

Change to

llm = ChatOpenAI(temperature=0, model_name=model, request_timeout=120)

 

Related articles

Andrew Fletcher13 Feb 2025
Deploying a Python project from UAT to production using Git
When deploying a Python project from a User Acceptance Testing (UAT) environment to Production, it’s essential to ensure that all dependencies and configurations remain consistent. Particularly in our situation where this was going to be the first deployment of AI semantic search functionality to...
Andrew Fletcher19 Nov 2024
How to resolve issues with Python and virtual environments in pyenv
For developers working with Python, setting up and managing environments can sometimes lead to frustrating terminal errors. If you’ve encountered issues like the `python: command not found` error or struggled to create a virtual environment, this guide walks through resolving these common problems...