Skip to content

Commit c797a6a

Browse files
committed
update the web page with chatGPT details
1 parent ae27d49 commit c797a6a

File tree

1 file changed

+34
-12
lines changed

1 file changed

+34
-12
lines changed

README.md

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
# Intelligent Java
22

3-
[![Maven Central](https://img.shields.io/maven-central/v/io.github.barqawiz/intellijava.core?style=for-the-badge)](https://central.sonatype.com/artifact/io.github.barqawiz/intellijava.core/0.7.0)
3+
[![Maven Central](https://img.shields.io/maven-central/v/io.github.barqawiz/intellijava.core?style=for-the-badge)](https://central.sonatype.com/artifact/io.github.barqawiz/intellijava.core/0.8.0)
44
[![GitHub](https://img.shields.io/github/license/Barqawiz/IntelliJava?style=for-the-badge)](https://opensource.org/licenses/Apache-2.0)
55

6-
Intelligent java is the ultimate tool for Java developers looking to integrate with the latest language models and deep learning frameworks. The library provides a simple and intuitive API with convenient methods for sending input to models like GPT-3 and DALL·E, and receiving generated text, speech or images. With just a few lines of code, you can easily access the power of cutting-edge AI models to enhance your projects.
6+
Intelligent java (IntelliJava) is the ultimate tool to integrate with the latest language models and deep learning frameworks using java. The library provides an intuitive functions for sending input to models like ChatGPT and DALL·E, and receiving generated text, speech or images. With just a few lines of code, you can easily access the power of cutting-edge AI models to enhance your projects.
77

88
The supported models:
9-
- **OpenAI**: Access GPT-3 to generate text and DALL·E to generate images. OpenAI is preferred when you want quality results without tuning.
9+
- **OpenAI**: Access ChatGPT, GPT3 to generate text and DALL·E to generate images. OpenAI is preferred for quality results without tuning.
1010
- **Cohere.ai**: Generate text; Cohere allows you to generate a language model to suit your specific needs.
1111
- **Google AI**: Generate audio from text; Access DeepMind’s speech models.
1212

1313
# How to use
1414

1515
1. Add the maven dependency or import the core jar file (check the Integration section).
1616
2. Add Gson dependency if using the jar file; otherwise, it's handled by maven or Gradle.
17-
3. Call the ``RemoteLanguageModel`` for the language models, ``RemoteImageModel`` for image generation and ``RemoteSpeechModel`` for text to speech models.
17+
3. Call the ``RemoteLanguageModel`` for the language models, ``RemoteImageModel`` for image generation and ``RemoteSpeechModel`` for text to speech models, ``Chatbot`` for ChatGPT.
1818

1919
## Integration
2020
The package released to Maven Central Repository:
@@ -24,23 +24,23 @@ Maven:
2424
<dependency>
2525
<groupId>io.github.barqawiz</groupId>
2626
<artifactId>intellijava.core</artifactId>
27-
<version>0.7.0</version>
27+
<version>0.8.0</version>
2828
</dependency>
2929
```
3030

3131
Gradle:
3232

3333
```
34-
implementation 'io.github.barqawiz:intellijava.core:0.7.0'
34+
implementation 'io.github.barqawiz:intellijava.core:0.8.0'
3535
```
3636

3737
Gradle(Kotlin):
3838
```
39-
implementation("io.github.barqawiz:intellijava.core:0.7.0")
39+
implementation("io.github.barqawiz:intellijava.core:0.8.0")
4040
```
4141

4242
Jar download:
43-
[intellijava.jar](https://repo1.maven.org/maven2/io/github/barqawiz/intellijava.core/0.7.0/intellijava.core-0.7.0.jar).
43+
[intellijava.jar](https://repo1.maven.org/maven2/io/github/barqawiz/intellijava.core/0.8.0/intellijava.core-0.8.0.jar).
4444

4545
## Code Example
4646
**Language model code** (2 steps):
@@ -55,7 +55,9 @@ LanguageModelInput langInput = new LanguageModelInput.Builder("Summarize the plo
5555
String resValue = langModel.generateText(langInput);
5656
```
5757
Output:```Inception follows Dom Cobb, a professional thief, who is offered a chance at redemption in exchange for planting an idea in a target's mind. He must navigate a dangerous landscape of dream-sharing technology and battle his inner demons in order to complete the mission and find his way back to reality.```
58-
<br><br>
58+
59+
<br>
60+
5961
**Image generation code** (2 steps):
6062
```java
6163
// 1- initiate the remote image model
@@ -68,7 +70,27 @@ List<String> images = imageModel.generateImages(imageInput);
6870
```
6971
Output:<br>
7072
<img src="images/response_image.png" height="220px">
71-
<br><br>
73+
74+
<br>
75+
76+
**ChatGPT code**:
77+
```java
78+
// 1- initiate the chat model.
79+
Chatbot bot = new Chatbot(apiKey, "openai");
80+
81+
// 2- prepare the chat history by calling addMessage.
82+
String mode = "You are a helpful astronomy assistant.";
83+
ChatModelInput input = new ChatGPTInput.Builder(mode)
84+
.addUserMessage("what is the space between moon and earth")
85+
.build();
86+
87+
// 3- call chat!
88+
List<String> resValues = bot.chat(input);
89+
```
90+
Output:``` The average distance between the Moon and the Earth is about 238,855 miles (384,400 kilometers). ```
91+
92+
<br>
93+
7294
**Text to speech code** (2 steps):
7395
```java
7496
// 1- initiate the remote speech model
@@ -81,7 +103,7 @@ byte[] decodedAudio = model.generateEnglishText(input);
81103
Output:
82104
<iframe width="100%" height="166" scrolling="no" frameborder="no" allow="autoplay" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/1450836247&color=%2328262c&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true"></iframe><div style="font-size: 10px; color: #cccccc;line-break: anywhere;word-break: normal;overflow: hidden;white-space: nowrap;text-overflow: ellipsis; font-family: Interstate,Lucida Grande,Lucida Sans Unicode,Lucida Sans,Garuda,Verdana,Tahoma,sans-serif;font-weight: 100;"><a href="https://soundcloud.com/sam-572736789" title="Sam" target="_blank" style="color: #cccccc; text-decoration: none;">Sam</a> · <a href="https://soundcloud.com/sam-572736789/intelligent-java-intro" title="Intelligent Java Intro" target="_blank" style="color: #cccccc; text-decoration: none;">Intelligent Java Intro</a></div>
83105

84-
106+
<br>
85107

86108
For full example check the [sample_code project](https://github.com/Barqawiz/IntelliJava/tree/main/sample_code).
87109

@@ -96,7 +118,7 @@ The only dependencies is **GSON**.
96118

97119
# Roadmap
98120
Call for contributors:
99-
- [x] Add support to OpenAI Completion API.
121+
- [x] Add support to OpenAI Completion.
100122
- [x] Add support to OpenAI DALL·E 2.
101123
- [ ] Add support to other OpenAI functions.
102124
- [x] Add support to cohere generate API.

0 commit comments

Comments
 (0)