Skip to content

IntelliJava 0.8.0

Choose a tag to compare

@Barqawiz Barqawiz released this 04 Mar 13:43
· 11 commits to main since this release
0a7702c

Introducing the latest update to Intelligent Java with support for ChatGPT model 🚀.

Update summary:

  • Support ChatGPT 🤖.
  • Update the SpeechInput name to become Text2SpeechInput.
  • Add enum input type to the image model.

Integration

Maven:

<dependency>
    <groupId>io.github.barqawiz</groupId>
    <artifactId>intellijava.core</artifactId>
    <version>0.8.0</version>
</dependency>

Gradle:

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

Example

ChatGPT code:

// 1- initiate the chat model.
Chatbot bot = new Chatbot(apiKey, SupportedChatModels.openai);

// 2- prepare the chat history by calling addMessage.
String mode = "You are a helpful astronomy assistant.";
ChatModelInput input = new ChatGPTInput.Builder(mode).addUserMessage("what is the space between moon and earth").build();

// 3- call chat!
List<String> resValues =  bot.chat(input);

Output:The average distance between the Moon and the Earth is about 238,855 miles (384,400 kilometers).


Text to speech code:

// 1- initiate the remote speech model
RemoteSpeechModel model = new RemoteSpeechModel(apiKey, SpeechModels.google);

// 2- call generateEnglishText with any text
Text2SpeechInput input = new Text2SpeechInput.Builder("Hi, I am Intelligent Java.").build();
byte[] decodedAudio = model.generateEnglishText(input);