6#ifndef YARP_LLAMA2DEVICE_H
7#define YARP_LLAMA2DEVICE_H
50 yarp::dev::ReturnValue
ask(const
std::
string &question,
yarp::dev::LLM_Message &oAnswer) override;
62 bool open(
yarp::os::Searchable& config) override;
63 bool close() override;
66 void convAdd(
std::vector<
yarp::dev::LLM_Message>& conversation, const
std::
string& type, const
std::
string& content);
69 std::vector<llama_token> tokens_list;
70 std::
string model_path;
73 llama_model_params model_params;
74 std::vector<common_chat_msg> chat_msgs;
75 std::
string conversation;
76 std::
string model_question;
77 std::
string ask_question;
78 bool prompt_set = false;
79 bool first_prompt_set = false;
80 bool initialized = false;
81 std::vector<
yarp::dev::LLM_Message> m_conversation;
82 yarp::dev::LLM_Message m_prompt;
This class is the parameters parser for class Llama2Device.
Llama2Device(const Llama2Device &)=delete
yarp::dev::ReturnValue refreshConversation() noexcept override
Refresh the conversation.
yarp::dev::ReturnValue ask(const std::string &question, yarp::dev::LLM_Message &oAnswer) override
Performs a question.
bool close() override
Close the DeviceDriver.
yarp::dev::ReturnValue init_LLM(const std::string &model_path)
void convAdd(std::vector< yarp::dev::LLM_Message > &conversation, const std::string &type, const std::string &content)
yarp::dev::ReturnValue readPrompt(std::string &oPrompt) override
Retrieves the provided prompt.
yarp::dev::ReturnValue setPrompt(const std::string &prompt) override
Performs a question.
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
yarp::dev::ReturnValue getConversation(std::vector< yarp::dev::LLM_Message > &oConversation) override
Retrieves the whole conversation.
Llama2Device(Llama2Device &&) noexcept=delete
yarp::dev::ReturnValue deleteConversation() noexcept override
Delete the conversation and clear the system context from any internally stored context.
Interface implemented by all device drivers.
The main, catch-all namespace for YARP.