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.86k stars 28.96k forks source link

[OpenAI Conversation] Error code: 400 function.name string_above_max_length when script entity name is to long #121325

Open luzik opened 4 days ago

luzik commented 4 days ago

The problem

No custom prompt, just: Sorry, I had a problem talking to OpenAI: Error code: 400 - {'error': {'message': "Invalid 'tools[11].function.name': string too long. Expected a string with maximum length 64, but got a string with length 74 instead.", 'type': 'invalid_request_error', 'param': 'tools[11].function.name', 'code': 'string_above_max_length'}}

What version of Home Assistant Core has the issue?

core-2024.7.0

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

OpenAI Conversation

Link to integration documentation on our website

https://www.home-assistant.io/integrations/openai_conversation/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

N3m3515 commented 4 days ago

i also get that error with google gemini. Maybe has something to do with this: https://github.com/home-assistant/core/issues/121281 i get both errors

luzik commented 4 days ago

Maybe some script have to long entity name ?

N3m3515 commented 4 days ago

Maybe some script have to long entity name ?

YES! that was it!

But not for the other issue

EDIT: i disabled a script with a long name and after that it worked one time. but now the issue is back

This is the Error now: Logger: homeassistant.components.google_generative_ai_conversation Quelle: components/google_generative_ai_conversation/conversation.py:286 Integration: Google Generative AI (Dokumentation, Probleme) Erstmals aufgetreten: 20:52:08 (5 Vorkommnisse) Zuletzt protokolliert: 21:24:16

Error sending message: <class 'google.api_core.exceptions.InvalidArgument'> 400 Request contains an invalid argument.

luzik commented 4 days ago

This is other issue. In my case shortening script entity name fixed issue

N3m3515 commented 4 days ago

This is other issue. In my case shortening script entity name fixed issue

Yes i found it here: https://github.com/home-assistant/core/issues/120673