langchain_google_genai._common.GoogleGenerativeAIError: Error embedding content: 504 Deadline Exceeded
theripnono opened this issue · comments
Description of the bug:
I have the following error when :
gemini_embeddings = GoogleGenerativeAIEmbeddings(model="models/embedding-001",google_api_key=gapiket) vector = gemini_embeddings.embed_query("hello, world!")
I've read that the API doesn't work depending on the country. Could this be the problem?
**Exception has occurred: GoogleGenerativeAIError
Error embedding content: 504 Deadline Exceeded
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.DEADLINE_EXCEEDED
details = "Deadline Exceeded"
debug_error_string = "UNKNOWN:Error received from peer {created_time:"2024-05-31T10:56:34.7789233+00:00", grpc_status:4, grpc_message:"Deadline Exceeded"}"
>
During handling of the above exception, another exception occurred:
google.api_core.exceptions.DeadlineExceeded: 504 Deadline Exceeded
The above exception was the direct cause of the following exception:
File "C:\Users\drosset\Documents\intellicart\data\preprocess.py", line 28, in <module>
vector = gemini_embeddings.embed_query("hello, world!")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
langchain_google_genai._common.GoogleGenerativeAIError: Error embedding content: 504 Deadline Exceeded
Actual vs expected behavior:
No response
Any other information you'd like to share?
No response
i also face same error
Same error here:
`GoogleGenerativeAIError Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/langchain_google_genai/embeddings.py in embed_documents(self, texts, task_type, titles, output_dimensionality)
148 )
149 except Exception as e:
--> 150 raise GoogleGenerativeAIError(f"Error embedding content: {e}") from e
151 return [e.values for e in result.embeddings]
152
GoogleGenerativeAIError: Error embedding content: 504 Deadline Exceeded`
I was facing the same issue using langchain-google-genai
.
The solution was using langchain-google-genai==1.0.3
version.
Here's the full requirements I'm using:
google-ai-generativelanguage==0.6.2
google-api-core==2.19.0
google-api-python-client==2.128.0
google-auth==2.29.0
google-auth-httplib2==0.2.0
google-generativeai==0.5.2
googleapis-common-protos==1.63.0
langchain==0.1.17
langchain-community==0.0.37
langchain-core==0.1.52
langchain-google-genai==1.0.3
langchain-pinecone==0.1.0
langchain-text-splitters==0.0.1
Yes, you are correct. Downgrading langchain-google-genai
works for me now
I was facing the same issue using
langchain-google-genai
. The solution was usinglangchain-google-genai==1.0.3
version.Here's the full requirements I'm using:
google-ai-generativelanguage==0.6.2 google-api-core==2.19.0 google-api-python-client==2.128.0 google-auth==2.29.0 google-auth-httplib2==0.2.0 google-generativeai==0.5.2 googleapis-common-protos==1.63.0 langchain==0.1.17 langchain-community==0.0.37 langchain-core==0.1.52 langchain-google-genai==1.0.3 langchain-pinecone==0.1.0 langchain-text-splitters==0.0.1
Thank @bruna-calistrate !! donwgrading it works.
Maybe someone could have conflicts between langchain-google-gena and langchain-openai.
My requirements.txt had:
google-ai-generativelanguage==0.6.4
google-api-core==2.19.0
google-api-python-client==2.131.0
google-auth==2.29.0
google-auth-httplib2==0.2.0
google-generativeai==0.5.4
googleapis-common-protos==1.63.0
langchain==0.2.1
langchain-core==0.2.3
langchain-google-genai==1.0.3
langchain-openai==0.1.8
langchain-text-splitters==0.2.0