jekalmin / extended_openai_conversation

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

No context when used with Wyoming satellite #124

Open Edmundas1 opened 7 months ago

Edmundas1 commented 7 months ago

When I'm using HA assist pipeline with extended_openai_conversation through Wyoming satellite devices there is no context passed to openai API, I've looked into logs and each request is like completely new request. When I'm using assist chat through HA web interface with the same pipeline, everything works fine.

LowKey88 commented 7 months ago

Yes, i'm aware of this also. @jekalmin any thought about this?

jekalmin commented 7 months ago

Thanks for reporting an issue!

In order to use same message history, conversation_id should be passed to ConversationAgent. It seems Wyoming satellite devices don't pass conversation_id after first conversation.

In my opinion, it's Wyoming satellite devices' responsibility to pass conversation_id because HA web and Esphome devices (m5stack atom echo and esp32-s3-box) have implemented this.

To dig deeper, please add following code in this line and see if conversation_id is None.

print("user_input", user_input, "context", user_input.context.as_dict())

Ideally, conversation_id should be None on the first time, and not None starting from second request.

LowKey88 commented 7 months ago

OK, it's confirmed, the conversation_id is not passed and conversation_id = None all the time of request using Wyoming Satellite

- `user_input: ConversationInput(text='xxx', context=<...>, conversation_id=None, device_id='...', language='*'), context: {'id': '...', 'parent_id': None, 'user_id': None}`
- `user_input: ConversationInput(text='xxx.', context=<...>, conversation_id=None, device_id='...', language='*'), context: {'id': '...', 'parent_id': None, 'user_id': None}`
Edmundas1 commented 7 months ago

Thank you jekalmin and LowKey88, hopefully it'll be fixed at wyoming-satellite or maybe I will switch to ESPHome, though local wake word detection is a plus for Wyoming satellite.

guinmoon commented 1 month ago

Hi I found a solution that works for me. Now when I use wyoming satellite from docker extended_openai_conversation remembers what we talked about before.