RestBaseClass.
More...
#include <rest_base_class.hpp>
|
| Poco::JSON::Object::Ptr | process (Poco::JSON::Object &body_json, std::string &uri) |
| | Process the HTTP request and return the response as a JSON object.
|
| |
| virtual const Poco::JSON::Object | handle_options (std::vector< prompt::PromptOption > &options) |
| | Process options from the prompt request.
|
| |
| virtual void | initialize_base (rclcpp::Node::SharedPtr node, std::string plugin_name="BaseClass") |
| | Initialize the prompt base class.
|
| |
RestBaseClass.
This class implements a base class for RESTful prompt plugins. It provides a common interface for sending prompts and receiving responses
◆ RestBaseClass()
| prompt::RestBaseClass::RestBaseClass |
( |
| ) |
|
|
inline |
◆ ~RestBaseClass()
| virtual prompt::RestBaseClass::~RestBaseClass |
( |
| ) |
|
|
virtualdefault |
◆ extract_error_description()
| static std::string prompt::RestBaseClass::extract_error_description |
( |
const std::string & |
response_body | ) |
|
|
inlinestaticprotected |
◆ handle_options()
| virtual const Poco::JSON::Object prompt::RestBaseClass::handle_options |
( |
std::vector< prompt::PromptOption > & |
options | ) |
|
|
inlineprotectedvirtual |
Process options from the prompt request.
This method processes the options from the prompt request and returns a JSON object containing the options. It flattens the options into a JSON object, converting types based on the type hint provided in the option.
- Parameters
-
| prompt | The prompt request containing options to be processed |
◆ initialize_rest_base()
| virtual void prompt::RestBaseClass::initialize_rest_base |
( |
rclcpp::Node::SharedPtr |
node, |
|
|
std::string |
plugin_name = "RestBaseClass", |
|
|
std::string |
api_key_name = "" |
|
) |
| |
|
inlinevirtual |
Initialize the REST base class.
This method initializes the REST base class with parameters from the ROS parameter server.
- Parameters
-
| node | rclcpp::Node::SharedPtr ROS node |
| plugin_name | std::string Name of the plugin, used for parameter names |
| api_key_name | std::string Name of the API key parameter, if different from the default |
- Exceptions
-
◆ process()
| Poco::JSON::Object::Ptr prompt::RestBaseClass::process |
( |
Poco::JSON::Object & |
body_json, |
|
|
std::string & |
uri |
|
) |
| |
|
inlineprotected |
Process the HTTP request and return the response as a JSON object.
This method sends the HTTP request to the specified URI and returns the response as a Poco::JSON::Object::Ptr.
- Parameters
-
| body_json | The JSON object containing the request body. |
| uri | The URI to send the request to. |
- Returns
- Poco::JSON::Object::Ptr The JSON object containing the response.
- Exceptions
-
◆ api_key_
| std::string prompt::RestBaseClass::api_key_ |
|
protected |
◆ auth_type_
| std::string prompt::RestBaseClass::auth_type_ |
|
protected |
◆ method_
| std::string prompt::RestBaseClass::method_ |
|
protected |
◆ required_options_
Model options.
This is the model options used by the prompt provider by default in case model options are not provided in the request
◆ ssl_verify_
| bool prompt::RestBaseClass::ssl_verify_ |
|
protected |
The documentation for this class was generated from the following file: