home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
69.65k stars 28.82k forks source link

ESP32-S3-Box-3 plays entire error message from Open AI #118913

Open reisueber opened 3 weeks ago

reisueber commented 3 weeks ago

The problem

I just tested the new AI feature. I noticed that if the voice input is incomplete and ChatGPT then throws an error, the entire error message is played via the ESP32-S3-Box-3. IMG_4604

What version of Home Assistant Core has the issue?

core-2024.6.0

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Open AI

Link to integration documentation on our website

No response

Diagnostics information

Sorry, I had a problem talking to OpenAI: Error code: 429 - {'error': {'message': 'Rate limit reached for gpt-4o in organization org-LR4Ni7ys7CRL1xunGpf19y7E on tokens per min (TPM): Limit 30000, Used 28121, Requested 8705. Please try again in 13.652s. Visit https://platform.openai.com/account/rate-limits to learn more.', 'type': 'tokens', 'param': None, 'code': 'rate_limit_exceeded'}}

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

ChristophCaina commented 2 weeks ago

same applies for Google Generative AI. TBH - I don't think, that there's a solution for this, because no one will probably know what different error messages might come from the different AI providers.

grafik

So, catching them, will nearly be impossible - and even if... there should still be some kind of way to show them to the user.,... or?

reisueber commented 2 weeks ago

In my case the whole json object was send. I think it could be possible to check if there are special characters or error numbers like 400 or 500 in the return string. Maybe it is easy possible to tell Open AI: don't return any error messages.