From f885d74149c933c1d06be6100877cd917e5ce0bf Mon Sep 17 00:00:00 2001 From: Martin Breuss Date: Mon, 5 Sep 2022 12:37:01 +0200 Subject: [PATCH] Fix error in return variable If `.process()` in your custom Logic Adapter returns a tuple with `(confidence, return_statement)`, like currently described in the docs, then running the bot gives an error: ``` AttributeError: 'tuple' object has no attribute 'text' chatterbot ``` This was addressed also in https://github.com/gunthercox/ChatterBot/issues/1208 and it's probably worth to update the docs to reflect that `.confidence` is an attribute on a `Statement()`. --- docs/logic/create-a-logic-adapter.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/logic/create-a-logic-adapter.rst b/docs/logic/create-a-logic-adapter.rst index 9ec9fa928..6a4ffdfce 100644 --- a/docs/logic/create-a-logic-adapter.rst +++ b/docs/logic/create-a-logic-adapter.rst @@ -116,8 +116,9 @@ For this example we will use a fictitious API endpoint that returns the current temperature = data.get('temperature', 'unavailable') response_statement = Statement(text='The current temperature is {}'.format(temperature)) + response_statement.confidence = confidence - return confidence, response_statement + return response_statement Providing extra arguments =========================