12 if(!m_conversation.empty())
14 yError() <<
"The conversation is already ongoing. You must first delete the whole conversation and start from scratch.";
24 for (
const auto &message : m_conversation)
26 if (message.type ==
"system")
28 oPrompt = message.content;
40 if(question ==
"function")
42 std::string function_name =
"FakeFunction";
43 std::vector<std::string> function_params = {
"arg1",
"arg2"};
44 std::vector<std::string> function_args = {
"yes",
"no"};
49 std::string answer_content =
"Fatti non foste per viver come bruti ma per seguir virtute e canoscenza";
53 m_conversation.push_back(answer);
60 oConversation = m_conversation;
66 m_conversation.clear();
72 std::string current_prompt;
76 yError() <<
"No prompt found in the conversation. Cannot refresh.";
84 yError() <<
"Failed to refresh the conversation.";
bool parseParams(const yarp::os::Searchable &config) override
Parse the DeviceDriver parameters.
bool refreshConversation() noexcept override
Refresh the conversation.
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
bool close() override
Close the DeviceDriver.
bool setPrompt(const std::string &prompt) override
Performs a question.
bool ask(const std::string &question, yarp::dev::LLM_Message &oAnswer) override
Performs a question.
bool deleteConversation() noexcept override
Delete the conversation and clear the system context from any internally stored context.
bool readPrompt(std::string &oPromp) override
Retrieves the provided prompt.
bool getConversation(std::vector< yarp::dev::LLM_Message > &oConversation) override
Retrieves the whole conversation.
A base class for nested structures that can be searched.