Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in call: function 'assistant <|recipient|> all' does not exist #268

Open
timkolloch opened this issue Nov 17, 2024 · 8 comments
Open

Comments

@timkolloch
Copy link

Hello!

I tried to set it up using a local LLM following this guide.

Connection is made successfully and I can see that my LLM is working.
Looking at the log below it seems like the LLM is delivering a expectable return value but the name of the function looks weird.

Maybe someone has already seen this problem.

Logs

2024-11-17 18:41:06.882 INFO (MainThread) [custom_components.extended_openai_conversation] Prompt for gpt-3.5-turbo-1106: [{'role': 'system', 'content': "I want you to act as smart home manager of Home Assistant.\nI will provide information of smart home along with a question, you will truthfully make correction or answer using information provided in one sentence in everyday language.\n\nCurrent Time: 2024-11-17 18:41:06.874053+01:00\n\nAvailable Devices:\n```csv\nentity_id,name,state,aliases\nscript.move_spotify_playback,Spotify: Transfer and start spotify playback,off,\nscript.spotify_play_playlist,Spotify: Play searched playlist in area,off,\nbinary_sensor.pv_generating,PV generating,unavailable,PV Anlage\nsensor.daily_consumed_energy,Heute verbrauchte Energie,unavailable,\nsensor.daily_pv_generation,Heutige PV Produktion,unavailable,\nsensor.daily_exported_energy_from_pv,Heute exportierte Energie,unavailable,\nsensor.daily_imported_energy,Heute importierte Energie,unavailable,\nswitch.pi_hole,Pi-Hole,on,\nlight.schrankwand,Schrankwand,on,\nlight.bildschirm_links,Bildschirm links,on,\nlight.bildschirm_unten,Bildschirm unten,on,\nlight.schreibtisch,Schreibtisch,on,\nlight.bildschirm_rechts,Bildschirm rechts,on,\nlight.bett,Bett,on,\nlight.lightstrip,Lightstrip,on,\nlight.deckenlampe,Deckenlampe,on,\nscene.deckenlampe_konzentrieren,Deckenlampe Konzentrieren,2024-08-11T15:21:57.143597+00:00,\nscene.deckenlampe_nachtlicht,Deckenlampe Nachtlicht,2024-11-17T00:12:00.714975+00:00,\nscene.tims_zimmer_nachtlicht,Tims Zimmer Nachtlicht,2024-11-05T22:30:21.388839+00:00,\nscene.deckenlampe_lesen,Deckenlampe Lesen,2024-11-17T15:25:43.220624+00:00,\nscene.tims_zimmer_konzentrieren,Tims Zimmer Konzentrieren,2024-10-27T11:45:54.830200+00:00,\nscene.tims_zimmer_lesen,Tims Zimmer Lesen,2024-11-17T12:20:25.118701+00:00,\nscene.bildschirm_nachtlicht,Bildschirm Nachtlicht,2024-09-13T20:14:47.997107+00:00,\nscene.deckenlampe_sonnenuntergang_savanne,Deckenlampe Sonnenuntergang Savanne,unknown,\nscene.bildschirm_lesen,Bildschirm Lesen,2024-10-17T19:34:31.094546+00:00,\nscene.deckenlampe_nordlichter,Deckenlampe Nordlichter,unknown,\nscene.bildschirm_konzentrieren,Bildschirm Konzentrieren,2024-07-17T15:45:31.630469+00:00,\nweather.forecast_rheda_wiedenbruck,Zuhause,cloudy,Rheda-Wiedenbrück\nlight.bildschirm,Bildschirm,on,\nbinary_sensor.window_tim_contact,Fenster Tim,off,Fenster Tim/Tims Fenster\nlight.fussleiste,Fußleiste,off,Fussleiste/Fußleister/Fuß leiste\nmedia_player.spotify_tim,Spotify tim,idle,\nclimate.heizung_tim,Heizung Tim,heat,\nmedia_player.this_device_2,This Device,standby,\nmedia_player.spotifyplus_tim,SpotifyPlus tim,paused,\nsensor.humidity_tim,Humidity Tim,56.20000076,\nsensor.co2_tim,CO2 Tim,1081,\nsensor.temperature_tim,Temperature Tim,21.5,Schlafzimmer Tim/Temperatur Tim\nmedia_player.sm_t970_snapcast_client_2,SM-T970 Snapcast Client,unavailable,\nmedia_player.sm_t970_snapcast_group_5,SM-T970 Snapcast Group,unavailable,\nmedia_player.snapweb_client_snapcast_group_2,Snapweb client Snapcast Group,unavailable,\nmedia_player.sm_t970_snapcast_group_6,SM-T970 Snapcast Group,unavailable,\nmedia_player.sm_t970_snapcast_group_7,SM-T970 Snapcast Group,unavailable,\nmedia_player.tim_linux_snapcast_group_2,tim-linux Snapcast Group,unavailable,\nmedia_player.tim_linux_snapcast_group_3,tim-linux Snapcast Group,idle,\nmedia_player.tim_linux,tim-linux,idle,\n```\n\nThe current state of devices is provided in available devices.\nUse execute_services function only for requested action, not for current states.\nDo not execute service without user's confirmation.\nDo not restate or appreciate what user says, rather make a quick inquiry."}, {'role': 'user', 'content': 'Turn off Deckenlampe'}]
2024-11-17 18:41:16.023 INFO (MainThread) [custom_components.extended_openai_conversation] Response {'id': 'chatcmpl-d471fb1a-20d5-4cbe-bbe8-f68a91cd6c21', 'choices': [{'finish_reason': 'tool_calls', 'index': 0, 'message': {'role': 'assistant', 'function_call': {'arguments': '{"domain": "light", "service": "turn_off"}', 'name': 'assistant\n<|recipient|> all'}, 'tool_calls': [{'id': 'call_sLGEPMjwbWVI31qE7QAMRl09', 'function': {'arguments': '{"domain": "light", "service": "turn_off"}', 'name': 'assistant\n<|recipient|> all'}, 'type': 'function'}]}}], 'created': 1731865275, 'model': 'gpt-3.5-turbo-1106', 'object': 'chat.completion', 'usage': {'completion_tokens': 1, 'prompt_tokens': 1737, 'total_tokens': 1738}}
2024-11-17 18:41:16.030 ERROR (MainThread) [custom_components.extended_openai_conversation] function 'assistant
<|recipient|> all' does not exist
Traceback (most recent call last):
  File "/config/custom_components/extended_openai_conversation/__init__.py", line 196, in async_process
    query_response = await self.query(user_input, messages, exposed_entities, 0)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/extended_openai_conversation/__init__.py", line 383, in query
    return await self.execute_tool_calls(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/extended_openai_conversation/__init__.py", line 468, in execute_tool_calls
    raise FunctionNotFound(function_name)
custom_components.extended_openai_conversation.exceptions.FunctionNotFound: function 'assistant
<|recipient|> all' does not exist

My functions in the Integration settings

- spec:
    name: execute_services
    description: Use this function to execute service of devices in Home Assistant.
    parameters:
      type: object
      properties:
        list:
          type: array
          items:
            type: object
            properties:
              domain:
                type: string
                description: The domain of the service
              service:
                type: string
                description: The service to be called
              service_data:
                type: object
                description: The service data object to indicate what to control.
                properties:
                  entity_id:
                    type: string
                    description: The entity_id retrieved from available devices. It must start with domain, followed by dot character.
                required:
                - entity_id
            required:
            - domain
            - service
            - service_data
  function:
    type: native
    name: execute_service
@KamilKeski
Copy link

KamilKeski commented Nov 17, 2024

May be a typo with your spec ref 'execute_services', when your function name is not plural "execute_service"? Thus the function is not found.

@timkolloch
Copy link
Author

timkolloch commented Nov 17, 2024

@KamilKeski

May be a typo with your spec ref 'execute_services', when your function name is not plural "execute_service"? Thus the function is not found.

I changed the name of the spec from execute_services to execute_service but sadly have the same error :(

@KamilKeski
Copy link

The error log indicates to me that you should have the function names as execute_services. "Use execute_services function only for requested action"

@timkolloch
Copy link
Author

@KamilKeski

The error log indicates to me that you should have the function names as execute_services. "Use execute_services function only for requested action"

Sadly no luck either it gives me the same error, even when I change the name of the function to execute_services

@KamilKeski
Copy link

kk. If you def changed and reloaded config I don't have any other leads.

@timkolloch
Copy link
Author

@KamilKeski

kk. If you def changed and reloaded config I don't have any other leads.

Okay, thank you for your time!

@mute2014
Copy link

hey there. sorry to bother. where can I add the functions in the integration? When I click on configuration i only see the instructions temp etc... but no functions below that.

@timkolloch
Copy link
Author

@mute2014

Screenshot_20241122_193536

That is weird, I just have it right under temperature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants