Michael Pariaszevski
Michael Pariaszevski

Reputation: 21

Resource_Exhausted Error When Trying to Use Google's New Multimodal Live API

I am relatively new to using Google's suite of products for AI inference. One of the more recent features I have been trying out is their Multimodal Live API using gemini-2.0-flash-exp. I have read over, almost, every piece of documentation to get the live API to work. It seems that the consensus is to use the following (all done in python 3.11.9). I am trying to achieve simple text to text generation before moving to video/video frame to text generation in real time. However, when I try to run the code, I receive the following error: ConnectionClosedError: received 1011 (internal error) Request trace id: 2f02bfds67892de45, [ORIGINAL ERROR] generic::resource_exhausted: RESOURCE_EXHAUSTED: Maximum concurrent se; then sent 1011 (internal error) Request trace id: 2f02bfds67892de45, [ORIGINAL ERROR] generic::resource_exhausted: RESOURCE_EXHAUSTED: Maximum concurrent se. I have checked to make sure that I have the correct API key and that all of my environment variables are set. However, the most interesting aspect of all of this is that this error is occurring upon the first time that I try to establish a connection to the live api websocket. Please keep in mind that I am new to this, any tips would be greatly appreciated.

client = genai.Client()

MODEL = "gemini-2.0-flash-exp"

config={
    "generation_config": {"response_modalities": ["TEXT"]}}

async with client.aio.live.connect(model=MODEL, config=config) as session:
  message = "Hello? Gemini are you there?"
  print("> ", message, "\n")
  await session.send(message, end_of_turn=True)

  turn = session.receive()
  async for chunk in turn:
    if chunk.text is not None:
      print(f'- {chunk.text}')``` 



Upvotes: 2

Views: 268

Answers (1)

gcamadi
gcamadi

Reputation: 1

I see your code is from this notebook. I tried it and it's working for me. The issue is most likely not your API key, but this ConnectionClosedError: received 1011 (internal error) - RESOURCE_EXHAUSTED error could mean that the maximum allowed limit for concurrent requests were reached for that period of time, causing the internal error. Typically, trying at another time should resolve the issue.

Upvotes: 0

Related Questions