Skip to content

Commit

Permalink
Merge branch 'master' into fixgraphviz10
Browse files Browse the repository at this point in the history
  • Loading branch information
randaz81 authored Aug 5, 2024
2 parents ddfa696 + 2fd8e69 commit 5ec7f5f
Show file tree
Hide file tree
Showing 14 changed files with 336 additions and 6 deletions.
8 changes: 7 additions & 1 deletion doc/release/master.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ Fixes
* Fixed compilation of portmonitor carrier when a custom non-system swig is used
* Fixed compatibility with ffmpeg 7 (https://github.com/robotology/yarp/pull/3109).
* Fixed compilation with graphviz 10 (https://github.com/robotology/yarp/pull/3115).
* Fix sending empty yarp::sig::Vector when building in Debug (https://github.com/robotology/yarp/pull/3123).

New Features
------------

* Added new command line tool `yarpDeviceParamParserGenerator`. See official yarp documentation (cmd_yarpDeviceParamParserGenerator.dox)

* Added LLM_Message data type to propagate LLM answers

#### Docker
* Added two parameters to yarp `Dockerfile`:
Expand All @@ -56,3 +56,9 @@ New Features

* Added new device `deviceBundler` which can be useful to open two devices and attach them while using a single yarpdev command line.
See https://github.com/robotology/yarp/discussions/3078

#### llmDevice

* Added LLM_Message data type to propagate LLM answers

* Added refreshConversation feature in the interface to allow users to restart the conversation mantaining the same prompt.
21 changes: 21 additions & 0 deletions src/devices/fake/fakeLLMDevice/FakeLLMDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,27 @@ bool FakeLLMDevice::deleteConversation() noexcept
return true;
}

bool FakeLLMDevice::refreshConversation() noexcept
{
std::string current_prompt;

if(!this->readPrompt(current_prompt))
{
yError() << "No prompt found in the conversation. Cannot refresh.";
return false;
}

this->deleteConversation();

if(!this->setPrompt(current_prompt))
{
yError() << "Failed to refresh the conversation.";
return false;
}

return true;
}

bool FakeLLMDevice::open(yarp::os::Searchable& config)
{
if (!this->parseParams(config)) {return false;}
Expand Down
1 change: 1 addition & 0 deletions src/devices/fake/fakeLLMDevice/FakeLLMDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class FakeLLMDevice : public yarp::dev::ILLM,
bool ask(const std::string &question, yarp::dev::LLM_Message &oAnswer) override;
bool getConversation(std::vector<yarp::dev::LLM_Message> &oConversation) override;
bool deleteConversation() noexcept override;
bool refreshConversation() noexcept override;

bool open(yarp::os::Searchable& config) override;
bool close() override;
Expand Down
1 change: 1 addition & 0 deletions src/devices/messages/ILLMMsgs/ILLMMsgs.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ service ILLMMsgs {
return_ask ask(1: string question);
return_getConversation getConversation();
bool deleteConversation();
bool refreshConversation();
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/devices/networkWrappers/LLM_nwc_yarp/LLM_nwc_yarp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,8 @@ bool LLM_nwc_yarp::deleteConversation()
{
return m_LLM_RPC.deleteConversation();
}

bool LLM_nwc_yarp::refreshConversation()
{
return m_LLM_RPC.refreshConversation();
}
1 change: 1 addition & 0 deletions src/devices/networkWrappers/LLM_nwc_yarp/LLM_nwc_yarp.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@ class LLM_nwc_yarp : public yarp::dev::DeviceDriver,
bool ask(const std::string& question, yarp::dev::LLM_Message& oAnswer) override;
bool getConversation(std::vector<yarp::dev::LLM_Message>& oConversation) override;
bool deleteConversation() override;
bool refreshConversation() override;
};
18 changes: 18 additions & 0 deletions src/devices/networkWrappers/LLM_nws_yarp/ILLMServerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ void ILLMRPCd::m_stream_conversation()
}

auto& bot = m_streaming_port.prepare();
bot.clear();
auto& list = bot.addList();
for (const auto& message : conversation) {
auto& message_bot = list.addList();
Expand Down Expand Up @@ -128,3 +129,20 @@ bool ILLMRPCd::deleteConversation()

return ret;
}

bool ILLMRPCd::refreshConversation()
{
bool ret = false;
if (m_iLlm == nullptr) {
yCError(LLMSERVER, "Invalid interface");
return false;
}

ret = m_iLlm->refreshConversation();

if (ret) {
m_stream_conversation();
}

return ret;
}
1 change: 1 addition & 0 deletions src/devices/networkWrappers/LLM_nws_yarp/ILLMServerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ class ILLMRPCd : public yarp::dev::llm::ILLMMsgs
yarp::dev::llm::return_ask ask(const std::string& question) override;
yarp::dev::llm::return_getConversation getConversation() override;
bool deleteConversation() override;
bool refreshConversation() override;
};
Loading

0 comments on commit 5ec7f5f

Please sign in to comment.