PromptBridge.
More...
#include <prompt_bridge.hpp>
|
| | PromptBridge (const rclcpp::NodeOptions &options=rclcpp::NodeOptions()) |
| | Construct a new Prompt Bridge object.
|
| |
| void | initialize () |
| | Initialize the PromptBridge node.
|
| |
| | ~PromptBridge ()=default |
| |
| std::shared_ptr< prompt::BaseClass > | load_prompt_model (std::string family) |
| | Load a prompt model plugin based on the prompt family.
|
| |
| std::shared_ptr< prompt::BaseClass > | load_embedding_model (std::string family) |
| | Load an embedding model plugin based on the embedding family.
|
| |
| std::shared_ptr< prompt::BaseClass > | load_tokenizer_model (std::string family) |
| | Load a tokenizer model plugin based on the tokenizer family.
|
| |
| void | prompt_service_cb (const std::shared_ptr< PromptSrv::Request > req, std::shared_ptr< PromptSrv::Response > res) |
| | prompt service callback for instance prompts
|
| |
| void | embedding_service_cb (const std::shared_ptr< EmbeddingSrv::Request > req, std::shared_ptr< EmbeddingSrv::Response > res) |
| | embedding service callback for embedding requests
|
| |
| void | tokenize_service_cb (const std::shared_ptr< TokenizeSrv::Request > req, std::shared_ptr< TokenizeSrv::Response > res) |
| | tokenizer service callback for tokenization requests
|
| |
|
| static std::string | generate_uuid () |
| | Generate a UUID string for prompt tracking.
|
| |
|
| void | history_timer () |
| | Timer callback to publish prompt history at regular intervals.
|
| |
| void | update_prompt_history (prompt_msgs::msg::Prompt prompt, prompt_msgs::msg::PromptResponse response, rclcpp::Time prompt_time, rclcpp::Time response_time) |
| | Update the prompt history with a new prompt transaction.
|
| |
PromptBridge.
This class provides a bridge between ROS resources and the prompt provider and scheme It also provides a ROS action and service servers that can be used to send and receive prompts
◆ EmbeddingSrv
◆ PromptSrv
◆ TokenizeSrv
◆ PromptBridge()
| prompt::PromptBridge::PromptBridge |
( |
const rclcpp::NodeOptions & |
options = rclcpp::NodeOptions() | ) |
|
|
inline |
Construct a new Prompt Bridge object.
- Parameters
-
◆ ~PromptBridge()
| prompt::PromptBridge::~PromptBridge |
( |
| ) |
|
|
default |
◆ embedding_service_cb()
| void prompt::PromptBridge::embedding_service_cb |
( |
const std::shared_ptr< EmbeddingSrv::Request > |
req, |
|
|
std::shared_ptr< EmbeddingSrv::Response > |
res |
|
) |
| |
|
inline |
embedding service callback for embedding requests
This function is called when an embedding service request is received. It processes the embedding request using the embedding provider, and sends the response back to the client.
- Parameters
-
| req | the embedding service request. contains an embedding request message, which is processed by the embedding provider |
| res | the embedding service response. contains the processed embedding response. |
- Exceptions
-
◆ generate_uuid()
| static std::string prompt::PromptBridge::generate_uuid |
( |
| ) |
|
|
inlinestatic |
Generate a UUID string for prompt tracking.
◆ history_timer()
| void prompt::PromptBridge::history_timer |
( |
| ) |
|
|
inlineprivate |
Timer callback to publish prompt history at regular intervals.
◆ initialize()
| void prompt::PromptBridge::initialize |
( |
| ) |
|
|
inline |
Initialize the PromptBridge node.
This method initializes the PromptBridge node by declaring parameters and loading plugins.
◆ load_embedding_model()
| std::shared_ptr< prompt::BaseClass > prompt::PromptBridge::load_embedding_model |
( |
std::string |
family | ) |
|
|
inline |
Load an embedding model plugin based on the embedding family.
- Parameters
-
| family | The embedding family name |
- Returns
- std::shared_ptr<prompt::BaseClass> The loaded embedding provider instance
- Exceptions
-
◆ load_prompt_model()
| std::shared_ptr< prompt::BaseClass > prompt::PromptBridge::load_prompt_model |
( |
std::string |
family | ) |
|
|
inline |
Load a prompt model plugin based on the prompt family.
- Parameters
-
| family | The prompt family name |
- Returns
- std::shared_ptr<prompt::BaseClass> The loaded prompt provider instance
- Exceptions
-
◆ load_tokenizer_model()
| std::shared_ptr< prompt::BaseClass > prompt::PromptBridge::load_tokenizer_model |
( |
std::string |
family | ) |
|
|
inline |
Load a tokenizer model plugin based on the tokenizer family.
- Parameters
-
| family | The tokenizer family name |
- Returns
- std::shared_ptr<prompt::BaseClass> The loaded tokenizer provider instance
- Exceptions
-
◆ prompt_service_cb()
| void prompt::PromptBridge::prompt_service_cb |
( |
const std::shared_ptr< PromptSrv::Request > |
req, |
|
|
std::shared_ptr< PromptSrv::Response > |
res |
|
) |
| |
|
inline |
prompt service callback for instance prompts
This function is called when a prompt service request is received. It processes the prompt request with a new instance of the prompt provider and allows for concurrent prompt handling. It processes the prompt request using the prompt provider, and sends the response back to the client.
- Parameters
-
| req | the prompt service request. contains a prompt message, which is processed by the prompt provider |
| res | the prompt service response. contains the processed prompt response. |
- Exceptions
-
◆ tokenize_service_cb()
| void prompt::PromptBridge::tokenize_service_cb |
( |
const std::shared_ptr< TokenizeSrv::Request > |
req, |
|
|
std::shared_ptr< TokenizeSrv::Response > |
res |
|
) |
| |
|
inline |
tokenizer service callback for tokenization requests
This function is called when a tokenizer service request is received. It processes the tokenization request using the tokenizer provider, and sends the response back to the client.
- Parameters
-
| req | the tokenizer service request. contains a tokenization request message, which is processed by the tokenizer provider |
| res | the tokenizer service response. contains the processed tokenization response. |
- Exceptions
-
◆ update_prompt_history()
| void prompt::PromptBridge::update_prompt_history |
( |
prompt_msgs::msg::Prompt |
prompt, |
|
|
prompt_msgs::msg::PromptResponse |
response, |
|
|
rclcpp::Time |
prompt_time, |
|
|
rclcpp::Time |
response_time |
|
) |
| |
|
inlineprivate |
Update the prompt history with a new prompt transaction.
- Parameters
-
| prompt | The prompt message |
| response | The prompt response message |
| prompt_time | The time the prompt was sent |
| response_time | The time the response was received |
◆ embedding_families_keys_
| std::vector<std::string> prompt::PromptBridge::embedding_families_keys_ |
|
private |
◆ embedding_families_names_
| std::map<std::string, std::string> prompt::PromptBridge::embedding_families_names_ |
|
private |
◆ embedding_loader
◆ embedding_service_
| rclcpp::Service<EmbeddingSrv>::SharedPtr prompt::PromptBridge::embedding_service_ |
|
private |
◆ frame_id_
| std::string prompt::PromptBridge::frame_id_ |
|
private |
◆ history_pub_timer_
| rclcpp::TimerBase::SharedPtr prompt::PromptBridge::history_pub_timer_ |
|
private |
◆ prompt_conversations_
◆ prompt_families_keys_
| std::vector<std::string> prompt::PromptBridge::prompt_families_keys_ |
|
private |
◆ prompt_families_names_
| std::map<std::string, std::string> prompt::PromptBridge::prompt_families_names_ |
|
private |
◆ prompt_history_
| prompt_msgs::msg::PromptHistory prompt::PromptBridge::prompt_history_ |
|
private |
◆ prompt_history_pub_
| rclcpp::Publisher<prompt_msgs::msg::PromptHistory>::SharedPtr prompt::PromptBridge::prompt_history_pub_ |
|
private |
◆ prompt_loader
◆ prompt_service_
| rclcpp::Service<PromptSrv>::SharedPtr prompt::PromptBridge::prompt_service_ |
|
private |
◆ provider_name_
| std::string prompt::PromptBridge::provider_name_ |
|
private |
◆ tokenizer_families_keys_
| std::vector<std::string> prompt::PromptBridge::tokenizer_families_keys_ |
|
private |
◆ tokenizer_families_names_
| std::map<std::string, std::string> prompt::PromptBridge::tokenizer_families_names_ |
|
private |
◆ tokenizer_loader
◆ tokenizer_service_
| rclcpp::Service<TokenizeSrv>::SharedPtr prompt::PromptBridge::tokenizer_service_ |
|
private |
◆ transaction_limit_
| unsigned int prompt::PromptBridge::transaction_limit_ |
|
private |
The documentation for this class was generated from the following file: