Closed persianopencart closed 10 months ago
Hey @persianopencart ,
I did test it with other languages and I found google-generativeai
package (Google's SDK) at fault.
I will continously check, if they have solved the issue or for other workarounds.
I might be wrong, waiting for others to answer on this!
@persianopencart
Please confirm if this is the same error you got
@rabilrbl I'm receiving an error in my bot's response: "Some index error occurred" when I input the following command to the bot: arabic command sample: "طباعة مساحة المثلث" I haven't reviewed the server logs yet; however, you may execute the command and examine the logs on your end.
@rabilrbl for better test try this command: وصف خوارزمية فيبوناتشي باللغة العربية:
this is the server log: docker logs --tail 100 0118672bd849 No error handlers are registered, logging exception. google.generativeai.types.generation_types.StopCandidateException: finish_reason : OTHER index: 0 safety_ratings { category: HARM_CATEGORY_SEXUALLY_EXPLICIT probability: NEGLIGIBLE } safety_ratings { category: HARM_CATEGORY_HATE_SPEECH probability: NEGLIGIBLE } safety_ratings { category: HARM_CATEGORY_HARASSMENT probability: NEGLIGIBLE } safety_ratings { category: HARM_CATEGORY_DANGEROUS_CONTENT probability: NEGLIGIBLE }
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/telegram/ext/_application.py", l ine 1234, in process_update
await coroutine
File "/usr/local/lib/python3.11/site-packages/telegram/ext/_basehandler.py", l ine 157, in handle_update
return await self.callback(update, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/gemini_pro_bot/handlers.py", line 75, in handle_message
response = await chat.send_message_async(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/google/generativeai/generative_m odels.py", line 395, in send_message_async
history = self.history[:]
^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/google/generativeai/generative_m odels.py", line 464, in history
raise generation_types.BrokenResponseError(
google.generativeai.types.generation_types.BrokenResponseError: Can not build a coherent char history after a broken streaming response (See the previous Except ion fro details). To inspect the last response object, use chat.last
.To remove the last request/response Content
objects from the chat call last_send, last _received = chat.rewind()
and continue without it.
@persianopencart
Please confirm if this is the same error you got
docker logs --tail 100 4cb6e74a63e6
No error handlers are registered, logging exception.
Traceback (most recent call last):
File "/app/gemini_pro_bot/handlers.py", line 96, in handle_message
if chunk.text:
^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/google/generativeai/types/generation_types.py", line 328, in text
raise ValueError(
ValueError: The response.text
quick accessor only works for simple (single-Part
) text responses. This response is not simple text.Use the result.parts
accessor or the full result.candidates[index].content.parts
lookup instead.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/telegram/ext/_application.py", line 1234, in process_update
await coroutine
File "/usr/local/lib/python3.11/site-packages/telegram/ext/_basehandler.py", line 157, in handle_update
return await self.callback(update, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/gemini_pro_bot/handlers.py", line 123, in handle_message
if chunk.text:
^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/google/generativeai/types/generation_types.py", line 328, in text
raise ValueError(
ValueError: The response.text
quick accessor only works for simple (single-Part
) text responses. This response is not simple text.Use the result.parts
accessor or the full result.candidates[index].content.parts
lookup instead.
@persianopencart The index error is a known issue on Google AI SDK. There is already an issue filed in their repo.
@rabilrbl Hello, I have been informed that the issue has been resolved.
@persianopencart Thanks for the info.
Waiting for their new release
When I request that Gemini bot compose in languages such as Arabic, it crashes. Error: Some index error occurred. This response is not supported.