Skip to main content

Hello everyone,

In this release, we have added AI integration to the Upcycler. You can now use AI to translate code and add code descriptions during your enrichment steps.

Read on for more details on the changes.

Download the Thinkwise Upcycler 2023.3.10 here.

Requirements

  • Software Factory 2022.1 or higher is required.

Contents

 

New

AI integration in the Enrichment analysis process

new

Upcycled applications typically contain code that was written in a different programming language, is missing comments, or contains comments in another language. With AI integration, you can now use OpenAI to, for example, add comments to existing code, add descriptions for any object in the model, or replace existing code concepts with new ones. AI greatly enhances the Upcycler's enrichment capabilities.

In the Upcycler (menu Definition > Generic upcycler > tab Generic enrichment analysis step > Form > field AI Instruction), you can add the instruction that contains the rules and guidelines that the AI will follow. Providing more instructions usually leads to a better result. The generic AI instruction can be modified to fit every technology.

Adding AI instruction to generic enrichment step

 

How to start using AI in the Upcycler

To use the AI capabilities of the Upcycler:

  1. Visit the website of OpenAI  to obtain an API key.
  2. Modify the generative AI provider settings in IAM for the Upcycler application:
    1. Go to menu Authorization > Applications > THINKWISE_UPCYCLER > detail tab Generative AI providers.
    2. Edit generative_ai and set the API key.
    3. Optional: Change the chat completion model from the default gpt-3.5-turbo to another model that your key allows.

In the Upcycler, all enrichment steps with an AI instruction will now be processed using AI. The screenshot above shows a short example of a suitable instruction for adding comment lines to template code. To successfully give the AI a prompt to use, name a column in your Model query as "prompt". The value of this column will be used to generate a response.

An example:

In this example, the column ‘template_code’ will be used as the prompt

 

To retrieve the results of the model query execution and the AI result, you can open the @json variable with the T-SQL function openjson(). The @json variable has the usual Application connector result structure, with the addition of an ai_result property in the Result list.

Note that ai_result may not be a named column inside the model query, as this column will be automatically appended by the Upcycler after receiving a response from the AI.

For example, to select all data from the previously mentioned model query, you can use the following query:

select t3.*
from openjson(@json) t1 -- main json
cross apply openjson(a.value) t2 -- resultc]
cross apply openjson(b.value) -- resultSets]
with (
control_proc_id nvarchar(max),
template_id nvarchar(max),
template_code nvarchar(max),
ai_result nvarchar(max)
) t3

Using this data, you can specify enrichment action steps with the ai_result value. Use other steps as a reference for this.

 

AI-driven generic analysis enrichments

new

We have added new enrichment runs to the Upcycler (See also New and changed in the upcycle steps in these release notes). The following new analysis enrichments are available:

  • Translate Views
  • Translate Procedures
  • Translate Functions
  • Translate Triggers/Instead of triggers
  • Translate Defaults
  • Translate Layouts
  • Create control procedure and template description

The first six translate enrichments translate legacy code into T-SQL per code group, using AI. These enrichments are separated between code groups to be disabled if the legacy code does not support anything that can be transformed into that logic type.

For these enrichments, the process is as follows:

  • The model query finds all control procedures that are not inactive and not generated (either by a dynamic model or from a base model) for that specific code group.
  • The model query uses the template code as a prompt for the AI to translate.
  • The AI instruction tells the OpenAI provider that it is a programmer who can translate code, and instructs it about which rules to follow and what kind of code to return.
  • The data query produces a step per template with a valid AI response. During this step, the template code is overridden by the AI suggestion. You can choose which steps to execute in the action steps or execute them all and review the code in the Software Factory. There, you can also always find the old code in the history (Ctrl + H).

The last enrichment (Create control procedure and template description) uses template code to create a description that explains what the code does. This can be very helpful for legacy code that could not be translated, as well as for Thinkwise experts who are not fluent in the legacy language.

For this enrichment, we assume that every control procedure has precisely one template and one static assignment. It should be used before any changes have been made to upcycled code. If you have changed anything, check the model query and exclude these changes in the model query if necessary.

For this enrichment, the process is as follows:

  • The model query finds all control procedures that are not inactive and not generated (either by a dynamic model or from a base model).
  • The model query uses the template code as a prompt for the AI to summarize.
  • The AI instruction tells the OpenAI provider that it is a programmer who summarizes code, and what kind of response it must give.
  • The data query produces a step per template with a valid AI response. During this step, a description is added by the AI suggestion if the description was empty before.

These enrichments only work when an AI provider is configured correctly in IAM (see How to start using AI in the Upcycler). During the first enrichment analysis, this provider is tested.

If it does not work correctly, the steps are disabled in the Application steps (Upcycle > Enrichment runs > Application > Application enrichment analysis steps). You can configure the AI provider in IAM and (potentially) enable the steps before trying another run.

Note that these steps may take a while if the legacy contains a lot of code.

 

Uniface Upcycler enrichments

Compared to the generic analysis, the Uniface analysis does not analyze defaults or layout procedures because those are unavailable in Uniface upcycles.

For all other new AI enrichments, Uniface-specific AI instructions have been included to support Uniface code instead of generic code.

An example of a Uniface-specific AI instruction is: You are a programmer who translates code from Uniface to T-SQL.

 

New and changed in Upcycle steps

 

Upcycle step 2410: Translate Views

Step New or changed
Generic step New
Variation for DB2 for iSeries Generic
Variation for PostgreSQL Generic
Variation for Progress OpenEdge Generic
Variation for SQL Server Generic
Variation for Uniface Specific

 

Upcycle step 2420: Translate Procedures

Step New or changed
Generic step New
Variation for DB2 for iSeries Generic
Variation for PostgreSQL Generic
Variation for Progress OpenEdge Generic
Variation for SQL Server Generic
Variation for Uniface Specific

 

Upcycle step 2430: Translate Functions

Step New or changed
Generic step New
Variation for DB2 for iSeries Generic
Variation for PostgreSQL Generic
Variation for Progress OpenEdge Generic
Variation for SQL Server Generic
Variation for Uniface Specific

 

Upcycle step 2440: Translate Triggers/Instead of triggers

Step New or changed
Generic step New
Variation for DB2 for iSeries Generic
Variation for PostgreSQL Generic
Variation for Progress OpenEdge Generic
Variation for SQL Server Generic
Variation for Uniface Specific

 

Upcycle step 2450: Translate Defaults

Step New or changed
Generic step New
Variation for DB2 for iSeries Generic
Variation for PostgreSQL Generic
Variation for Progress OpenEdge Generic
Variation for SQL Server Generic
Variation for Uniface Not applicable

 

Upcycle step 2460: Translate Layouts

Step New or changed
Generic step New
Variation for DB2 for iSeries Generic
Variation for PostgreSQL Generic
Variation for Progress OpenEdge Generic
Variation for SQL Server Generic
Variation for Uniface Not applicable

 

Upcycle step 2500: Create control procedure and template description

Step New or changed
Generic step New
Variation for DB2 for iSeries Generic
Variation for PostgreSQL Generic
Variation for Progress OpenEdge Generic
Variation for SQL Server Generic
Variation for Uniface Specific

 

Data model changes

This chapter describes which data model changes have been made to the Thinkwise Upcycler meta-model.

Column changes

Table From column To column
application_enrichment_analysis_step - instruction
enrichment_run - enrichment_analysis_run_ai_error_text
enrichment_run_analysis_step - instruction
generic_enrichment_analysis_step - instruction
technology_enrichment_analysis_step - instruction

 

Questions or suggestions?

Questions or suggestions about the release notes? Let us know in the Thinkwise Community!