HTTP code 504 from API

In Question and Answer section, on calling the following code,

response = llm.call_as_llm(f"{qdocs} Question: Please list all your \
shirts with sun protection in a table in markdown and summarize each one.")

I get the following error as of August 1, 2023.

Retrying langchain.chat_models.openai.ChatOpenAI.completion_with_retry.<locals>._completion_with_retry in 1.0 seconds as it raised APIError: HTTP code 504 from API 504 Gateway Time-out

This is the same error as when calling LangChain Chat with Your Data - Document Loading when calling in [22]

YoutubeAudioLoader APIError: HTTP code 504 from API

I’ve tried this all all times of data. It used to say rate limit exceeded, now just HTTP 504 a lot.
Is there a recommended way to use our key, and if so what kind of charges can we expect?

Getting the same 504 Error, any solutions to this ?

Increase the value for request_timeout parameter, and then try again.
Please let me know if still face issue(s).

This is now happening further up in [7] VectorstoreIndexCreator.
As I understand it, request_timeout can be set in,

from langchain.chat_models import ChatOpenAI
openai = ChatOpenAI(model_name="gpt-3.5-turbo", request_timeout=8)

The model is opened in an external file or in some other way here, how can the request_timeout be increased here?

Thanks

You can always double-check OpenAI’s API status to see if there are larger problems: https://status.openai.com/

Looks like there were problems on 8/3 and 8/1, which might have caused those 504s

In your example code snippet
openai = ChatOpenAI(model_name=“gpt-3.5-turbo”, request_timeout=8)

you are instantiating a ChatOpenAI class object with the model name “gpt-3.5-turbo” and a request_timeout of 8 seconds.
This means that when you use this object to make API requests to the GPT-3.5 model, each request will have a maximum of 8 seconds to generate a response before it times out.

To increase the request_timeout, increase it according to your need.
i.e. request_timeout=60 or request_timeout=120

1 Like

Can you please send me your notebook.And let me know the cells that creates a problem.

1 Like

Yes, I read it from your suggestion and looked up where a timeout could be set.

The notebook is the same as each of the following ones, which all result in errors, 2 different courses. Here’s the first which is the one you askeda bout,

  1. LangChain for LLM Application Development: Question and Answer section, Cell [7]
index = VectorstoreIndexCreator(
    vectorstore_cls=DocArrayInMemorySearch
).from_loaders([loader])

Retrying langchain.embeddings.openai.embed_with_retry.._embed_with_retry in 4.0 seconds as it raised RateLimitError: exceeded quota for this month.

  1. LangChain Chat with Your Data: Document Loading section, Cell [11]
url="https://www.youtube.com/watch?v=jGwO_UgTS7I"
save_dir="docs/youtube/"
loader = GenericLoader(
    YoutubeAudioLoader([url],save_dir),
    OpenAIWhisperParser()
)
docs = loader.load()

Extensive error says the following at end: RateLimitError: exceeded quota for this month

Dear Robert,

Please check your plan and billing details. and let me know.

Girijesh,

I’d be interested to know what you and others are using: Local Jupyter Notebook with VSCode, PyCharm or Google Colab or something else? I’m on macOS.

I’ve been using the deeplearning.ai Notebooks as is so far. Not locally or on Google Colab where I can set OPENAI_API_KEY environment variable. That’s how these Short Courses started. Without the need of using our own key.

I’ve seen messages that the Coursera servers were down then up, but it’s not entirely clear here whether we are to download all local files and set an environment variable locally for or use something like Google Colab.

  1. I’ve noticed LangChain for LLM Application Development has a .csv file OutdoorClothingCatalog_1000.csv – it wasn’t possible to open files locally like a .csv file and save it now it is.

  2. LangChain Chat with Your Data is still on one page linking short courses but not on the Forums for discussion.

Again, I’d just be interested to know what you and others are using: Local Jupyter Notebook with VSCode, PyChart (I’m on macOS), or Google Colab or something else?

– Robert

I get the same error inspite of increasing the time out
Code
llm = ChatOpenAI(temperature = 0.0, request_timeout=120)

Output of

response = llm.call_as_llm(f"{qdocs} Question: Please list all your \
shirts with sun protection in a table in markdown and summarize each one.")

Retrying langchain.chat_models.openai.ChatOpenAI.completion_with_retry.._completion_with_retry in 1.0 seconds as it raised APIError: HTTP code 504 from API (

504 Gateway Time-out

504 Gateway Time-out

). Retrying langchain.chat_models.openai.ChatOpenAI.completion_with_retry.._completion_with_retry in 2.0 seconds as it raised APIError: HTTP code 504 from API ( 504 Gateway Time-out

504 Gateway Time-out

).
1 Like

Hello Sreedevi_Gattu,

  1. Are you using the online notebook where OPENAI_API_KEY is stored as local environment variable like in the first Notebook Models, Prompts and Parsers for this short course?

  2. If so, do you see the same rate limit error in that section, [12] get_completion("What is 1+1?")

  3. If not, are you using Google Collab like this article Fine Tuning Large Language Models with LangChain and using your own OPENAI_API_KEY as it discusses?

  4. Or are you using a local install and Jupyter Notebook and ChatGPT locally?

Just trying to complete these and move on.

Sincerely,
Robert D. Thompson

I’ve tried a bunch of different request_timeout values, but regardless get the same error doing the course in the embedded notebook (https://learn.deeplearning.ai/langchain/lesson/5/question-and-answer).