Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Error response on non-English languages #2

Closed
persianopencart opened this issue Dec 23, 2023 · 8 comments
Closed

Bug: Error response on non-English languages #2

persianopencart opened this issue Dec 23, 2023 · 8 comments
Labels
bug Something isn't working

Comments

@persianopencart
Copy link

persianopencart commented Dec 23, 2023

When I request that Gemini bot compose in languages such as Arabic, it crashes.
Error: Some index error occurred. This response is not supported.

@rabilrbl
Copy link
Owner

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!

@rabilrbl rabilrbl added the bug Something isn't working label Dec 24, 2023
@rabilrbl
Copy link
Owner

@persianopencart

Please confirm if this is the same error you got
image

@persianopencart
Copy link
Author

persianopencart commented Dec 24, 2023

@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.

@persianopencart
Copy link
Author

@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
Copy link
Author

persianopencart commented Dec 24, 2023

@persianopencart

Please confirm if this is the same error you got image

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.

@rabilrbl
Copy link
Owner

@persianopencart The index error is a known issue on Google AI SDK. There is already an issue filed in their repo.

google-gemini/generative-ai-python#113

@rabilrbl rabilrbl changed the title problem with other lang Big: Error response on non-English languages Dec 24, 2023
@rabilrbl rabilrbl changed the title Big: Error response on non-English languages Bug: Error response on non-English languages Dec 24, 2023
@persianopencart
Copy link
Author

@rabilrbl Hello, I have been informed that the issue has been resolved.

@rabilrbl
Copy link
Owner

@persianopencart Thanks for the info.

Waiting for their new release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants