Java SDK for OpenAI APIs (GPT-3, ChatGPT, GPT-4)
Top 10.6% on sourcepulse
This Java library provides a client for interacting with OpenAI's GPT APIs, including GPT-3, ChatGPT, and GPT-4. It offers data classes for API requests/responses, a Retrofit-based client, and a simplified service class for ease of use, targeting Java developers building applications that leverage OpenAI's language models.
How It Works
The project is structured into three Maven artifacts: api
for POJOs, client
for a Retrofit client, and service
for a high-level abstraction. The service
module simplifies interactions by providing an OpenAiService
class that handles request building and API calls. It supports features like function calling via FunctionExecutor
, allowing developers to define and integrate custom Java functions with OpenAI's models.
Quick Start & Requirements
implementation 'com.theokanning.openai-gpt3-java:service:<version>'
OpenAiService service = new OpenAiService("your_token");
./gradlew runExampleOne
, ./gradlew runExampleTwo
(functions), ./gradlew runExampleThree
(functions with stream).Highlighted Details
Maintenance & Community
This project is no longer maintained and was archived on June 6th, 2024. The repository remains available for forking and modification.
Licensing & Compatibility
Published under the MIT License. This license permits commercial use and integration with closed-source projects.
Limitations & Caveats
The project is archived and will not receive further updates. OpenAI has deprecated engine-based APIs, and while the library includes instructions for upgrading, it may not fully align with future OpenAI API changes.
1 year ago
1 week