IntelliJava 0.8.0
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);