Fastapi used to launch a chat message

Hello
Here is my code (taskinai-fastapi)https://github.com/royam0820/taskingai/tree/main/web-framework
The code execute well, http:200 when lauching it, url 127.0.0.1:8000
I have verified the API

  • OPENAI_API_KEY
  • TASKINGAI_API_KEY
  • ASSISTANT_ID1
  • ASSISTANT_ID2
  • USE_FALLBACK=True

When i send the message via the html message window, I have the following error:
Error: HTTP error! status: 500
not sure how to fix it, all the apis are valid

Hi Royam, please check your get_assistant function. It is not returning a valid TaskingAI Assistant object. We recommend to take assistant id as the ‘/chat’ endpoint’s parameter, rather than an Assistant object. You should then use the assistant id to retrieve your assistant using taskingai.assistant.get_assistant.

Hello Patrick
thank you for your feedback, I will revise my code as suggested.

Thanks for your help and support.