USC-GPT / utils.py
bhulston's picture
Uploading relevant documents
c755297
raw
history blame
690 Bytes
def fill_prompt(prompt, json):
"""
Takes in a prompt and fills in the {key} with the corresponding value from the json KV pairs
"""
def build_filter(json_response):
filter = {}
days_list = json_response['Days']
# Days
if "[" in days_list:
days = str(days_list[0])
for i in range(len(days_list)-1):
days += ', '
days += str(days_list[i+1])
filter["days"] = days
# Units
units = json_response['Units']
if units != "":
filter["units"] = units
# Program
program = json_response['Program']
if program != "":
filter["program"] = program
# Time
return filter