Generating code fix suggestion example
This example will walk you through generating code fixes for a Java application that must be migrated to the target technology quarkus. To generate resolutions for issues in the code, we use the Agentic AI mode and the my-model as the large language model (LLM) that you deployed in OpenShift AI.
Procedure
-
Open the
my-Javaproject in Visual Studio (VS) Code. -
Download the Konveyor AI extension from the Konveyor AI release page in GitHub.
-
Open Command Palette:
-
Type
Ctrl+Shift+Pin Windows and Linux systems. -
Type
Cmd+Shift+Pin Mac systems.
-
-
Type
Preferences: Open Settings (UI)in the Command Palette to open the VS Code settings and selectExtensions > Konveyor AI. -
Select
Gen AI:Agent Mode. -
In the Konveyor AI extension, click
Open Analysis View. -
Type
Konveyor: Manage Analysis Profilein the Command Palette to open the analysis profile page. -
Configure the following fields:
-
Profile Name: Type a profile name
-
Target Technologies:
quarkus -
Custom Rules: Select custom rules if you want to include them while running the analysis. By default, Konveyor AI enables Use Default Rules for
quarkus.
-
-
Close the profile manager.
-
Type
Konveyor: Open the Gen AI model provider configuration filein the Command Palette. -
Configure the following in the
provider-settingsfile and close it:models: openshift-example-model: &active environment: OPENAI_API_KEY: "<Server's OPENAI_API_KEY>" CA_BUNDLE: "<Servers CA Bundle path>" provider: "ChatOpenAI" args: model: "my-model" configuration: baseURL: "https://<serving-name>-<data-science-project-name>.apps.konveyor-ai.example.com/v1"You must change the
provider-settingconfiguration if you plan to use a different LLM provider. -
Type
Konveyor AI: Open Analysis Viewin the Command Palette. -
Click Start to start the Konveyor AI RPC server.
-
Select the profile you configured.
-
Click Run Analysis to scan the Java application.
Konveyor AI identifies the issues in the code.
-
Click the solutions icon in an issue to request suggestions to resolve the issue.
Konveyor AI streams the issue description, a preview of the code changes that resolve the issue, and the file(s) in which the changes are to be made.
You can review the code changes in the editor and accept or reject the changes. If you accept the changes, Konveyor AI creates a new file with the accepted code changes.
-
Click Continue to allow Konveyor AI to run a follow-up analysis.
This round of analysis detects lint issues, compilation issues, or diagnostic issues that may have occurred when you accepted the suggested code change.
Repeat the review and accept or reject the resolutions. Konveyor AI continues to run repeated iterations of scan if you allow until all issues are resolved.