Update README file to include more info to project.

This commit is contained in:
YuCheng Hu 2023-01-06 18:36:55 -05:00
parent c796112903
commit 8babebac7a

113
README.md
View File

@ -1,13 +1,42 @@
# Rets-Io # OpenAI-J
The Rets-Io RETS Client - Java is a library used to access data on RETS compliant servers. <p align="center">
<a href="https://github.com/honeymoose">
<img height=85 src="https://avatars1.githubusercontent.com/u/45009982?s=200&v=4">
</a>
<br>We build this project by use OpenJ9 and JDK 11.
</p>
## Links and related projects
| Project | URL | NOTE | Java libraries for using OpenAI's GPT-3 api.
|------------------|----------------------------------------------------------------------------|------------------------|
| jrets | [https://github.com/jpfielding/jrets](https://github.com/jpfielding/jrets) | fork from this proejct | We forked this API from: https://github.com/TheoKanning/openai-java/.
| CART RETS client | [http://cart.sourceforge.net/](http://cart.sourceforge.net/) | Init submit form 2004 |
The major reason we rebuild this API was OpenAI-JAVA include lombok, we think it is better build this in plain java
code.
## Deprecated
The [Answers](https://help.openai.com/en/articles/6233728-answers-transition-guide),
[Classifications](https://help.openai.com/en/articles/6272941-classifications-transition-guide),
and [Searches](https://help.openai.com/en/articles/6272952-search-transition-guide) APIs are deprecated, and will stop
working on December 3rd, 2022.
OpenAI has deprecated all Engine-based APIs.
See [Deprecated Endpoints](https://github.com/TheoKanning/openai-java#deprecated-endpoints) below for more info.
# 联系方式
请使用下面的联系方式和我们联系。
* [社区和讨论](https://www.ossez.com/tag/chat-gpt)
| 联系方式名称 | 联系方式 |
|------------------|-----------------------------------------------|
| 电子邮件Email | [yhu@ossez.com](mailto:yhu@ossez.com) |
| QQ 或微信WeChat | 103899765 |
| QQ 交流群 | 15186112 |
| 社区论坛 Community | https://www.ossez.com/c/computer-technology/7 |
# 公众平台 # 公众平台
@ -27,48 +56,28 @@ The Rets-Io RETS Client - Java is a library used to access data on RETS complian
请关注我们的知乎https://www.zhihu.com/people/huyuchengus 请关注我们的知乎https://www.zhihu.com/people/huyuchengus
![Maven Central](https://img.shields.io/maven-central/v/com.theokanning.openai-gpt3-java/client?color=blue) # How To Use
> ⚠The [Answers](https://help.openai.com/en/articles/6233728-answers-transition-guide),
>[Classifications](https://help.openai.com/en/articles/6272941-classifications-transition-guide),
>and [Searches](https://help.openai.com/en/articles/6272952-search-transition-guide) APIs are deprecated,
>and will stop working on December 3rd, 2022.
> ⚠OpenAI has deprecated all Engine-based APIs. See [Deprecated Endpoints](https://github.com/TheoKanning/openai-java#deprecated-endpoints) below for more info.
# OpenAI-Java
Java libraries for using OpenAI's GPT-3 api.
Includes the following artifacts: Includes the following artifacts:
- `api` : request/response POJOs for the GPT-3 engine, completion, and search APIs. - `api` : request/response POJOs for the GPT-3 engine, completion, and search APIs.
- `client` : a basic retrofit client for the GPT-3 endpoints, includes the `api` module - `client` : a basic retrofit client for the GPT-3 endpoints, includes the `api` module
as well as an example project using the client. as well as an example project using the client.
## Supported APIs
- [Models](https://beta.openai.com/docs/api-reference/models)
- [Completions](https://beta.openai.com/docs/api-reference/completions)
- [Edits](https://beta.openai.com/docs/api-reference/edits)
- [Embeddings](https://beta.openai.com/docs/api-reference/embeddings)
- [Files](https://beta.openai.com/docs/api-reference/files)
- [Fine-tunes](https://beta.openai.com/docs/api-reference/fine-tunes)
- [Moderations](https://beta.openai.com/docs/api-reference/moderations)
#### Deprecated by OpenAI
- [Searches](https://beta.openai.com/docs/api-reference/searches)
- [Classifications](https://beta.openai.com/docs/api-reference/classifications)
- [Answers](https://beta.openai.com/docs/api-reference/answers)
- [Engines](https://beta.openai.com/docs/api-reference/engines)
## Usage ## Usage
### Importing into a gradle project ### Importing into a gradle project
`implementation 'com.theokanning.openai-gpt3-java:api:<version>'` `implementation 'com.theokanning.openai-gpt3-java:api:<version>'`
or or
`implementation 'com.theokanning.openai-gpt3-java:client:<version>'` `implementation 'com.theokanning.openai-gpt3-java:client:<version>'`
### Using OpenAiService ### Using OpenAiService
If you're looking for the fastest solution, import the `client` and use [OpenAiService](client/src/main/java/com/theokanning/openai/OpenAiService.java).
If you're looking for the fastest solution, import the `client` and
use [OpenAiService](client/src/main/java/com/theokanning/openai/OpenAiService.java).
``` ```
OpenAiService service = new OpenAiService("your_token"); OpenAiService service = new OpenAiService("your_token");
CompletionRequest completionRequest = CompletionRequest.builder() CompletionRequest completionRequest = CompletionRequest.builder()
@ -80,30 +89,54 @@ service.createCompletion(completionRequest).getChoices().forEach(System.out::pri
``` ```
### Using OpenAiApi Retrofit client ### Using OpenAiApi Retrofit client
If you're using retrofit, you can import the `client` module and use the [OpenAiApi](client/src/main/java/com/theokanning/openai/OpenAiApi.java).
You'll have to add your auth token as a header (see [AuthenticationInterceptor](client/src/main/java/com/theokanning/openai/AuthenticationInterceptor.java)) If you're using retrofit, you can import the `client` module and use
the [OpenAiApi](client/src/main/java/com/theokanning/openai/OpenAiApi.java).
You'll have to add your auth token as a header (
see [AuthenticationInterceptor](client/src/main/java/com/theokanning/openai/AuthenticationInterceptor.java))
and set your converter factory to use snake case and only include non-null fields. and set your converter factory to use snake case and only include non-null fields.
### Using data classes only ### Using data classes only
If you want to make your own client, just import the POJOs from the `api` module. If you want to make your own client, just import the POJOs from the `api` module.
Your client will need to use snake case to work with the OpenAI API. Your client will need to use snake case to work with the OpenAI API.
## Running the example project ## Running the example project
All the [example](example/src/main/java/example/OpenAiApiExample.java) project requires is your OpenAI api token All the [example](example/src/main/java/example/OpenAiApiExample.java) project requires is your OpenAI api token
``` ```
export OPENAI_TOKEN="sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" export OPENAI_TOKEN="sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
./gradlew example:run ./gradlew example:run
``` ```
## Deprecated Endpoints ## Deprecated Endpoints
OpenAI has deprecated engine-based endpoints in favor of model-based endpoints. OpenAI has deprecated engine-based endpoints in favor of model-based endpoints.
For example, instead of using `v1/engines/{engine_id}/completions`, switch to `v1/completions` and specify the model in the `CompletionRequest`. For example, instead of using `v1/engines/{engine_id}/completions`, switch to `v1/completions` and specify the model in
the `CompletionRequest`.
The code includes upgrade instructions for all deprecated endpoints. The code includes upgrade instructions for all deprecated endpoints.
I won't remove the old endpoints from this library until OpenAI shuts them down. I won't remove the old endpoints from this library until OpenAI shuts them down.
## License #FAQ
Published under the MIT License
## License
## Supported APIs
- [Models](https://beta.openai.com/docs/api-reference/models)
- [Completions](https://beta.openai.com/docs/api-reference/completions)
- [Edits](https://beta.openai.com/docs/api-reference/edits)
- [Embeddings](https://beta.openai.com/docs/api-reference/embeddings)
- [Files](https://beta.openai.com/docs/api-reference/files)
- [Fine-tunes](https://beta.openai.com/docs/api-reference/fine-tunes)
- [Moderations](https://beta.openai.com/docs/api-reference/moderations)
## Deprecated by OpenAI
- [Searches](https://beta.openai.com/docs/api-reference/searches)
- [Classifications](https://beta.openai.com/docs/api-reference/classifications)
- [Answers](https://beta.openai.com/docs/api-reference/answers)
- [Engines](https://beta.openai.com/docs/api-reference/engines)
# License
[OpenAI-J is licensed under the MIT License](https://github.com/honeymoose/openai-j/blob/main/LICENSE) [OpenAI-J is licensed under the MIT License](https://github.com/honeymoose/openai-j/blob/main/LICENSE)