You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The error occurs when "res = geminiClient.generate_content(conversation).text" is reached again in a recursive function call.
I expected it to work the same way it did over the function's first pass. How do i fix this?
Error/Bug Found:
Traceback (most recent call last):
File "C:\Users\eworo\DELTA\env\Lib\site-packages\google\api_core\grpc_helpers.py", line 79, in error_remapped_callable
return callable_(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\eworo\DELTA\env\Lib\site-packages\grpc\_channel.py", line 1160, in __call__
return _end_unary_response_blocking(state, call, False, None)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\eworo\DELTA\env\Lib\site-packages\grpc\_channel.py", line 1003, in _end_unary_response_blocking
raise _InactiveRpcError(state) # pytype: disable=not-instantiable
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.INTERNAL
details = "An internal error has occurred. Please retry or report in https://developers.generativeai.google/guide/troubleshooting"
debug_error_string = "UNKNOWN:Error received from peer ipv4:142.250.115.95:443 {created_time:"2023-12-15T04:18:34.1915935+00:00", grpc_status:13, grpc_message:"An internal error has occurred. Please retry or report in https://developers.generativeai.google/guide/troubleshooting"}"
>
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "c:\Users\eworo\DELTA\src\test.py", line 48, in <module>
infer(input("Q: "))
File "c:\Users\eworo\DELTA\src\test.py", line 45, in infer
infer("")
File "c:\Users\eworo\DELTA\src\test.py", line 40, in infer
res = geminiClient.generate_content(conversation).text
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\eworo\DELTA\env\Lib\site-packages\google\generativeai\generative_models.py", line 243, in generate_content
response = self._client.generate_content(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\eworo\DELTA\env\Lib\site-packages\google\ai\generativelanguage_v1beta\services\generative_service\client.py", line 566, in generate_content
response = rpc(
^^^^
File "C:\Users\eworo\DELTA\env\Lib\site-packages\google\api_core\gapic_v1\method.py", line 131, in __call__
return wrapped_func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\eworo\DELTA\env\Lib\site-packages\google\api_core\retry.py", line 372, in retry_wrapped_func
return retry_target(
^^^^^^^^^^^^^
File "C:\Users\eworo\DELTA\env\Lib\site-packages\google\api_core\retry.py", line 207, in retry_target
result = target()
^^^^^^^^
File "C:\Users\eworo\DELTA\env\Lib\site-packages\google\api_core\timeout.py", line 120, in func_with_timeout
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\eworo\DELTA\env\Lib\site-packages\google\api_core\grpc_helpers.py", line 81, in error_remapped_callable
raise exceptions.from_grpc_error(exc) from exc
google.api_core.exceptions.InternalServerError: 500 An internal error has occurred. Please retry or report in https://developers.generativeai.google/guide/troubleshooting
Any other information you'd like to share?
I was using the Gemini API.
Here is code to recreate the error:
import google.generativeai as genai
genai.configure(api_key="API_KEY")
geminiClient = genai.GenerativeModel(model_name="gemini-pro")
conversation = [{'role':'user','parts': [f"Hello!"]}, {'role':'model','parts': ["Hey there Anon!"]}]
def infer(query):
conversation.append({'role':'user','parts': [query]})
res = geminiClient.generate_content(conversation).text
print("A: " + res)
conversation.append({'role':'model','parts': [res]})
if res == "Y":
infer("")
while True:
infer(input("Q: "))
To attain the error, tell the model "only respond to me with "Y" until i say stop".
The text was updated successfully, but these errors were encountered:
Description of the bug:
The error occurs when "res = geminiClient.generate_content(conversation).text" is reached again in a recursive function call.
I expected it to work the same way it did over the function's first pass. How do i fix this?
Error/Bug Found:
Any other information you'd like to share?
I was using the Gemini API.
Here is code to recreate the error:
To attain the error, tell the model "only respond to me with "Y" until i say stop".
The text was updated successfully, but these errors were encountered: