From d900fc4f9d65057240be53840706d551c1d2b9e7 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Sat, 22 Apr 2023 07:42:32 +0800 Subject: [PATCH] Add feature(custom text embedding in plugin) --- src/auto_gpt_plugin_template/__init__.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/auto_gpt_plugin_template/__init__.py b/src/auto_gpt_plugin_template/__init__.py index c8340dd..d0d381d 100644 --- a/src/auto_gpt_plugin_template/__init__.py +++ b/src/auto_gpt_plugin_template/__init__.py @@ -243,3 +243,27 @@ def handle_chat_completion( str: The resulting response. """ pass + + @abc.abstractmethod + def can_handle_text_embedding( + self, text: str + ) -> bool: + """This method is called to check that the plugin can + handle the text_embedding method. + Args: + text (str): The text to be convert to embedding. + Returns: + bool: True if the plugin can handle the text_embedding method.""" + return False + + @abc.abstractmethod + def handle_text_embedding( + self, text: str + ) -> list: + """This method is called when the chat completion is done. + Args: + text (str): The text to be convert to embedding. + Returns: + list: The text embedding. + """ + pass