sonIA / utils.py
Davide Fiocco
Allow year to update automatically
dcf6f0c
raw
history blame
344 Bytes
import json
import datetime
def get_answer(input, context, engine):
answer = engine({"question": input, "context": context})
return answer["answer"]
def get_context():
now = datetime.datetime.now()
with open("context.json") as f:
context = json.load(f)["info"].replace("[YEAR]", str(now.year))
return context