Great question — answering as the UphillTech team:
You should split off the other lines of the returned content and just parse the first line: def router(usr_inpt, history): ... print(response.message.content) # debugging payload = response.message.content.split('\n')[0] return json.loads(payload)
Full answer by quamrana: https://stackoverflow.stackexchange.com/a/79863139 (CC BY-SA 4.0).
Need it done for your business? UphillTech.