|
Prompt Tools 0.3.2
|
#include <openai_embedding.hpp>


Public Member Functions | |
| OpenAIEmbedding () | |
| Construct a new OpenAI Embedding Provider object. | |
| virtual void | initialize (rclcpp::Node::SharedPtr node) override |
| Initialize the OpenAIEmbedding. | |
Public Member Functions inherited from prompt::EmbedBaseClass | |
| EmbedBaseClass () | |
| Constructor. | |
| virtual | ~EmbedBaseClass ()=default |
| Destructor. | |
| virtual void | initialize_embed_base (rclcpp::Node::SharedPtr node, std::string plugin_name="EmbedBaseClass", std::string api_key_name="") |
| Initialize the REST base class. | |
| virtual prompt::EmbedResponse | get_embeddings (prompt::EmbedRequest &req) override |
| get_embeddings sends a text to an embedding provider using REST | |
Public Member Functions inherited from prompt::RestBaseClass | |
| RestBaseClass () | |
| Constructor. | |
| virtual | ~RestBaseClass ()=default |
| Destructor. | |
| virtual void | initialize_rest_base (rclcpp::Node::SharedPtr node, std::string plugin_name="RestBaseClass", std::string api_key_name="") |
| Initialize the REST base class. | |
Public Member Functions inherited from prompt::BaseClass | |
| BaseClass ()=default | |
| virtual | ~BaseClass ()=default |
| 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 Poco::JSON::Object | toJson (prompt::EmbedRequest &input) override |
| Convert a embed request to a JSON object. | |
| virtual prompt::EmbedResponse | fromJson (const Poco::JSON::Object::Ptr object) override |
| Convert a JSON object to a prompt response for OpenAI Embeddings. | |
Protected Member Functions inherited from prompt::RestBaseClass | |
| 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. | |
Protected Member Functions inherited from prompt::BaseClass | |
| virtual void | initialize_base (rclcpp::Node::SharedPtr node, std::string plugin_name="BaseClass") |
| Initialize the prompt base class. | |
Additional Inherited Members | |
Static Protected Member Functions inherited from prompt::RestBaseClass | |
| static std::string | extract_error_description (const std::string &response_body) |
Protected Attributes inherited from prompt::EmbedBaseClass | |
| std::string | embed_uri_ |
| URI for embedding requests. | |
Protected Attributes inherited from prompt::RestBaseClass | |
| std::string | method_ |
| bool | ssl_verify_ |
| std::string | auth_type_ |
| std::string | api_key_ |
| API key. | |
| std::vector< prompt::PromptOption > | required_options_ |
| Model options. | |
Protected Attributes inherited from prompt::BaseClass | |
| rclcpp::Node::SharedPtr | node_ |
| Node shared pointer. | |
| std::string | plugin_name_ |
| Plugin name. | |
This class implements an OpenAI embedding provider plugin. It provides methods to initialize the plugin, convert embed requests to JSON, and parse JSON responses into embed responses.
|
inline |
Construct a new OpenAI Embedding Provider object.
|
inlineoverrideprotectedvirtual |
Convert a JSON object to a prompt response for OpenAI Embeddings.
This method converts a JSON object received from the embeddings endpoint into a PromptResponse. It extracts the embedding vector and other metadata.
| object | The JSON object to convert |
Implements prompt::EmbedBaseClass.
|
inlineoverridevirtual |
Initialize the OpenAIEmbedding.
This method initializes the OpenAIEmbedding with parameters from the ROS parameter server.
| node | rclcpp::Node::SharedPtr ROS node |
Implements prompt::BaseClass.
|
inlineoverrideprotectedvirtual |
Convert a embed request to a JSON object.
This method converts the embed request to a JSON object that can be sent to the embed plugin. It includes the embed text and options in the JSON object.
| input | The embed request to convert |
Implements prompt::EmbedBaseClass.