<@U084APK40NS> I get this error when trying to use...
# ask-ai
c
@millions-hair-24956 I get this error when trying to use Gemini APIs. I get the same error when I use the google cloud vertex or gemini APIs. Traceback (most recent call last): File "/opt/anaconda3/lib/python3.11/site-packages/livekit/agents/llm/llm.py", line 154, in _main_task return await self._run() ^^^^^^^^^^^^^^^^^ File "/opt/anaconda3/lib/python3.11/site-packages/livekit/plugins/google/llm.py", line 352, in _run raise APIConnectionError( livekit.agents._exceptions.APIConnectionError: gemini llm: error generating content WARNINGlivekit.agentsfailed to generate LLM completion, retrying in 5.0s Traceback (most recent call last): File "/opt/anaconda3/lib/python3.11/site-packages/livekit/plugins/google/llm.py", line 281, in _run async for response in self._client.aio.models.generate_content_stream( File "/opt/anaconda3/lib/python3.11/site-packages/google/genai/models.py", line 4659, in generate_content_stream request_dict = _GenerateContentParameters_to_vertex( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/anaconda3/lib/python3.11/site-packages/google/genai/models.py", line 1115, in _GenerateContentParameters_to_vertex for item in t.t_contents( ^^^^^^^^^^^^^ File "/opt/anaconda3/lib/python3.11/site-packages/google/genai/_transformers.py", line 278, in t_contents raise ValueError('contents are required.') ValueError: contents are required.
g
It seems likely that the error you're encountering is related to missing or improperly formatted content parameters when using the Gemini or Google Cloud Vertex APIs. The error message "ValueError: contents are required" suggests that the API call is missing necessary content data, which is required for generating content with these models. To address this, you should ensure that the content parameters are correctly specified in your API request. This involves checking that all required fields are populated and formatted according to the API's specifications. If you're using a specific function or method to generate content, verify that all arguments, especially those related to content, are correctly provided. Would you like more detailed guidance on how to structure your API requests or troubleshoot this issue further? Sources: - https://livekit-users.slack.com/archives/C07FY8WHGPM/p1732345136.594869 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.