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
# Initialize a Gemini model appropriate for your use case.model=genai.GenerativeModel('models/gemini-1.5-flash')
# Create the prompt.prompt="Please summarize the audio."# Load the samplesmall.mp3 file into a Python Blob object containing the audio# file's bytes and then pass the prompt and the audio to Gemini.response=model.generate_content([
prompt,
{
"mime_type": "audio/mp3",
"data": pathlib.Path('samplesmall.mp3').read_bytes()
}
])
# Output Gemini's response to the prompt and the inline audio.print(response.text)
Stack trace
Traceback (most recent call last):
File "/home/held/audio-arena/test.py", line 9, in <module>
for tok in stream((t[1], t[0])):
File "/home/held/audio-arena/src/speech_arena/streaming_helpers.py", line 44, in get_chat_response
for chunk in responses:
File "/opt/conda/lib/python3.10/site-packages/vertexai/generative_models/_generative_models.py", line 853, in _generate_content_streaming
request = self._prepare_request(
File "/opt/conda/lib/python3.10/site-packages/vertexai/generative_models/_generative_models.py", line 3201, in _prepare_request
request_v1beta1 = super()._prepare_request(
File "/opt/conda/lib/python3.10/site-packages/vertexai/generative_models/_generative_models.py", line 506, in _prepare_request
_validate_generate_content_parameters(
File "/opt/conda/lib/python3.10/site-packages/vertexai/generative_models/_generative_models.py", line 169, in _validate_generate_content_parameters
_validate_contents_type_as_valid_sequence(contents)
File "/opt/conda/lib/python3.10/site-packages/vertexai/generative_models/_generative_models.py", line 220, in _validate_contents_type_as_valid_sequence
raise TypeError(
TypeError: When passing a list with Content dict objects, every item in a list must be a Content dict object.
The text was updated successfully, but these errors were encountered:
Environment details
google-cloud-aiplatform
version: 1.71.1Steps to reproduce
https://ai.google.dev/gemini-api/docs/audio?lang=python#inline-data
Code example
Stack trace
The text was updated successfully, but these errors were encountered: