How do you use the Assistants API?

getWeekReport is the function that gets called by OpenAI as part of the Assistant. weekReport submits the task in the Celery queue and when its done the sendWeekReport function gets called to send the email.
As you can see the getWeekreport function is really just taking the results of a few Salesforce queries and throws in a Dict. (Note that some of the queries are groupings in order to make sure the total size of the response is never crazy. What I really love is how I can just provide two ‘records’ in this Json, one with last week and one with week -2 and the rest is up for openAI. What is even better is that I do NOT have to define a set structure BEFOREHAND in the Function definition. OpenAI doesn’t really seem to care what kind of JSON it gets back, it just ingests it.
email example

I wrote about and share the code (not as a library yet) without paywall here:

3 Likes