Using Code Insights Explain
The GenAI-based Code Insights Explain feature leverages advanced AI algorithms to assist you in understanding complex codebases more efficiently. This feature significantly reduces the time and effort required to comprehend large and intricate programs by providing summaries and detailed explanations of the code logic of the COBOL, PL/I, JCL, and Assembler programs.
Following are the supported models.
Language | Recommended Model |
---|---|
Cobol | Mixtral8x7B-instruct Quantized |
PLI | Mixtral8x7B-instruct Quantized |
Assembler |
|
JCL |
|
You can use the Code Insights Explain feature as a stand-alone tool to provide program summaries. You can host Code Insights Explain on premises so you don't need to share your code outside your organization.
You must install the BMC AMI AI Services to use the Code Insights Explain feature. For more information, see BMC AMI AI Services integration with Code Insights Explain .
The following diagram depicts the Code Insights Explain architecture:
To use the Code Insights Explain feature in BMC AMI DevX, you must set the BMC AMI AI Services by configuring the CES setting where the Code Insights Explain instance is provisioned. You can select your local settings if you have your local AI service setup.
To configure the BMC AMI AI services
- From the Window menu, select Preferences > BMC > AMI Platform. The AMI Platform dialog box is displayed.
- Under AI services, select the USE settings stored on CES option to use the CES where Code Insights Explain is provisioned. This option is selected by default.
- To change the CES URL, click CES.
- In the Common Enterprise Services section of the Preferences dialog box, follow these steps:
- In the Connection field, enter the CES URL and click Validate Connection. When the entered URL is validated successfully, a validation success message is displayed. If a message appears regarding authentication, click Credentials.
- Enter the credentials for logging into CES (if required), then click OK.
- Click Apply and Close to save your settings and close the dialog box.
If you have not configured the CES where Code Insights Explain is provisioned and you want to use your local AI service, select the Use local settings option. When you select this option, the AI services URL and Code Insights Explain access token fields are enabled and you can enter the URL and access token in the respective fields.
- Click Apply to save your selection.
To use the Explain Code Selection or Explain Program options
After configuring BMC AMI AI Services, you can select a paragraph or procedure in the COBOL program and produce a summary of the selected code by using the Explain Code Selection option or the entire program by using the Explain Program option. You can copy and paste the inset summaries generated as comments in a program in the code in one click. BMC AMI AI Servicesrecognizes COBOL programs with copybooks and generates explanations.
- From the editor, select a section of the code for which you want the summary.
- Right-click and select Explain Code Selection. For a summary of the whole program, select Explain Program. For a JCL job, select Explain Job.
If you select a code snippet or program containing more than 20,000 words, the Explain process might take several minutes to explain and you see the notification for the same. - In the notification dialog box, click Continue to proceed. You will see a notification message if you have selected an incomplete code snippet. In the notification dialog box, click Proceed to continue the explanation process.
- If the selected code has a copy statement and the copybook has not been downloaded, click Download Copybooks in the notification dialog box. The copybooks will be downloaded, and the explanation process will start. If you do not want to download copybooks then click Skip to proceed or click Cancel to cancel the process.
The Code Insights Explain dialog box is displayed. - To view a summary of the code, select the Explanation tab. To copy the summary, click Copy. Click
or
icon to provide your feedback if you like or dislike the code explanation you got.
- To display the summary converted into a comment for COBOL, select the Comment tab.
- Select Copy from the Copy/Paste drop-down to copy the comment to the clipboard.
- Select Copy/Paste > Paste above Explained Code to paste the comment to the file. To use this option, you must open the file in edit mode.
- To view the selected code to be explained, select the Code tab. To copy the code, click Copy.
- If you are unsatisfied with the displayed summary, click Regenerate to receive a new summary or close the dialog box
To get a summary of a paragraph right-click on the paragraph and select Explain Paragraph and for the section right-click on the required section and Explain Section. You can view the summary in the Explanation, Comment, and Code tabs.