30 std::vector<std::string> params;
31 params.push_back(
"api_version");
32 params.push_back(
"prompt_file");
33 params.push_back(
"prompt_context");
34 params.push_back(
"function_file");
35 params.push_back(
"json_context");
42 if (paramName ==
"api_version")
47 if (paramName ==
"prompt_file")
52 if (paramName ==
"prompt_context")
57 if (paramName ==
"function_file")
62 if (paramName ==
"json_context")
68 yError() <<
"parameter '" << paramName <<
"' was not found";
87 if (config.
check(
"help"))
96 if (config.
check(
"api_version"))
99 yCInfo(GPTDeviceParamsCOMPONENT) <<
"Parameter 'api_version' using value:" <<
m_api_version;
103 yCInfo(GPTDeviceParamsCOMPONENT) <<
"Parameter 'api_version' using DEFAULT value:" <<
m_api_version;
105 prop_check.
unput(
"api_version");
110 if (config.
check(
"prompt_file"))
113 yCInfo(GPTDeviceParamsCOMPONENT) <<
"Parameter 'prompt_file' using value:" <<
m_prompt_file;
117 yCInfo(GPTDeviceParamsCOMPONENT) <<
"Parameter 'prompt_file' using DEFAULT value:" <<
m_prompt_file;
119 prop_check.
unput(
"prompt_file");
124 if (config.
check(
"prompt_context"))
131 yCInfo(GPTDeviceParamsCOMPONENT) <<
"Parameter 'prompt_context' using DEFAULT value:" <<
m_prompt_context;
133 prop_check.
unput(
"prompt_context");
138 if (config.
check(
"function_file"))
145 yCInfo(GPTDeviceParamsCOMPONENT) <<
"Parameter 'function_file' using DEFAULT value:" <<
m_function_file;
147 prop_check.
unput(
"function_file");
152 if (config.
check(
"json_context"))
159 yCInfo(GPTDeviceParamsCOMPONENT) <<
"Parameter 'json_context' using DEFAULT value:" <<
m_json_context;
161 prop_check.
unput(
"json_context");
196 doc = doc + std::string(
"\n=============================================\n");
197 doc = doc + std::string(
"This is the help for device: GPTDevice\n");
198 doc = doc + std::string(
"\n");
199 doc = doc + std::string(
"This is the list of the parameters accepted by the device:\n");
200 doc = doc + std::string(
"'api_version': The openAI APIs version to use\n");
201 doc = doc + std::string(
"'prompt_file': The file containing the prompt for the LLM\n");
202 doc = doc + std::string(
"'prompt_context': The yarp context from which the prompt file should be loaded\n");
203 doc = doc + std::string(
"'function_file': The file containing the definitions of the tools for the LLM\n");
204 doc = doc + std::string(
"'json_context': The yarp context from which the function file should be loaded\n");
205 doc = doc + std::string(
"\n");
206 doc = doc + std::string(
"Here are some examples of invocation command with yarpdev, with all params:\n");
207 doc = doc +
" yarpdev --device GPTDevice --api_version 2023-07-01-preview --prompt_file <optional_value> --prompt_context GPTDevice --function_file <optional_value> --json_context GPTDevice\n";
208 doc = doc + std::string(
"Using only mandatory params:\n");
209 doc = doc +
" yarpdev --device GPTDevice\n";
210 doc = doc + std::string(
"=============================================\n\n");
return doc;
std::string m_function_file
std::string m_provided_configuration
bool parseParams(const yarp::os::Searchable &config) override
Parse the DeviceDriver parameters.
std::string m_api_version
std::string m_json_context
std::string m_prompt_context
std::vector< std::string > getListOfParams() const override
Return a list of all params used by the device.
std::string m_prompt_file
std::string getDocumentationOfDeviceParams() const override
Get the documentation of the DeviceDriver's parameters.
bool getParamValue(const std::string ¶mName, std::string ¶mValue) const override
Return the value (represented as a string) of the requested parameter.
std::string getConfiguration() const override
Return the configuration of the device.
A class for storing options and configuration information.
void unput(const std::string &key)
Remove the association from the given key to a value, if present.
A base class for nested structures that can be searched.
virtual bool check(const std::string &key) const =0
Check if there exists a property of the given name.
virtual std::string toString() const =0
Return a standard text representation of the content of the object.
virtual Value & find(const std::string &key) const =0
Gets a value corresponding to a given keyword.
#define yCInfo(component,...)
#define YARP_LOG_COMPONENT(name,...)