Skip to content

Improve Gemini Live API Cookbook #948

@Seburan

Description

@Seburan

Description of the bug:

Recommendations below are relevant to this Colab notebook : https://github.com/google-gemini/cookbook/blob/main/quickstarts/Get_started_LiveAPI.ipynb

  1. fix the Colab GOOGLE_API_KEY
from google.colab import userdata
import os

os.environ['GOOGLE_API_KEY'] = userdata.get('GOOGLE_API_KEY')

to

from google.colab import userdata
import os

GOOGLE_API_KEY = userdata.get('GOOGLE_API_KEY')
  1. The colab sample does not support gemini-2.5-flash-preview-native-audio-dialog .

when selecting

MODEL = "gemini-2.5-flash-preview-native-audio-dialog"

then the Text to Text sample run into an error

  1. the section Working with resumable sessions does not reuse the client and model defined at the beginning of the colab.

Actual vs expected behavior:

  1. actual behavior : the code below fails to execute. expected behavior : either use the GOOGLE_API_KEY var or remove the argument and use OS env.
client = genai.Client(api_key=GOOGLE_API_KEY)
  1. actual behavior : the code samples with TEXT modalities fail to execute when gemini-2.5-flash-preview-native-audio-dialog is selected. expected behavior : instruct the user that TEXT modalities is only supported by non-native audio model or update the native audio API to support TEXT modality.
config={
    "response_modalities": ["TEXT"]
}
  1. actual behavior : model & client variables are redefined. expected behavior : remove or comments the following lines from the section Working with resumable sessions > Helper functions:
MODEL =  "gemini-live-2.5-flash-preview"

client = genai.Client(api_key=GOOGLE_API_KEY)

Any other information you'd like to share?

No response

Metadata

Metadata

Assignees

Labels

AI generatedLooks like AI generated content

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions