QueBIT Blog

QueBIT Blog: Can ChatGPT understand Planning Analytics / TM1 Turbo Integrator script? Part 2

Written by Michael Cowie | Apr 6, 2023 7:49:10 PM

This is the second in a series of blog posts about whether ChatGPT can help us with Planning Analytics (PA) / TM1, and 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 that post I also showed examples that highlight some of the strengths of ChatGPT, like its ability to understand TM1Py scripts, and some of its risks and weaknesses, like its hallucinations about PA’s history. All ChatGPT responses in this series are from ChatGPT-3.5, unless otherwise specified.

Can ChatGPT Understand a TI Script?

Putting to one side the early “TI uses VBA” misstep example in the previous blog post, ChatGPT can, in fact, help explain what a TI script is doing. If you ask ChatGPT to explain “What does this Turbo Integrator script do?” and paste the combined Prolog, Metadata, Data, and Prolog TI scripts from the “Planning Sample” TI process “plan_load_budget_ascii”, ChatGPT will quickly describe the script:

Bear in mind that there are over 200 lines of TI script that I submitted to ChatGPT here! ChatGPT’s description breaks the script down into logical sections of work that ChatGPT has identified and describes each in some detail. It concludes with a pretty accurate summary of what the script is doing: loading data to the “plan_BudgetPlan” cube, with logging disabled during the data load.

And here’s where ChatGPT shines: you can ask it follow-up questions and drill into even more detail about specific parts of what the script is doing, for instance:

It is, frankly, very impressive that ChatGPT can understand this much about TI script and what some of the TI script functions are designed to do, like CUBESETLOGCHANGES. It does this without having access to any descriptive comments in the TI process’ script (this is Planning Sample, after all). ChatGPT is clearly able to understand things like:

  • Variable usage: you get descriptions of variables and relationships between variables. ChatGPT even worked out that the source format of the V1 parameter is “MMM-YYYY” based on the use of SUBST functions elsewhere.
  • Program flow: ChatGPT understands the flow of TI’s IF/THEN logic and can even understand in the above script how a value is written to the TM1 cube only if the value in “Vmonth” fell between the specified start and end month.

A word of caution about ChatGPT and your data!
Please do not include any sensitive data (TI scripts, PA data, etc.) if you are using the ChatGPT website (https://chat.openai.com/). Any information submitted via ChatGPT’s website has no guarantees of privacy and could be used to train ChatGPT, which could, in theory, mean your data ends up being provided as an answer to someone else’s query! If you need to use ChatGPT with data like this then you should look at ChatGPT API’s, which do offer data privacy protections.

Can ChatGPT Optimize a TI Script?

It seems clear that ChatGPT, as shown in the examples above, can potentially help generate some basic documentation about existing TI processes today. Documentation is one of those jobs nobody enjoys doing, especially when you are documenting TI processes that you may not have written. You may need to edit some of ChatGPT’s responses or ask it to go into more detail on some sections but using AI like ChatGPT in this way could truly be a timesaver here!

Unlike many of us who have been PA consultants for years, ChatGPT does not immediately volunteer its opinion on whether the TI process appears to be badly written. 😊 But if ChatGPT can understand TI script, can it also make suggestions for improving that script? This is the point where the story gets a little disappointing (at least as of late March 2023). I asked ChatGPT this sort of question and got a long list of suggestions:

The “Planning Sample” model does, indeed, leave a lot to be desired from a design perspective, but most of the suggestions in this response will not optimize this TI script. Let us focus on two of the problems in this response:

  • Script Simplification: TI script has no CASE statement, and the CASE statement suggestion does not actually simplify that part of TI script, either. ChatGPT does not suggest simpler ways that exist for getting a month number from a “MMM-YYYY” formatted date, such as using existing TI string and date functions, or even attribute lookups.
  • Performance Optimization: Suggesting parallel processing techniques was nice to see, but this comes after ChatGPT also suggested using the “CubeExecuteUpdate” function, which ChatGPT has completely made up!

What you are seeing here from ChatGPT, like in the first post in this series, are examples of the phenomenon of AI “hallucinations.” Clearly there are some things ChatGPT still needs to learn about TI scripts and TI script optimization. And like we at QueBIT often say about the best consultants: ChatGPT also needs to do a better job knowing what it doesn’t know!

In the final post in this series on ChatGPT and TI scripts, I will be looking to see if ChatGPT can generate TI script for us. 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!