Skip to content

Commit b5c1350

Browse files
Merge branch 'Barqawiz:main' into main
2 parents ffdc541 + 51ffd9e commit b5c1350

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1622
-614
lines changed

README.md

Lines changed: 47 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,72 @@
1-
# IntelliJava-OpenaiAPI
2-
*IntelliJava V0.3*
1+
# Intelligent Java
2+
*IntelliJava V0.6.0*
33

4-
IntelliJava allows java developers to easily integrate with the latest language models and deep learning frameworks using few lines of java code.
5-
The first version supports only Openai APIs. It provides a simple and intuitive API with convenient methods for sending text input to models like (GPT-3 and DALL·E) and receiving generated text or images in return.
4+
Intelligent java (IntelliJava) 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 text input to models like GPT-3 and DALL·E, and receiving generated text or images in return. With just a few lines of code, you can easily access the power of cutting-edge AI models to enhance your projects.
65

6+
The supported models:
7+
- **OpenAI**: Access GPT-3 to generate text and DALL·E to generate images. OpenAI is preferred when you want quality results without tuning.
8+
- **Cohere.ai**: Generate text; Cohere allows you to generate your language model to suit your specific needs.
79

810
# How to use
9-
1. Import the core jar file to your project or add the maven package (check Integration section).
10-
2. Add gson dependency using maven or the jar file (check dependencies section).
11-
3. Call the ``RemoteLanguageModel`` for the language model and ``RemoateImageModel`` for image generation.
11+
12+
1. Import the core jar file OR maven dependency (check the Integration section).
13+
2. Add Gson dependency if using the jar file; otherwise, it's handled by maven or Gradle.
14+
3. Call the ``RemoteLanguageModel`` for the language models and ``RemoateImageModel`` for image generation.
1215

1316
## Integration
17+
The package released to [Maven Central Repository](https://central.sonatype.dev/artifact/io.github.barqawiz/intellijava.core/0.6.0).
1418

15-
For jar integration download:
16-
[intellijava.jar](https://insta-answer-public.s3.amazonaws.com/opensource/IntelliJava/version0.3/com.intellijava.core-0.3.jar).
19+
Maven:
20+
```xml
21+
<dependency>
22+
<groupId>io.github.barqawiz</groupId>
23+
<artifactId>intellijava.core</artifactId>
24+
<version>0.6.0</version>
25+
</dependency>
26+
```
1727

18-
For maven:
19-
[Add github dependency package](https://github.com/Barqawiz/IntelliJava/packages/1767035).
28+
Gradle:
29+
30+
```
31+
implementation group: 'io.github.barqawiz', name: 'intellijava.core', version: '0.6.0'
32+
```
33+
34+
Gradle(Kotlin):
35+
```
36+
implementation("io.github.barqawiz:intellijava.core:0.6.0")
37+
```
38+
39+
Jar download:
40+
[intellijava.jar](https://repo1.maven.org/maven2/io/github/barqawiz/intellijava.core/0.6.0/intellijava.core-0.6.0.jar).
2041

2142
For ready integration: try the sample_code.
2243

2344
## Code Example
2445
**Language model code** (2 steps):
25-
```
26-
// 1- initiate the remote language model
46+
```java
47+
// 1- initiate the remote language model
2748
String apiKey = "<add-openai-api-key>";
2849
RemoteLanguageModel langModel = new RemoteLanguageModel(apiKey, "openai");
2950

3051
// 2- call generateText with any command !
31-
String command = "return a java code that says hello wrold";
32-
String resValue = langModel.generateText("text-davinci-002", command, 0.5F, 100);
52+
LanguageModelInput langInput = new LanguageModelInput.Builder("Summarize the plot of the 'Inception' movie in two sentences")
53+
.setModel("text-davinci-003").setTemperature(0.7f).setMaxTokens(50).build();
54+
String resValue = langModel.generateText(langInput);
3355
```
34-
Output:
35-
``` System.out.println("Hello, World!");```<br><br>
56+
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.```
57+
<br><br>
3658
**Image generation code** (2 steps):
37-
```
38-
// 1- initiate the remote image model
59+
```java
60+
// 1- initiate the remote image model
3961
RemoateImageModel imageModel = new RemoateImageModel(apiKey, "openai");
4062

4163
// 2- call generateImages with any command !
42-
String prompt = "teddy writing a blog in times square";
43-
List<String> images = imageModel.generateImages(prompt, 2/*number of images*/, "1024x1024");
64+
ImageModelInput imageInput = new ImageModelInput.Builder("teddy writing a blog in times square")
65+
.setNumberOfImages(2).setImageSize("1024x1024").build();
66+
List<String> images = imageModel.generateImages(imageInput);
4467
```
4568
Output:<br>
46-
<img src="images/response_image.png" height="250px">
69+
<img src="images/response_image.png" height="220px">
4770

4871
For full example check the code inside sample_code project.
4972

@@ -75,8 +98,10 @@ Call for contributors:
7598
- [x] Add support to OpenAI Completion API.
7699
- [x] Add support to OpenAI DALL·E 2.
77100
- [ ] Add support to other OpenAI functions.
101+
- [x] Add support to cohere generate API.
78102
- [ ] Add support to Google language models.
79103
- [ ] Add support to Amazon language models.
104+
- [ ] Add support to Azure models.
80105
- [ ] Add support to Midjourney image generation.
81106

82107

core/com.intellijava.core/.classpath

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,16 @@
2424
<attribute name="maven.pomderived" value="true"/>
2525
</attributes>
2626
</classpathentry>
27+
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
28+
<attributes>
29+
<attribute name="maven.pomderived" value="true"/>
30+
</attributes>
31+
</classpathentry>
2732
<classpathentry kind="src" path="target/generated-sources/annotations">
2833
<attributes>
29-
<attribute name="ignore_optional_problems" value="true"/>
3034
<attribute name="optional" value="true"/>
3135
<attribute name="maven.pomderived" value="true"/>
36+
<attribute name="ignore_optional_problems" value="true"/>
3237
<attribute name="m2e-apt" value="true"/>
3338
</attributes>
3439
</classpathentry>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target/
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
eclipse.preferences.version=1
22
encoding//src/main/java=UTF-8
3+
encoding//src/main/resources=UTF-8
34
encoding//src/test/java=UTF-8
45
encoding/<project>=UTF-8

core/com.intellijava.core/pom.xml

Lines changed: 96 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,63 @@
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
66

7-
<groupId>com.intellijava</groupId>
8-
<artifactId>com.intellijava.core</artifactId>
9-
<version>0.3</version>
7+
<groupId>io.github.barqawiz</groupId>
8+
<artifactId>intellijava.core</artifactId>
9+
<version>0.6.0</version>
1010

11-
<name>com.intellijava.core</name>
11+
<name>Intellijava</name>
12+
<description>IntelliJava allows java developers to easily integrate with the latest language models, image generation, and deep learning frameworks.</description>
1213
<url>https://github.com/Barqawiz/IntelliJava</url>
1314

15+
<licenses>
16+
<license>
17+
<name>The Apache License, Version 2.0</name>
18+
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
19+
</license>
20+
</licenses>
21+
22+
<developers>
23+
<developer>
24+
<name>Ahmad Albarqawi</name>
25+
<email>[email protected]</email>
26+
<organization>AhmadAI labs</organization>
27+
<organizationUrl>http://www.ahmadai.com</organizationUrl>
28+
</developer>
29+
</developers>
30+
31+
<scm>
32+
<connection>scm:git:git://github.com/Barqawiz/IntelliJava.git</connection>
33+
<developerConnection>scm:git:ssh://github.com:Barqawiz/IntelliJava.git</developerConnection>
34+
<url>https://github.com/Barqawiz/IntelliJava</url>
35+
</scm>
36+
1437
<properties>
1538
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1639
<maven.compiler.source>11</maven.compiler.source>
1740
<maven.compiler.target>11</maven.compiler.target>
1841
</properties>
1942

2043
<distributionManagement>
21-
<repository>
44+
<!--<repository>
2245
<id>github</id>
2346
<name>GitHub Apache Maven Packages</name>
2447
<url>https://maven.pkg.github.com/Barqawiz/IntelliJava</url>
48+
</repository>-->
49+
<snapshotRepository>
50+
<id>ossrh</id>
51+
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
52+
</snapshotRepository>
53+
<repository>
54+
<id>ossrh</id>
55+
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
2556
</repository>
2657
</distributionManagement>
2758

2859
<dependencies>
2960
<dependency>
3061
<groupId>junit</groupId>
3162
<artifactId>junit</artifactId>
32-
<version>4.11</version>
63+
<version>4.13.1</version>
3364
<scope>test</scope>
3465
</dependency>
3566
<dependency>
@@ -84,5 +115,64 @@
84115

85116
</plugins>
86117
</pluginManagement>
118+
119+
<plugins>
120+
<!-- GPG Signed Components -->
121+
<plugin>
122+
<groupId>org.apache.maven.plugins</groupId>
123+
<artifactId>maven-gpg-plugin</artifactId>
124+
<version>1.6</version>
125+
<executions>
126+
<execution>
127+
<id>sign-artifacts</id>
128+
<phase>verify</phase>
129+
<goals>
130+
<goal>sign</goal>
131+
</goals>
132+
</execution>
133+
</executions>
134+
</plugin>
135+
<!-- maven publish plugin -->
136+
<plugin>
137+
<groupId>org.sonatype.plugins</groupId>
138+
<artifactId>nexus-staging-maven-plugin</artifactId>
139+
<version>1.6.12</version>
140+
<extensions>true</extensions>
141+
<configuration>
142+
<serverId>ossrh</serverId>
143+
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
144+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
145+
</configuration>
146+
</plugin>
147+
<!-- sources -->
148+
<plugin>
149+
<groupId>org.apache.maven.plugins</groupId>
150+
<artifactId>maven-source-plugin</artifactId>
151+
<version>3.2.1</version>
152+
<executions>
153+
<execution>
154+
<id>attach-sources</id>
155+
156+
<goals>
157+
<goal>jar-no-fork</goal>
158+
</goals>
159+
</execution>
160+
</executions>
161+
</plugin>
162+
<!-- java doc -->
163+
<plugin>
164+
<groupId>org.apache.maven.plugins</groupId>
165+
<artifactId>maven-javadoc-plugin</artifactId>
166+
<version>3.4.1</version>
167+
<executions>
168+
<execution>
169+
<id>attach-javadocs</id>
170+
<goals>
171+
<goal>jar</goal>
172+
</goals>
173+
</execution>
174+
</executions>
175+
</plugin>
176+
</plugins>
87177
</build>
88178
</project>
105 KB
Loading

core/com.intellijava.core/resources/config.properties

Lines changed: 0 additions & 4 deletions
This file was deleted.

core/com.intellijava.core/src/main/java/com/intellijava/com/intellijava/core/controller/RemoteLanguageModel.java

Lines changed: 0 additions & 97 deletions
This file was deleted.

0 commit comments

Comments
 (0)