This is an example program demonstrating integration of Oracle Cloud Infrastructure (OCI) Generative AI into a Java program. The program creates a Java Troubleshooting Assistant leveraging Generative AI and LangChain4j.
- If not installed, download and install JDK 23. You can use JDK 21 as well; just change the source and target requirements in pom.xml to 21.
- Set up an OCI configuration file by following these instructions. Going through these steps will result in creating a
configfile whose location depends on your operating system; for example, for Unix-compatible environments, this is available at~/.oci/config.
You can either use your IDE to build this Maven project, or if you prefer a terminal window, use the following mvn command.
mvn verifyThis action will create the troubleshoot-assist-1.0.0.jar file inside the target directory
- Set the COMPARTMENT_ID as an environment variable.
If you are running from a terminal window, set it as shown below, replacing the value with your compartment identifier:
export COMPARTMENT_ID="ocid1.compartment.oc1..xxx"Otherwise, update your IDE's configuration to add COMPARTMENT_ID in its environment variables.
- Run the project with the following
mvncommand.
mvn exec:java -Dexec.mainClass=JavaTroubleshootingAssistant