api/venv/lib/python3.10/site-packages/langchain/embeddings/openai.py", line 478, in embed_documents
return self._get_len_safe_embeddings(texts, engine=self.deployment)
api/venv/lib/python3.10/site-packages/langchain/embeddings/openai.py", line 364, in _get_len_safe_embeddings
response = embed_with_retry(
api/venv/lib/python3.10/site-packages/langchain/embeddings/openai.py", line 100, in embed_with_retry
retry_decorator = _create_retry_decorator(embeddings)
api/venv/lib/python3.10/site-packages/langchain/embeddings/openai.py", line 47, in _create_retry_decorator
retry_if_exception_type(openai.error.Timeout)
AttributeError: module ‘openai’ has no attribute ‘error’
If you are using the new client method myclient = OpenAI(), for handling errors, you still need to “import openai” to handle an error type “openai.error.Timeout”.
The code you have there is not adapted to the latest openai library.
You’ll need to pip install openai=0.28.1
to get the previous version.
Langchain will also need a pinned version before adaptations after November 6.
Warning: if you don’t know what you’re doing here, don’t set GPT-4 loose in langchain - that’s a surefire way to empty you account balance.