You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The wyoming.asr.Transcript object takes a context parameter, but it does not end up serialized in to the Event, or deserialized on the other side, so the data is lost in the Wyoming communication layer.
Expected Behavior
The context passed to the Transcript constructor should end up transmitted to the server and available for use.
Note: I notice that the Transcribe object appears to have the same issue, although I'm not using that part of the code so I'm less confident about its intentions.
Relevant code:
@dataclassclassTranscript(Eventable):
"""Transcription response from ASR system"""text: str"""Text transcription of spoken audio"""context: Optional[Dict[str, Any]] =None# <------ The context object is available at construction"""Context for next interaction."""@staticmethoddefis_type(event_type: str) ->bool:
returnevent_type==_TRANSCRIPT_TYPEdefevent(self) ->Event:
returnEvent(type=_TRANSCRIPT_TYPE, data={"text": self.text}) # <------ The context dict is not serialized@staticmethoddeffrom_event(event: Event) ->"Transcript":
assertevent.dataisnotNonereturnTranscript(text=event.data["text"]) # <-------- The context dict is not de-serialized
Side note for HA:
It would be great if Home Assistant would use this object to provide other important context for handling the intent. Right now it adds a conversation_id uuid, but the text "context" (previous conversational bits) as well as the device_id and agent_id would also be very valuable for providing more tailored intent handling.
Partially putting this here to validate that it's within the spirit of the Wyoming protocol to allow arbitrary data in the context dict, which could be implementation-specific, yeah?
The text was updated successfully, but these errors were encountered:
Thanks for bringing this up! Context ended up being unfinished since a workaround was found.
I definitely planned for context to contain arbitrary data, and to get copied between input/output events within each service.
I will get it finished here and then update it on the HA side 👍
Observation:
The
wyoming.asr.Transcript
object takes acontext
parameter, but it does not end up serialized in to the Event, or deserialized on the other side, so the data is lost in the Wyoming communication layer.Expected Behavior
The context passed to the Transcript constructor should end up transmitted to the server and available for use.
Note: I notice that the
Transcribe
object appears to have the same issue, although I'm not using that part of the code so I'm less confident about its intentions.Relevant code:
Side note for HA:
It would be great if Home Assistant would use this object to provide other important context for handling the intent. Right now it adds a conversation_id uuid, but the text "context" (previous conversational bits) as well as the device_id and agent_id would also be very valuable for providing more tailored intent handling.
Partially putting this here to validate that it's within the spirit of the Wyoming protocol to allow arbitrary data in the context dict, which could be implementation-specific, yeah?
The text was updated successfully, but these errors were encountered: