INNER CODE UNIT · Python
set_context
shibing624/dialogbot · dialogbot/bot.py:49
def set_context(self, v):
if isinstance(v, list):
self.context = v
elif isinstance(v, str):
self.context = [v]
else:
self.context = []
def answer(self, query, use_search=True, use_gen=True, use_task=False):
"""
Dialog strategy: use sub-task to handle dialog firstly,
if failed, use retrieval or generational func to handle it.
:param query: str, input query
:param use_search: bool, weather or not use search bot, include local search and internet search
:param use_gen: bool, weather or not use seq2seq bot
:param use_task: bool, weather or not use task bot
:return: (response, details) str, []
"""