jekalmin / extended_openai_conversation

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

Feature Request - make functions optional #57

Closed Anto79-ops closed 9 months ago

Anto79-ops commented 9 months ago

Hey!

Would it be possible to make functions optional? For example, some models I use do not support functions and some partially do, and of course OpenAI does support it.

you mentioned this modification to the code that I could use here but then this would also break the OpenAI uses...which works really well, btw.

In the case where the model does not support functions, I would just like to use a the prompt and your integrations acts as a gateway to my localAI instance just acting as a conversation agent (or special prompt) without functions.

thanks

jekalmin commented 9 months ago

Thanks again for reporting an issue!

I will look into it in the next release. I'm quite not sure how to reset functions to default (currently erasing all functions will set it to default). However, making functions optional is needed as you mentioned.

Anto79-ops commented 9 months ago

thanks for being so responsive!

Yes, at the moment, blanking the functions text box (actually, I cannot leave it compleletely blank, I usually just put 1 space in the box), does work BUT it throws an core log error on every message it say:

Logger: custom_components.extended_openai_conversation
Source: custom_components/extended_openai_conversation/__init__.py:239
Integration: Extended OpenAI Conversation (documentation)
First occurred: November 26, 2023 at 7:58:41 PM (21 occurrences)
Last logged: 7:27:59 PM

Bad logger message: Failed to load functions ((TypeError("'NoneType' object is not subscriptable"),))

so if it can bypass the functions call when when functions are not needed, would be the best solution.

I'd be happy to try a beta if you wish.

Cheers

jekalmin commented 9 months ago

@Anto79-ops I released this in 0.0.10-beta2.

By setting Functions to [] like below, it will not pass functions parameter to openai

스크린샷 2023-12-24 오후 10 49 41

Please try this and give a feedback :D Thanks!

Anto79-ops commented 9 months ago

@jekalmin, thank you!

Just installed it and gave it a test, and it's working perfectly! No errors.

I can now use models that are not compatible with functions, alongside OpenAI!

:)

jekalmin commented 9 months ago

Thanks for a quick repsonse! I will let you know when it's released in stable version 0.0.10.

jekalmin commented 9 months ago

Closing the issue. Feel free to reopen it.