Closed bent-verbiage closed 6 months ago
@bent-verbiage you will need to encode the base64_encoded_data in string before passing it to the Part. from_data(), for example: encoded_string = base64_encoded_data.decode('utf-8') ... audio_file = Part.from_data(encoded_string, "audio/mpeg")
Please try. Thanks.
Thanks @gericdong , that helped: it works now.
File Name
gemini/getting-started/intro_gemini_1_5_pro.ipynb
What happened?
The below is mentioned in the notebook for Gemini 1.5 Pro, but unfortunately all examples are for Google Cloud hosted files.
Please Note: The code below works for me when I use Part.from_uri, so authentication and everything is working, but fails with an InactiveRpcError (see log output) when used with a local file encoded to base64 and Part.from_data.
I did make sure that I'm on the latest version. I have also tried changing the mime_type to "audio/mp3" but wit the same results. Help?
Relevant log output
Code of Conduct