Skip to content

Commit 9b922cc

Browse files
committed
Add the project initial code
- create the core library with openai language model integration. - add eclipse sample core. - write the basic project documentation.
1 parent a1cb3b0 commit 9b922cc

File tree

23 files changed

+758
-3
lines changed

23 files changed

+758
-3
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,7 @@
2222
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
2323
hs_err_pid*
2424
replay_pid*
25+
26+
# jar exception
27+
!package/**/*.jar
28+
!sample_code/jars/**/*.jar

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 Albarqawi, Ahmad
3+
Copyright (c) 2023 Github.com/Barqawiz/IntelliJava
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,68 @@
1-
# IntelliJava
2-
IntelliJava allows java developers to easily integrate with the latest language models and deep learning frameworks like GPT-3 using few lines of code.
1+
# IntelliJava-OpenaiAPI
2+
*IntelliJava V0.1*
3+
4+
IntelliJava allows java developers to easily integrate with the latest language models and deep learning frameworks like GPT-3 using few lines of code.
5+
The first version supports only Openai APIs. It provides a simple and intuitive API with convenient methods for sending text input to GPT-3 and receiving generated text in return.
6+
7+
# How to use
8+
1. Import the core jar file to your project [intellijava.jar](https://insta-answer-public.s3.amazonaws.com/opensource/IntelliJava/version0.1/com.intellijava.core-0.1-SNAPSHOT.jar).
9+
2. Add gson dependency using maven or the jar file (check the dependencies section).
10+
3. Call the RemoteLanguageModel as described in the code example.
11+
12+
# Code Example
13+
```
14+
// 1- initiate the remote language model
15+
String apiKey = "<todo-add-api-key>";
16+
RemoteLanguageModel wrapper = new RemoteLanguageModel(apiKey, "openai");
17+
18+
// 2- call generateText with any command !
19+
String command = "write a java code that says hello wrold";
20+
String resValue = wrapper.generateText("text-davinci-002", command, 0.5F, 100);
21+
```
22+
For full example check the samples projects inside sample_code folder.
23+
24+
# Dependencies
25+
The only dependencies is **GSON**.
26+
27+
For Maven:
28+
```
29+
<dependency>
30+
<groupId>com.google.code.gson</groupId>
31+
<artifactId>gson</artifactId>
32+
<version>2.8.9</version>
33+
</dependency>
34+
```
35+
36+
For Gradle:
37+
```
38+
dependencies {
39+
implementation 'com.google.code.gson:gson:2.8.9'
40+
}
41+
```
42+
43+
For jar download:
44+
[gson download repo](https://search.maven.org/artifact/com.google.code.gson/gson/2.8.9/jar)
45+
46+
# License
47+
48+
MIT License
49+
50+
Copyright (c) 2023 Github.com/Barqawiz/IntelliJava
51+
52+
Permission is hereby granted, free of charge, to any person obtaining a copy
53+
of this software and associated documentation files (the "Software"), to deal
54+
in the Software without restriction, including without limitation the rights
55+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
56+
copies of the Software, and to permit persons to whom the Software is
57+
furnished to do so, subject to the following conditions:
58+
59+
The above copyright notice and this permission notice shall be included in all
60+
copies or substantial portions of the Software.
61+
62+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
63+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
64+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
65+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
66+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
67+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
68+
SOFTWARE.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" output="target/classes" path="src/main/java">
4+
<attributes>
5+
<attribute name="optional" value="true"/>
6+
<attribute name="maven.pomderived" value="true"/>
7+
</attributes>
8+
</classpathentry>
9+
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
10+
<attributes>
11+
<attribute name="optional" value="true"/>
12+
<attribute name="maven.pomderived" value="true"/>
13+
<attribute name="test" value="true"/>
14+
</attributes>
15+
</classpathentry>
16+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
17+
<attributes>
18+
<attribute name="maven.pomderived" value="true"/>
19+
</attributes>
20+
</classpathentry>
21+
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
22+
<attributes>
23+
<attribute name="maven.pomderived" value="true"/>
24+
</attributes>
25+
</classpathentry>
26+
<classpathentry kind="src" path="target/generated-sources/annotations">
27+
<attributes>
28+
<attribute name="optional" value="true"/>
29+
<attribute name="maven.pomderived" value="true"/>
30+
<attribute name="ignore_optional_problems" value="true"/>
31+
<attribute name="m2e-apt" value="true"/>
32+
</attributes>
33+
</classpathentry>
34+
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
35+
<attributes>
36+
<attribute name="optional" value="true"/>
37+
<attribute name="maven.pomderived" value="true"/>
38+
<attribute name="ignore_optional_problems" value="true"/>
39+
<attribute name="m2e-apt" value="true"/>
40+
<attribute name="test" value="true"/>
41+
</attributes>
42+
</classpathentry>
43+
<classpathentry kind="output" path="target/classes"/>
44+
</classpath>

core/com.intellijava.core/.project

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>com.intellijava.core</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.m2e.core.maven2Builder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
</buildSpec>
19+
<natures>
20+
<nature>org.eclipse.jdt.core.javanature</nature>
21+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
22+
</natures>
23+
</projectDescription>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
eclipse.preferences.version=1
2+
encoding//src/main/java=UTF-8
3+
encoding//src/test/java=UTF-8
4+
encoding/<project>=UTF-8
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.apt.aptEnabled=false
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
3+
org.eclipse.jdt.core.compiler.compliance=11
4+
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
5+
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
6+
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
7+
org.eclipse.jdt.core.compiler.processAnnotations=disabled
8+
org.eclipse.jdt.core.compiler.release=disabled
9+
org.eclipse.jdt.core.compiler.source=11
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
activeProfiles=
2+
eclipse.preferences.version=1
3+
resolveWorkspaceProjects=true
4+
version=1

core/com.intellijava.core/pom.xml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>com.intellijava</groupId>
8+
<artifactId>com.intellijava.core</artifactId>
9+
<version>0.0.1-SNAPSHOT</version>
10+
11+
<name>com.intellijava.core</name>
12+
<!-- FIXME change it to the project's website -->
13+
<url>http://www.example.com</url>
14+
15+
<properties>
16+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
17+
<maven.compiler.source>11</maven.compiler.source>
18+
<maven.compiler.target>11</maven.compiler.target>
19+
</properties>
20+
21+
<dependencies>
22+
<dependency>
23+
<groupId>junit</groupId>
24+
<artifactId>junit</artifactId>
25+
<version>4.11</version>
26+
<scope>test</scope>
27+
</dependency>
28+
<dependency>
29+
<groupId>com.google.code.gson</groupId>
30+
<artifactId>gson</artifactId>
31+
<version>2.8.9</version>
32+
</dependency>
33+
</dependencies>
34+
35+
<build>
36+
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
37+
<plugins>
38+
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
39+
<plugin>
40+
<artifactId>maven-clean-plugin</artifactId>
41+
<version>3.1.0</version>
42+
</plugin>
43+
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
44+
<plugin>
45+
<artifactId>maven-resources-plugin</artifactId>
46+
<version>3.0.2</version>
47+
</plugin>
48+
<plugin>
49+
<artifactId>maven-compiler-plugin</artifactId>
50+
<version>3.8.0</version>
51+
</plugin>
52+
<plugin>
53+
<artifactId>maven-surefire-plugin</artifactId>
54+
<version>2.22.1</version>
55+
</plugin>
56+
<plugin>
57+
<artifactId>maven-jar-plugin</artifactId>
58+
<version>3.0.2</version>
59+
</plugin>
60+
<plugin>
61+
<artifactId>maven-install-plugin</artifactId>
62+
<version>2.5.2</version>
63+
</plugin>
64+
<plugin>
65+
<artifactId>maven-deploy-plugin</artifactId>
66+
<version>2.8.2</version>
67+
</plugin>
68+
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
69+
<plugin>
70+
<artifactId>maven-site-plugin</artifactId>
71+
<version>3.7.1</version>
72+
</plugin>
73+
<plugin>
74+
<artifactId>maven-project-info-reports-plugin</artifactId>
75+
<version>3.0.0</version>
76+
</plugin>
77+
</plugins>
78+
</pluginManagement>
79+
</build>
80+
</project>

0 commit comments

Comments
 (0)