OpenAI ask me questions and execute my answer

Since after I integrated Extended OpenAI Conversation I was looking for a way to automate OpenAI asking me questions and executing my answer, as I haven’t found another solution in the forums, I am sharing mine.

I managed to find a way of doing it by using the awesome integration from AlexxIT StreamAssist that allow us to use any camera to activate assist.

With this integration you can select at what stage of the pipeline to start.

I created a script that start the pipeline from the intent and I pass the intent directly as ’ Ask me: “Do you want to turn on the mirror light ?”
Then I activate the pipeline once again starting from STT (Speach to text) so skipping the wakeword.
Both scripts are using the same conversation_id so that OpenAI will remember what it asked.

Example of a working script:

alias: OpenAI ask questions
sequence:
  - service: stream_assist.run
    data:
      camera_entity_id: camera.reolink_sala_1_sub
      player_entity_id: media_player.tablet
      stt_start_media: media-source://media_source/local/beep.mp3
      assist:
        start_stage: intent #Start the voice pipeline directly from the intent
        end_stage: tts
        intent_input: >-
          Ask me "Do you want to turn on the mirror's light?" #The intent provided is the question that OpenAI have to ask me
        conversation_id: 01HV8SNMZXEHKJYYR38GD2Y27G #Conversation_ID is fundamental to allow OpenAI to remember the question when I'll answer
  - delay: #Delay is required to give OpenAI the time to complete the question before starting the assistant again
      hours: 0
      minutes: 0
      seconds: 5
      milliseconds: 0
    enabled: true
  - service: stream_assist.run
    data:
      camera_entity_id: camera.reolink_sala_1_sub
      player_entity_id: media_player.tablet
      stt_start_media: media-source://media_source/local/beep.mp3
      assist:
        start_stage: stt #Now starting the pipeline from Speach To Text so I can answer
        end_stage: tts
        conversation_id: 01HV8SNMZXEHKJYYR38GD2Y27G
    enabled: true
mode: single

Probably there is a way to do sort of the same without Stream Assist.