jekalmin / extended_openai_conversation

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

get_attributes function only pulls current day from weather.forecast_home #218

Closed pop-vapor closed 1 month ago

pop-vapor commented 1 month ago

My get_attributes function:

## Get Entity Attributes
- spec:
    name: get_attributes
    description: Get attributes of any home assistant entity
    parameters:
      type: object
      properties:
        entity_id:
          type: string
          description: entity_id
      required:
      - entity_id
  function:
    type: template
    value_template: "{{states[entity_id]}}"

If I ask the assistant to get me the weather for today, it usually works. If I ask it for tomorrow's forecast in the same conversation, it's unable to comply: image

If I start a conversation asking for tomorrow's weather, it'll give me todays: image

I originally thought that the issue was the assistant calling weather.get_forecast instead of weather.get_forecasts, but since I read bug reports for similar issues being fixed with the attribute search function, I'm wondering if my issue is similar.

Thanks!

pop-vapor commented 1 month ago

This was solved here https://github.com/jekalmin/extended_openai_conversation/issues/126#issuecomment-1946826733

The creator of this function discussed having issues with using it to grab hourly data from pirateweather, but it works perfectly with the default entity weather.forecast_home.

## Get Weather
- spec:
    name: get_weather_forecast
    description: get weather forecast
    parameters:
      type: object
      properties:
        type:
          type: string
          description: the type of forecast
          enum:
            - daily
            - hourly
      required:
      - type
  function:
    type: script
    sequence:
    - service: weather.get_forecasts
      data:
        type: "{{type}}"
      target:
        entity_id: weather.forecast_home
      response_variable: _function_result

image image