jekalmin / extended_openai_conversation

Home Assistant custom component of conversation agent. It uses OpenAI to control your devices.
834 stars 108 forks source link

user name (or function) with spaces fails #167

Open danielp370 opened 4 months ago

danielp370 commented 4 months ago

OpenAI does checks function parameters for ^[a-zA-Z0-9_-]{1,64}$. Unfortunately some integrations have spaces in their names. For examples, the Voice Over IP integration that can be used to talk directly to a HA Voice Assist via voip phones.

Error code: 400 - {'error': {'message': "'Voice over IP' does not match '^[a-zA-Z0-9_-]{1,64}$' - 'messages.1.name'", 'type': 'invalid_request_error', 'param': None, 'code': None}}

I have a patch https://github.com/jekalmin/extended_openai_conversation/pull/165 Validated that this fixes the issue and VoIP works nicely.

jekalmin commented 3 months ago

Thanks for reporting an issue.

As I commented in your PR, I was still concerning what to use in user's field because it has an issue when friendly_name is not in English (see https://github.com/jekalmin/extended_openai_conversation/issues/63).

Probably using user_id(state_attr('person.xxx', 'user_id') is a reasonable option.