Responses from OpenAI / gpt are truncated

Hello :slight_smile:

I recently subscribe to openAI api and wanted to try some interaction with HA.
One strange thing that I noticed, is that often, answer from GPT are truncated.

Exemple of request

service: conversation.process
data:
  text: >-
    La température extérieure maximale pour aujourd'hui sera de {{
    state_attr("weather.forecast_auriol", "temperature") }}°C et l'humidité
    externe prévue pour aujourd'hui est de {{
    state_attr("weather.forecast_auriol", "humidity") }}%  Les prévisions pour
    le jour sont {{ states('weather.forecast_auriol') }}. Tu dois me faire un
    reporting méteo comme un professionel mais avec de l'humour. Le message ne
    doit pas dépasser 4096 caractères. Please answer in english
  agent_id: conversation.openai_conversation_2
response_variable: agent

(I ask for an answer in english so everyone here will notice the error, and it’s the same in french).

Response:

response:
  speech:
    plain:
      speech: >-
        Today's weather report is in, folks! 🌦️


        The maximum temperature for today is a cool 14.5°C, so grab your cozy
        sweaters and enjoy the fresh air! The humidity outside is at a moist
        75%, so maybe leave the hair straightener at home today.


        As for the sky, it seems like even the clouds want to join the party, as
        it's going to be a cloudy day. Don't worry, though, cloudy days are just
        nature's
      extra_data: null
  card: {}
  language: en
  response_type: action_done
  data:
    targets: []
    success: []
    failed: []
conversation_id: 01HZ7JE7Z34A033M7AR5ABQKMW

Clearly, there is something missing at the end “nature’s ???”

Another example :

      speech: >-
        Today's weather report is in, folks! The maximum temperature for today
        is a cool 14.5°C, so grab your favorite sweater and enjoy the fresh air.
        The humidity levels outside are at 75%, so it might feel a bit damp out
        there. As for the forecast, it's looking cloudy with a chance of
        daydreaming. So, whether you're singing in the rain or just enjoying a
        cozy day indoors, make sure to embrace the weather and have a fantastic
        day! Remember

Well … remember what ?

Configuration of the agent :

This smart home is controlled by Home Assistant.

The current time is {{ now().strftime("%X") }}.
Today's date is {{ now().strftime("%x") }}.


Keep your answers brief and do not apologize.
Answer the user's questions about the world truthfully.

If the user wants to control a device, reject the request and suggest using the Home Assistant app.

With gpt-3.5-turbo, Top P = 1 and temperature = 0.5.

Why is it truncated ? It looks looks HA is not waiting enough to collect all the response. Can I increase this ?

Increase your maximum tokens to return in response.

simple as that … thanks and sorry :cry:

No need to be sorry.