Intelligent Java: A Gateway to the Latest AI Models

Leveraging ChatGPT, DALL·E, and WaveNet to Build a Climate Awareness App with Java

5 min readFeb 21


As artificial intelligence advances, accessing the latest AI models has become essential for developers and enterprises to compete. However, Java, the leading language for enterprise applications, has yet to have similar support in the AI and large language models world. This is where the open-source Intelligent Java project provides a unified channel to access any model with few lines of code.

Intelligent Java is an open-source AI library that intuitively integrates with the latest deep learning frameworks. The library lets java developers send input to models like GPT-3, DALL·E, and WaveNet; and receive generated text, speech, or images. With just a few lines of code and a unified access point, developers can easily access the power of cutting-edge AI models to enhance their projects.

The Library Pillars

Intelligent Java Pillars visual— image by the author

Intelligent Java is built on three pillars to ensure scalability and flexibility; The wrapper layer provides low-level access to the latest AI models and libraries. The controller layer offers a unified input to any language, image, or speech model. The controller takes care of the model’s differences, ensuring the ability to change the models with minimum changes. For instance, the developers can generate text from OpenAI or Cohere models without needing to modify their code.

The function layer provides abstract application layers with the ability to extend the use cases based on apps’ needs. The function layer has not been fully released yet, but the developers can use the controller to build any function inside their application with minimum code.

The Intelligent Java library currently supports the OpenAI GPT-3 and DALL·E models, for generating custom text, and Google AI for generating audio from text using DeepMind’s speech models.

Using Intelligent Java

Using Intelligent Java is simple and straightforward. Developers can add the maven dependency, gradle or import the core jar file, depending on their preference.

To start using the library add the suitable dependency for your app:

<!-- maven -->

For gradle based projects:

implementation 'io.github.barqawiz:intellijava.core:0.8.0'

For latest version and more download options check the Github page.

Let’s build an application for dynamic climate change museum using Intelligent Java

Imagination of climate change futuristic museum —image by Midjourney model

We can leverage Intelligent Java to create dynamic content for a climate change awareness museum that imagines the impact of climate events on planets, nature and cities. Revisiting the same museum multiple times can become boring, as the content is static, and generating new descriptions and photos requires considerable effort. IntelliJava will allow us to call various models without installing multiple libraries or changing the input flow.

Application planning and coding

We will use the RemoteLanguageModel to generate descriptions for imaginary situations. RemoteSpeechModel to develop synthesized speech, so our visitors don’t have to read. RemoteImageModel to create fantasy images based on the language model output.

Call the Language Model:

We will use GPT3 to generate an imaginary description of climate impact on the earth.

Input: Write about climate change effect on earth if the pollution continue

// get the API key from
RemoteLanguageModel model = new RemoteLanguageModel(apiKey, "openai");

LanguageModelInput input = new LanguageModelInput
.Builder("Write about climate change effect on earth if the pollution continue")

String generatedText = model.generateText(input);

Output: If the pollution continues, the effects of climate change on Earth will become increasingly severe. The planet will become much warmer, leading to a rise in sea levels, extreme weather events, and more frequent and intense heat waves. The ocean will become more acidic, which will threaten marine life and disrupt the food chain. Ice caps will continue to melt…..


The temperature input parameter controls the imagination flexibility for the model, where higher values mean more risks and creativity. Note that not every model prompt (input) generates quality results; you have to test multiple examples to find the most suitable prompt for language models.

Call the Speech Model:

The generated description is long, and it will be more attractive to listen to speech instead of reading every text in a museum; for this, we will use RemoteSpeechModel to generate mp3 audio using Google models.

// generate api key from and enable the text-to-speech api
RemoteSpeechModel model = new RemoteSpeechModel(apiKey,;
Text2SpeechInput input = new Text2SpeechInput(generatedText, Gender.FEMALE);

byte[] decodedAudio = model.generateEnglishText(input);


audio description for climate change impact — generate by gpt3 language model and google speech model

Call the Image Model:

For an engaging experience, we will create images from the generated description using DALL·E 2. The text is long, so we will chunk a part of it and imagine a city with the described events using oil painting.

Input: oil panting for a city with rise in sea levels and extreme weather events

String imageText = "oil panting for a city with rise in sea levels and extreme weather events";
RemoteImageModel model = new RemoteImageModel(apiKey, "openai");

// support image sizes: 256x256, 512x512, or 1024x1024
ImageModelInput input = new ImageModelInput.Builder(imageText)

// output is list or URLs
List<String> images = model.generateImages(input);


oil panting for a city with rise in sea levels and extreme weather events — generate by Intelligent Java

In conclusion, the rapidly evolving artificial intelligence field is transforming every industry, and new research papers are constantly introducing innovative models. To stay ahead of the market, developers need an intuitive path to integrate with these models. The open-source Intelligent Java project offers unified access to a variety of models. By abstracting the model layer and providing a standard input and output flow, developers can easily communicate with the latest models and integrate AI into their applications.





Solution design and a master’s data science scholar at UIUC.