diff --git a/README.md b/README.md index 777a965..068d245 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ from towhee import pipe, ops p = ( pipe.input('messages') - .map('messages', 'answer', ops.LLM.Ernie(api_type=EB_API_TYPE, access_token=EB_ACCESS_TOKEN)) + .map('messages', 'answer', ops.LLM.Ernie(eb_api_type=EB_API_TYPE, eb_access_token=EB_ACCESS_TOKEN)) .output('answer') ) @@ -58,7 +58,7 @@ p = ( pipe.input('question', 'docs', 'history') .map(('question', 'docs', 'history'), 'prompt', ops.prompt.template(temp, ['question', 'context'])) .map('prompt', 'answer', - ops.LLM.Ernie(api_type=EB_API_TYPE, access_token=EB_ACCESS_TOKEN) + ops.LLM.Ernie(eb_api_type=EB_API_TYPE, eb_access_token=EB_ACCESS_TOKEN) ) .output('answer') ) @@ -72,16 +72,16 @@ answer = p(question, docs, history).get()[0] Create the operator via the following factory method: -***LLM.Ernie(api_type: str, access_token: str)*** +***LLM.Ernie(eb_api_type: str, eb_access_token: str)*** **Parameters:** -***api_type***: *str=None* +***eb_api_type***: *str=None* The API type in string, defaults to None. If None, it will use the environment variable `EB_API_TYPE`. Refer to [authentication](https://github.com/PaddlePaddle/ERNIE-Bot-SDK/blob/develop/docs/authentication.md) for more details. -***access_token***: *str=None* +***eb_access_token***: *str=None* The access token in string, defaults to None. If None, it will use the environment variable `EB_ACCESS_TOKEN`. Refer to [authentication](https://github.com/PaddlePaddle/ERNIE-Bot-SDK/blob/develop/docs/authentication.md) for more details. diff --git a/ernie_chat.py b/ernie_chat.py index 80db8ad..b8fcbbd 100644 --- a/ernie_chat.py +++ b/ernie_chat.py @@ -25,12 +25,12 @@ class ErnieChat(PyOperator): def __init__(self, model_name: str = 'ernie-bot-turbo', - api_type: str = None, - access_token: str = None, + eb_api_type: str = None, + eb_access_token: str = None, **kwargs ): - erniebot.api_type = api_type or os.getenv('EB_API_TYPE') - erniebot.access_token = access_token or os.getenv('EB_ACCESS_TOKEN') + erniebot.api_type = eb_api_type or os.getenv('EB_API_TYPE') + erniebot.access_token = eb_access_token or os.getenv('EB_ACCESS_TOKEN') self._model = model_name self.stream = kwargs.pop('stream') if 'stream' in kwargs else False self.kwargs = kwargs