6#ifndef YARP_GPTDevice_H
7#define YARP_GPTDevice_H
14#include <nlohmann/json.hpp>
17using json = nlohmann::json;
27 GPTDevice() : ILLM(), m_convo{
std::make_unique<liboai::Conversation>()},
29 m_functions{
std::make_unique<liboai::Functions>()},
47 yarp::dev::ReturnValue
ask(const
std::
string &question,
yarp::dev::LLM_Message &oAnswer) override;
56 bool open(
yarp::os::Searchable &config) override;
58 bool close() override;
62 std::unique_ptr<liboai::Conversation> m_convo;
63 std::
size_t m_convo_length;
69 std::unique_ptr<liboai::Functions> m_functions;
73 char *azure_deployment_id;
74 std::
string azure_api_version;
84 bool setFunctions(const
json& function_json);
yarp::dev::ReturnValue deleteConversation() noexcept override
Delete the conversation and clear the system context from any internally stored context.
yarp::dev::ReturnValue setPrompt(const std::string &prompt) override
Performs a question.
yarp::dev::ReturnValue getConversation(std::vector< yarp::dev::LLM_Message > &oConversation) override
Retrieves the whole conversation.
yarp::dev::ReturnValue refreshConversation() noexcept override
Refresh the conversation.
yarp::dev::ReturnValue readPrompt(std::string &oPrompt) override
Retrieves the provided prompt.
GPTDevice(GPTDevice &&) noexcept=delete
yarp::dev::ReturnValue ask(const std::string &question, yarp::dev::LLM_Message &oAnswer) override
Performs a question.
bool close() override
Close the DeviceDriver.
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
GPTDevice(const GPTDevice &)=delete
Interface implemented by all device drivers.
The main, catch-all namespace for YARP.