-
Notifications
You must be signed in to change notification settings - Fork 14.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TimeOutError unhandled #9509
Comments
🤖 Hello, Thank you for bringing this to our attention. It seems like you're encountering a timeout error when running the Currently, when an error occurs during the execution of a model in LangChain, the However, this mechanism does not specifically handle timeout errors. Your suggestion of implementing a retry mechanism or caching is a good one. We could potentially add a specific exception handling for timeout errors that would retry the operation a certain number of times before finally raising the error. As for the timeout setting for the Here's a potential workaround for now: you could try catching the import time
for i in range(5): # Retry up to 5 times
try:
query = "What did the president say about the Supreme Court"
docs = db.similarity_search(query)
chain.run(input_documents=docs, question=query)
break # If the operation is successful, break the loop
except ValueError as e:
if "time out" in str(e):
print(f"Timeout error occurred, retrying in {i+1} seconds...")
time.sleep(i+1) # Wait for i+1 seconds before retrying
else:
raise # If the error is not a timeout error, re-raise it This is just a temporary solution, and we'll look into improving the error handling in LangChain to better handle these kinds of situations. Thank you for your patience and for using LangChain. Best, SourcesThis response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
Hi, @moghadas76! I'm Dosu, and I'm helping the LangChain team manage their backlog. I wanted to let you know that we are marking this issue as stale. From what I understand, the issue you raised is about a Now, we would like to know if this issue is still relevant to the latest version of the LangChain repository. If it is, please let us know by commenting on this issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days. Thank you for your understanding and contribution to the LangChain project! Let us know if you have any further questions or concerns. |
System Info
`ValueError Traceback (most recent call last)
Cell In[35], line 3
1 query = "What did the president say about the Supreme Court"
2 docs = db.similarity_search(query)
----> 3 chain.run(input_documents=docs, question=query)
File ~/.local/lib/python3.10/site-packages/langchain/chains/base.py:480, in Chain.run(self, callbacks, tags, metadata, *args, **kwargs)
475 return self(args[0], callbacks=callbacks, tags=tags, metadata=metadata)[
476 _output_key
477 ]
479 if kwargs and not args:
--> 480 return self(kwargs, callbacks=callbacks, tags=tags, metadata=metadata)[
481 _output_key
482 ]
484 if not kwargs and not args:
485 raise ValueError(
486 "
run
supported with either positional arguments or keyword arguments,"487 " but none were provided."
488 )
File ~/.local/lib/python3.10/site-packages/langchain/chains/base.py:282, in Chain.call(self, inputs, return_only_outputs, callbacks, tags, metadata, include_run_info)
280 except (KeyboardInterrupt, Exception) as e:
281 run_manager.on_chain_error(e)
--> 282 raise e
...
113 if self.client.task == "text-generation":
114 # Text generation return includes the starter text.
115 text = response[0]["generated_text"][len(prompt) :]
ValueError: Error raised by inference API: Model google/flan-t5-xl time out`
This exception should be handled
Who can help?
No response
Information
Related Components
Reproduction
query = "What did the president say about the Supreme Court" docs = db.similarity_search(query) chain.run(input_documents=docs, question=query)
Expected behavior
Retry mechanism, or caching
The text was updated successfully, but these errors were encountered: