Skip to content

Commit 119f09f

Browse files
committed
update readme information
1 parent 8db59dd commit 119f09f

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

README.md

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1-
# ChatGPT-Java-API
2-
This is an easy-to-use "drag and drop" API that allows you to use OpenAI's new ChatGPT API. This API
3-
works by wrapping HTTPS requests with java variables, making the generated results much easier to control.
1+
<div align="center">
42

5-
Feel free to use, modify, and distribute this code as needed.
3+
# ChatGPT Java API
4+
[![](https://img.shields.io/github/v/release/CJCrafter/ChatGPT-Java-API)](https://github.com/CJCrafter/ChatGPT-Java-API/releases/latest)
5+
[![](https://img.shields.io/badge/-docs%20-blueviolet)](https://openai.cjcrafter.com/)
6+
[![](https://img.shields.io/badge/-examples%20-orange)](https://github.com/CJCrafter/ChatGPT-Java-API/wiki)
7+
[![](https://img.shields.io/github/discussions/CJCrafter/ChatGPT-Java-API)](https://github.com/CJCrafter/ChatGPT-Java-API/discussions)
8+
[![License](https://img.shields.io/github/license/WeaponMechanics/ArmorMechanics)](https://github.com/WeaponMechanics/ArmorMechanics/blob/master/LICENSE)
69

7-
# Installation
10+
A community maintained easy-to-use Java/Kotlin OpenAI API for ChatGPT, Text Completions, and more!
11+
</div>
12+
13+
## Features
14+
* [Completions](https://platform.openai.com/docs/api-reference/completions)
15+
* [Chat Completions](https://platform.openai.com/docs/api-reference/chat)
16+
17+
## Installation
818
For Kotlin DSL (`build.gradle.kts`), add this to your dependencies block:
919
```kotlin
1020
dependencies {
@@ -22,16 +32,18 @@ For Maven projects, add this to your `pom.xml` file in the `<dependencies>` bloc
2232
See the [maven repository](https://central.sonatype.com/artifact/com.cjcrafter/openai/1.2.7) for gradle/ant/etc.
2333

2434

25-
# Working Example
26-
Check the wiki for more examples.
35+
## Working Example
36+
This is a basic working example. To see more features in action (async calls, streaming)
37+
see the [java examples](https://github.com/CJCrafter/ChatGPT-Java-API/wiki/Java)
38+
and [kotlin examples](https://github.com/CJCrafter/ChatGPT-Java-API/wiki/Kotlin)
2739
```java
2840
public class JavaChatTest {
2941

3042
public static void main(String[] args) throws OpenAIError {
3143
Scanner scan = new Scanner(System.in);
3244

3345
// This is the prompt that the bot will refer back to for every message.
34-
ChatMessage prompt = ChatMessage.toSystemMessage("You are a customer support chat-bot. Write brief summaries of the user's questions so that agents can easily find the answer in a database.");
46+
ChatMessage prompt = ChatMessage.toSystemMessage("You are ChatGPT, a helpful chat bot.");
3547

3648
// Use a mutable (modifiable) list! Always! You should be reusing the
3749
// ChatRequest variable, so in order for a conversation to continue
@@ -46,6 +58,7 @@ public class JavaChatTest {
4658
.messages(messages).build();
4759

4860
// Loads the API key from the .env file in the root directory.
61+
// You should never put your API keys in code, keep your key safe!
4962
String key = Dotenv.load().get("OPENAI_TOKEN");
5063
OpenAI openai = new OpenAI(key);
5164

@@ -74,9 +87,8 @@ public class JavaChatTest {
7487

7588
```
7689

77-
# Support
78-
If I have saved you time, please consider [sponsoring me](https://github.com/sponsors/CJCrafter).
79-
If you cannot financially support me, consider leaving a star on the repository and sharing it. Thanks!
90+
## Support
91+
If I have saved you time, please consider [sponsoring me](https://github.com/sponsors/CJCrafter).
8092

81-
# License
93+
## License
8294
ChatGPT-Java-API is licensed under the [MIT License](https://github.com/CJCrafter/ChatGPT-Java-API/blob/master/LICENSE).

0 commit comments

Comments
 (0)