Open uzpaka opened 1 month ago
Hi,
I am also experiencing the same issue. I would like to understand the standard behavior for setting retries. In the legacy ChatOpenAI class (langchain_community/chat_models/openai.py
) I see we have a retry decorator to automatically retry for the following errors: Timeout, APIError, APIConnectionError, RateLimitError, ServiceUnavailableError
I recently upgraded to use ChatOpenAI from langchain_openai
. I tried using with_retry
as follows:
llm = ChatOpenAI().with_retry(
retry_if_exception_type=(openai.APIError, TypeError),
wait_exponential_jitter=True,
stop_after_attempt=3,
)
However, I encounter issues when providing this LLM to create_tool_calling_agent
or ConversationSummaryBufferMemory
. I keep getting the same error:
Can't instantiate abstract class BaseLanguageModel with abstract methods agenerate_prompt, apredict, apredict_messages, generate_prompt, invoke, predict, predict_messages (type=type_error)
@baskaryan @eyurtsev Could you please take a look at this issue? Your help would be much appreciated!
Checked other resources
Example Code
Error Message and Stack Trace (if applicable)
Can't instantiate abstract class BaseLanguageModel with abstract methods agenerate_prompt, apredict, apredict_messages, generate_prompt, invoke, predict, predict_messages (type=type_error)
Description
I cannot use llm.with_retry() inside an sql agent. It works fine if I don't use .with_retry()
System Info
langchain==0.2.0 langchain-community==0.2.0 langchain-core==0.2.0 langchain-openai==0.1.7 langchain-text-splitters==0.2.0
MacOS
Python Version: 3.9.18