generative-ai-python
generative-ai-python copied to clipboard
Frequent 500 errors: error counting image token, media index[0] err: failed to decode base64 string: illegal base64 data at input byte 0 (request id: 2025101012300457216932209497692)', 'type': 'shell_api_error', 'param': '', 'code': 'count_token_failed'}
Description of the bug:
This problem frequently occurs when using Python 3.10 to call google-genai version 1.38.0. The image file encoding uses the following method with open(image_path, 'rb') as image_file: return base64.b64encode(image_file.read()).decode('utf-8')
The above files are specific return information
Actual vs expected behavior:
No response
Any other information you'd like to share?
No response
Description of the bug:
This problem frequently occurs when using Python 3.10 to call Google's version 1.38.0. The image file encoding uses the following method with open(image_path, 'rub') as image_file: return base64.encoded(image_file.read()).decode('outfit') codespaces-diagram.png error_info.txt
The above files are specific return information
Actual vs expected behavior:
No response
Any other information you'd like to share?
No response