Open Jianhong-user opened 7 months ago
Verify Network Configuration:
ping
or traceroute
to check if the address 142.251.42.234:443
(the IP from the error) is reachable from your environment.Retry with Exponential Backoff:
Increase Timeout Settings:
Check API Quotas and Limits
Description of the bug:
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "D: \ Python environment \ Project \ Gemini API \ pythonProject . venv \ Lib \ site packages \ Google \ api_core \ retry \ retry_unary. py", line 144, in retry_target
Result=target()
^^^^^^^^
File "D: \ Python_environment \ Project \ Gemini-Api \ pythonProject . venv \ Lib \ site packages \ Google \ api_core \ time out. py", line 120, in func_with_time out
Return fun ( args, * kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "D: \ Python environment \ Project \ Gemini API \ pythonProject . venv \ Lib \ site packages \ Google \ api_core \ grpc_helpers. py", line 78, in error remopped_callable
Raise exceptions. from grpc_error (exc) from exc
Google. api_core. exceptions ServiceUnavailable: 503 failed to connect to all addresses; Last error: UNKNOWN: ipv4:142.251.42.234:443: TCP handshake shutdown
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "D: \ Python environment \ Project \ Gemini-Api \ pythonProject \ Refactoring \ 1. py", line 18, in
"I plan to go to Japan and have always wanted to see cherry blossoms there."
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D: \ Python environment \ Project \ Gemini-Api \ pythonProject . venv \ Lib \ site packages \ Google \ generateai \ generative_models. py", line 426, in send_message
Response=self. model. generate.content(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D: \ Python environment \ Project \ Gemini-Api \ pythonProject . venv \ Lib \ site packages \ Google \ generateai \ generative_models. py", line 232, in generate.content
Response=self_ Client.generate_content(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D: \ Python environment \ Project \ Gemini API \ pythonProject . venv \ Lib \ site packages \ Google \ ai \ generativelanguage_v1beta \ services \ generative_service \ client. py", line 566, in generate.content
Response=rpc(
^^^^
File "D: \ Python environment \ Project \ Gemini-Api \ pythonProject . venv \ Lib \ site packages \ Google \ api_core \ gapic_v1 \ method. py", line 131, in call
Return wrapped_fun ( args, * kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D: \ Python environment \ Project \ Gemini API \ pythonProject . venv \ Lib \ site packages \ Google \ api_core \ retry \ retry_unary. py", line 293, in retry_wrapped_fun
Return retry_target(
^^^^^^^^^^^^^
File "D: \ Python environment \ Project \ Gemini API \ pythonProject . venv \ Lib \ site packages \ Google \ api_core \ retry \ retry_unary. py", line 153, in retry_target
_Retryerror helper(
File "D: \ Python environment \ Project \ Gemini API \ pythonProject . venv \ Lib \ site packages \ Google \ api_core \ retry \ retry_base. py", line 221, in _retry_error_helper
Raise final_exc from source_exc
Google. api_core. exceptions RetryError: timeout of 60.0s exceeded, last exception: 503 failed to connect to all addresses
Actual vs expected behavior:
No response
Any other information you'd like to share?
No response