Skip to content

Commit

Permalink
Fix error in return variable
Browse files Browse the repository at this point in the history
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 #1208 and it's probably worth to update the docs to reflect that `.confidence` is an attribute on a `Statement()`.
  • Loading branch information
martin-martin authored and gunthercox committed Jan 5, 2025
1 parent 0524b20 commit 2638e42
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/logic/create-a-logic-adapter.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
=========================
Expand Down

0 comments on commit 2638e42

Please sign in to comment.