AI Workflow Manager Dev Log

By Bill Wang and Alejandro Estrella

   [Bill:] For our new project, we are working on a workflow manager/scheduler (maybe we will need to use it ourselves). This specific development log will document my process for coding this section of the AI-powered scheduler.

   The major goal for this project was to use AI to automate making a schedule. I would use chatgpt’s natural language processing in order to extract information from a sentence, and then output the information to be sent to a scheduler.

   I have had some coding experience before working on this project, but this was my first time working with an API, which was rather nerve racking.

   The first major challenge was inserting the API in the first place. Initially, I began by searching up ChatGPT’s API documentation on Google, and watching some youtube tutorials.

(me studying)

   However, I soon got Aditya’s code for an AI email responder, which also used ChatGPT, which I could fork, and then copy, paste, delete, and modify. Thus, I decided to then do some active learning, and, instead of learning the API from scratch, simply change Aditya’s code to fit my task.

(me forking away Aditya’s code mwahahahaha)

   Then, in order to avoid confusion, I deleted the email API library imports. The resulting errors from the lack of import commands on the top allowed me to identify the irrelevant code, and then delete it.

(empty spaces are where I deleted email related stuff. At the bottom is an error, showing the part that I should delete.)

   Then, after reading the code several times, I identified the actual input into ChatGPT, a variable named “etext.” I took that variable, replaced all instances with a variable named “inp” (for input), and then made it so inp was equivalent to user input. The method of input will have to be changed later, as the input takes the input from the terminal, but that will need to be worked on once the workflow manager is up, and we link the code to the workflow manager.

   I tested whether ChatGPT successfully accepted the user input, and thankfully, it still worked.

(me testing whether the chatgpt api still worked after my slight modifications)

   My next step was to modify the prompt sent to ChatGPT, on which it would change its output. I had to do tons and tons of drafts and modifications to my prompts, but ChatGPT refused to be controlled, and output exactly what I wanted it to

(some of my prompt drafts for chatgpt) (my prompts inside of the code)

   Finally, I remember a passing comment by Aditya almost a week before. I had asked him what this “temperature” variable was, and he had replied somewhat along the lines of “it controls the creativity of the answer. Immediately, I turned the “temperature” down to zero, so the answer would be as formulaic as possible. This allowed Chatgpt to output the response that I wanted: data extracted from natural language in a format that could be put into the scheduler itself. I took the data, and split it into a list, which I then appended into a matrix. I used military time to make future calculations easier. I used what I think is a pretty unique way to mark the specific date, month, and time. I put them into a single integer (so it would be easier to access). I multiplied the year by 10000, the month by 100, and then added the multiplied year, multiplied month, and multiplied day. This way, if I were to compare the dates, I could tell which date is before which. Years, being the biggest value in the integer, have a “higher priority” than month, which has a larger effect than date. Sadly, I could not get the military time to be stuck with the date, which could have simplified it more.

(input, and then output.)

   After about 30 minutes of research, I figured out that the .sort function was a lot more powerful than I had originally thought it to be, and used it to sort the matrix by date and time in chronological order.

(sorting code! Yup!! That's it!) (A little messy, but this is the input, natural language, and output, extracted data in order)

   Now, the natural language to schedule the data section is complete!

   However, we are not done with this project. The next step is to take this extracted data, and then insert it into the workflow website.

   [Alejandro:] And that's where my part begins! I worked on the frontend for the ai workflow app. At first, I had to decide how I was going to decide the interface for the app. I could have done a custom interface like I and Rayan did for the team website, but it seemed like we wouldn’t have enough time for that. So I instead decided to use a web component set, which is a set of pre styled components that I could use to build the website. The specific I used was Material Web by Google.

Material Web Components

   I had some troubles using the web component set, since it used a new technology called Web Components. Since I was also using a framework called Svelte, it made the logic significantly easier to code. However, It was not well suited for web components, often getting confused on what the custom elements can and cannot do.

Telling Svelte not to worry about the web components.

   I persevered though, and was able to get a functioning interface. It ended up looking nice and clean in my opinion.

Main Workflow Page

   It is a simple interface, however. Only a few pages actually work. The settings page, that just has some placeholder settings; a tasks page, where I could see my current tasks; and a create task page where I could create tasks.

Create Task Page

   It is still very barebones, and there is a lot of work to do. The natural language part that Bill had made has not been integrated. Which I am hoping to continue after winter break.

Copyright 2023

For Team Access Only:

Sign In