Prompt Tools 0.3.2
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
prompt::BaseClass Class Referenceabstract

PromptProviderBase. More...

#include <base_class.hpp>

Inheritance diagram for prompt::BaseClass:
Inheritance graph
[legend]

Public Member Functions

 BaseClass ()=default
 
virtual ~BaseClass ()=default
 
virtual void initialize (rclcpp::Node::SharedPtr node)=0
 Initialize the prompt pligin.
 
virtual prompt::EmbedResponse get_embeddings (prompt::EmbedRequest &req)
 get_embeddings sends a text to an embedding provider using REST
 
virtual prompt::TokenResponse get_tokens (prompt::TokenRequest &req)
 get_tokens sends a text to a token provider
 
virtual prompt::PromptResponse sendPrompt (prompt::PromptRequest &req)
 Send a prompt to the prompt plugin.
 
virtual prompt::PromptResponse sendConversation (prompt::PromptRequest &latest_request, std::vector< PromptDialogue > &conversation)
 Send a prompt to the prompt plugin.
 

Protected Member Functions

virtual void initialize_base (rclcpp::Node::SharedPtr node, std::string plugin_name="BaseClass")
 Initialize the prompt base class.
 

Protected Attributes

rclcpp::Node::SharedPtr node_
 Node shared pointer.
 
std::string plugin_name_
 Plugin name.
 

Detailed Description

PromptProviderBase.

This is the base class for prompt plugins it provides a common interface for all prompt plugins where the main functions are to send a prompt and recieve a response

Constructor & Destructor Documentation

◆ BaseClass()

prompt::BaseClass::BaseClass ( )
default

◆ ~BaseClass()

virtual prompt::BaseClass::~BaseClass ( )
virtualdefault

Member Function Documentation

◆ get_embeddings()

virtual prompt::EmbedResponse prompt::BaseClass::get_embeddings ( prompt::EmbedRequest req)
inlinevirtual

get_embeddings sends a text to an embedding provider using REST

Parameters
reqThe embed request containing the text and options.
Returns
const EmbedResponse

Reimplemented in prompt::EmbedBaseClass.

◆ get_tokens()

virtual prompt::TokenResponse prompt::BaseClass::get_tokens ( prompt::TokenRequest req)
inlinevirtual

get_tokens sends a text to a token provider

Parameters
reqThe token request containing the text and options.
Returns
const TokenResponse

Reimplemented in prompt::TokenizeBaseClass.

◆ initialize()

virtual void prompt::BaseClass::initialize ( rclcpp::Node::SharedPtr  node)
pure virtual

Initialize the prompt pligin.

This method initializes the prompt plugin with parameters from the ROS parameter server.

Parameters
noderclcpp::Node::SharedPtr ROS node

Implemented in prompt::OllamaProvider, prompt::OpenAIEmbedding, prompt::OpenAIProvider, and prompt::OpenAITokenize.

◆ initialize_base()

virtual void prompt::BaseClass::initialize_base ( rclcpp::Node::SharedPtr  node,
std::string  plugin_name = "BaseClass" 
)
inlineprotectedvirtual

Initialize the prompt base class.

This method initializes the baseclass with parameters from the ROS parameter server.

Parameters
noderclcpp::Node::SharedPtr ROS node

◆ sendConversation()

virtual prompt::PromptResponse prompt::BaseClass::sendConversation ( prompt::PromptRequest latest_request,
std::vector< PromptDialogue > &  conversation 
)
inlinevirtual

Send a prompt to the prompt plugin.

This method sends a prompt request to the prompt plugin and returns a response.

Parameters
latest_requestThe prompt request containing the prompt and options.
conversationThe conversation history for context.
Returns
The response from the prompt provider.
Exceptions
prompt::PromptExceptionif the method is not implemented in the derived class.

Reimplemented in prompt::PromptBaseClass.

◆ sendPrompt()

virtual prompt::PromptResponse prompt::BaseClass::sendPrompt ( prompt::PromptRequest req)
inlinevirtual

Send a prompt to the prompt plugin.

This method sends a prompt request to the prompt plugin and returns a response.

Parameters
reqThe prompt request containing the prompt and options.
Returns
The response from the prompt provider.
Exceptions
prompt::PromptExceptionif the method is not implemented in the derived class.

Reimplemented in prompt::PromptBaseClass.

Member Data Documentation

◆ node_

rclcpp::Node::SharedPtr prompt::BaseClass::node_
protected

Node shared pointer.

This is the shared pointer to the ROS node used by the prompt plugin.

◆ plugin_name_

std::string prompt::BaseClass::plugin_name_
protected

Plugin name.

This is the name of the prompt plugin.


The documentation for this class was generated from the following file: