This part is actually very easy – there is a fantastic API already available that does the job. Use this API and then all that needs to be done for the AI program is creating a function that feeds in the query to the robot and gets the response:
from chatterbotapi import ChatterBotFactory, ChatterBotType def getAIresponse2(s): factory = ChatterBotFactory() bot2 = factory.create(ChatterBotType.CLEVERBOT) bot2session = bot2.create_session() response = bot2session.think(s) return response
In this example I use
CLEVERBOT but there are certainly other bots to choose from. A little later I will talk about the predicament to develop a personalized chatterbot baesd on chat histories.