[voice] Update HLI interface for LLM implementations#5345
[voice] Update HLI interface for LLM implementations#5345GiviMAD wants to merge 1 commit intoopenhab:mainfrom
Conversation
|
Make sure to coordinate this work with openhab/openhab-webui#2995 and https://github.com/openhab/openhab-addons/tree/main/bundles/org.openhab.binding.chatgpt |
8cc11be to
a67444a
Compare
Signed-off-by: Miguel Álvarez <miguelwork92@gmail.com>
a67444a to
53ae92a
Compare
@rkoshak, thank you for the advice, yes I'm about to mention some people for them take a look and see if the changes makes sense to every body before going further, I just fixing some minor issues first. |
|
@florian-h05 , @Artur-Fedjukevits , @digitaldan would you be able to take a look at the changes proposed here when you have a moment? And also please ping other people that you know have been involved with the chatgpt binding or any other LLM interpreter that is available if any. I would like to know if you think this change makes sense in order to improve the interpreter LLM implementations or if you see some flaws on it before finalizing the PR. |
|
Hi! I'll take a look this week, thanks! |
WIP!
This PR add a new interpret method to the HumanLanguageInterpreter interface that instead of a string get an instance of InterpretationContext which contains a conversation with the previous messages and the last user request. It includes a default method implementation to prevent breaking current interpreters. The PR also introduces the interface for LLMTools.
Each conversation message have a role associated to it: USER, OPENHAB, THINKING, THINKING, TOOL_CALL, TOOL_RETURN. Messages can be written at once or part by part (methods addMessage and addToMessage of the Conversation instance) and they emit an event so the conversation changes can be listened on a dedicated topic (openhab/conversations/{conversation_id}).
The interpreter implementation will be called with a conversation its last message is the new text sent to interpret with the USER role and it has to add a new message to the conversation with the role OPENHAB as response. In the middle it can add messages with the THINKING/TOOL_CALL/TOOL_RETURN so someone listening to the events produced by the conversation can be aware that the interpreter is thinking or executing a tool.
The interpret rest API and console commands have been updated to allow passing a conversation id (a user defined id, a new conversation is created if not exists), and also tools ids and a location item id.
Also API and console command to view the conversation messages and delete them have been added.
Voice dialog processor have been updated also so a dialog can have a configured conversation and a set of tools.
TODO?: Add system prompt id to interpretation context and create a API/console to define the system prompts or let it for another PR?
Using the conversation in the console