-
Notifications
You must be signed in to change notification settings - Fork 270
'OpenAIEmbeddings' object has no attribute 'request_timeout #41
Comments
I am also facing same issue. |
how can we solve this problem? |
same with 0.0.169: Traceback (most recent call last): with 0.0.155 was everything fine. |
""" Modified the library file openai.py fixed the error for me""" import logging import numpy as np from langchain.embeddings.base import Embeddings logger = logging.getLogger(name) def _create_retry_decorator(embeddings: OpenAIEmbeddings) -> Callable[[Any], Any]:
def embed_with_retry(embeddings: OpenAIEmbeddings, **kwargs: Any) -> Any:
class OpenAIEmbeddings(BaseModel, Embeddings):
|
I was getting this error because I was trying to query from a vectorstore that I'd created using an earlier langchain version. I pickled the vectorstore object and unpickled it when I needed to retrieve documents from it. I think the problem is that the OpenAI embeddings I used to create the vectorstore are outdated now and don't support the same interface as OpenAI embeddings in more recent langchain versions, so I just had to recreate the vectorstore using the exact same code as I originally used. Re-running this allowed the stored embeddings to match the new langchain code and solved my problem. Hope that helps. |
You have saved my day! I have spent 2 days trying to fix this bug, until I read your post... |
THANK YOU!!! I was trying to solve it for hours but solution was to remove previous pkl files from Faiss |
I am doing the same thing - reusing pkl files and ran into this same issue when upgrading langchain. This fix worked great to rebuild pkl files. I guess for now, I need to avoid reusing pkl files and rebuild the pkl files each time. |
Can someone help on this issue please ? Facing this issue recently without any code change.
1683790196853 ERROR AttributeError("'OpenAIEmbeddings' object has no attribute 'request_timeout'")
Traceback (most recent call last):
File "/Users/swarna-10535/Library/Application Support/zcatalyst-cli-runtimes/python/zcatalyst_runtime_39/main.py", line 72, in customer_request_handler
FLAVOUR_HANDLER.invoke_handler()
File "/Users/swarna-10535/Library/Application Support/zcatalyst-cli-runtimes/python/zcatalyst_runtime_39/flavours/init.py", line 53, in invoke_handler
RET = CUSTOMER_CODE_ENTRYPOINT(*(self.__construct_function_parameters()))
File "/Users/swarna-10535/catalyst_work_dir/.build/functions/zoho_inventory_ai_function/main.py", line 516, in handler
docs = docsearch.similarity_search(req_data.get("question"))
File "/Users/swarna-10535/catalyst_work_dir/.build/functions/zoho_inventory_ai_function/langchain/vectorstores/faiss.py", line 226, in similarity_search
docs_and_scores = self.similarity_search_with_score(query, k)
File "/Users/swarna-10535/catalyst_work_dir/.build/functions/zoho_inventory_ai_function/langchain/vectorstores/faiss.py", line 195, in similarity_search_with_score
embedding = self.embedding_function(query)
File "/Users/swarna-10535/catalyst_work_dir/.build/functions/zoho_inventory_ai_function/langchain/embeddings/openai.py", line 286, in embed_query
embedding = self._embedding_func(text, engine=self.deployment)
File "/Users/swarna-10535/catalyst_work_dir/.build/functions/zoho_inventory_ai_function/langchain/embeddings/openai.py", line 257, in _embedding_func
self, input=[text], engine=engine, request_timeout=self.request_timeout
AttributeError: 'OpenAIEmbeddings' object has no attribute 'request_timeout'
The text was updated successfully, but these errors were encountered: