This is the last (for now) in a series of blog posts about whether ChatGPT can help us with Planning Analytics (PA) / TM1, more specifically with Turbo Integrator (TI) script. In the first post in the series, I provided some background on AI technology like ChatGPT and really useful AI tools for programmers, like GitHub Copilot. In the second post in the series, I shared some ways in which ChatGPT is already able to help understand TI script, which could be useful in tasks like system documentation. One other finding in that second blog post is that although ChatGPT does a good job of accurately describing TI scripts, it is not yet capable of helping to suggest ways of optimizing or improving those scripts; it suggests things that are not possible in TI script (like CASE statements) and even makes up functions which don’t exist. As a reminder, all ChatGPT responses in this series are from ChatGPT-3.5, unless otherwise specified.
The “GPT” in ChatGPT stands for “Generative Pre-Trained Transformer”, and the purpose of this post is to push the boundaries of the “Generative” part of ChatGPT a bit more when it comes to PA and TI script, starting with this: can it help add documentation to existing TI processes?
To do this, I picked up the existing conversation thread I had with ChatGPT which served as the basis for the second post in this series. One of the great things about ChatGPT is it can pick right up where you left off (provided you do not delete a conversation). As a reminder:
Here is an excerpt of the original TI script (part of the Prolog only):
I first asked ChatGPT to insert its description as comments in the script: “Can you turn your descriptions about the Turbo Integrator script I posted earlier into comments within the script?” What I got was a little unexpected in that it decided to use an “improved” script with its own “optimizations” implemented:
Not a problem, I just clarified for ChatGPT what I wanted: “Can you instead add these comments to the original script, as I posted it?” And I got something much better:
I really like that ChatGPT decided to add some separation between the declaration of VStartMonth and VstartYear variables and the derivation of a numeric month value that followed. That is a very logical edit that it made to the original script. And it really does not bother me that ChatGPT didn’t know that you’re not supposed to add comments inside a “Generated Statements” block.
But wait a minute! Where did the CubeName declaration come from and why is it behaving like I am writing a TM1Py script (“Import the ‘tm1’ package”)? I suspect this was my fault- in this same ChatGPT conversation I had started by asking it some questions about Python and TM1Py and, probably because it saw the same cube name (plan_BudgetPlan), it appears to have conflated the two when generating some comments.
Overall, ChatGPT seems like it could be a useful tool for generating a first cut of comments in TI script. I think one of the keys is to keep your ChatGPT “conversation” very focused on the problem at hand, otherwise ChatGPT appears to draw on other parts of the thread (like TM1Py-style references in my example). One limitation not shown here is that ChatGPT has a limit to how much it returns in a single answer, meaning you may need to ask it to perform actions on smaller pieces of longer scripts.
We know from the second post in this series that ChatGPT cannot yet suggest reliable code improvements, but what if we ask it to do some specific tasks to refactor existing scripts? Here I asked it to convert variable names to CamelCase format:
I then asked it to build on that work and pull the hardcoded cube name out into a separate variable called vCubeName:
On very specific tasks like these, ChatGPT seems to do extremely well! This kind of operation still requires some review for accuracy, but it undeniably has a lot of potential, especially across many processes that need the same modifications.
I’ll close ambitiously and share what happens if we ask ChatGPT something like the following: “Write a TM1 Turbo Integrator script example that sends a numeric value to a 5-dimensional cube”
You may not be surprised to hear that ChatGPT-3.5 cannot be relied upon to produce much in the way of useful TI script snippets, as seen in this response:
I was not surprised by this given past responses to questions like this.
But I did make the wise decision to give the new ChatGPT-4 engine a shot at that same question and was a little shocked by what I got, by contrast:
For a first response this was above and beyond what I expected. ChatGPT-4 is even able to revise a sample like this to assume you are loading from a CSV file or other data source!
This has been a fun and exciting series of blog posts to write, and I hope it was also an interesting and useful introduction to ChatGPT. Although there is still undoubtedly some room for improvement and inherent risks to consider, there is no question that the technology underlying generative AI tools like ChatGPT could start being useful very soon, including to those of us who use IBM Planning Analytics! If you are interested in learning about some of the tools discussed here or how to leverage other kinds of AI and automation tools, including ChatGPT API’s, in your business do not hesitate to contact us!