Simple-OpenAI: The OpenAI Java Client

Let me introduce Simple OpenAI a Java http client library for sending requests to and receiving responses from the OpenAI Api. It exposes a consistent interface across all the services, yet as simple as you can find in other languages like Python or NodeJs.

Simple-OpenAI uses the CleverClient library for http communication, Jackson for Json parsing, and Lombok to minimize boilerplate code.

7 Likes

Nice. Thanks for sharing with us. … Appreciate it!

1 Like

Hello :wave: OpenAI community !!

I would really like to get feedback/thoughts/concerns about this Java library in order to improve it or include any necessary functionality. Please feel free to drop a few lines here, I would appreciate it.

King regards

Sashir

1 Like

A new release of Simple OpenAI is available. It has fixes for some minor issues and testing coverage of 95%.

2 Likes

New Major Release 2.0.0

I’m happy to announce that we have released a new major version of our simple-openai library.

The main change is that from now on we support the use of OpenAI with two additional providers: Azure and Anyscale. Currently, we are supporting the chat completion service for both providers.

For the original provider we have full updated support for all the OpenAI services: audio, chat completion, completion, embedding, file, fine tuning, image, model, moderation, assistant, thread.

Take a look for more detail.

New Release 2.2.0

The library has been updated with the latest changes from OpenAI:

  • Support for Assistant Stream Events. :fire:
  • Sync changes in Audio API. :fire:
  • Sync changes in FineTuning API. :fire:
  • Sync changes in Assistant API. :fire:

Other internal improvements:

  • Improve field validation. :hammer_and_wrench:
  • Split OpenAI interface. :hammer_and_wrench:
  • Automate code formatting. :hammer_and_wrench:
  • Add contribution instructions. :hammer_and_wrench:
  • Setup for deploying to Maven Central. :hammer_and_wrench:

Take a look at simple-openai.

New Release 2.3.0

Simple-OpenAI has been updated with the latest changes from OpenAI until Apr 16:

  • Support for new Batch API. :fire:
  • Support for new Project Key. :fire:
  • Enabling Assistant API for Azure. :fire:
  • Fixing SonarCloud issues. :hammer_and_wrench:

Take a look at simple-openai .

3 Likes

Sashi, this is some great stuff - thank you very much for this. I will be looking to test porting my existing code from another java client to yours. Would love to see you tackle Assistants V2 API as well. Keep up the good work!

1 Like

New Release 3.0.0

Simple-OpenAI has been updated with the latest changes from OpenAI until Apr 29th:

  • Full Support for Assistants API v2 :fire::fire:

    • Assistants, Threads, Messages, Runs, Run Steps. :white_check_mark:
    • File Search Tool, Vector Stores, Vector Stores Batches. :white_check_mark:
    • Full Streaming, Pooling Helpers if not using streaming. :white_check_mark:
    • Demo code using Functions, File Search and Streaming. :white_check_mark:
  • Functions & Tools code was revamped to be shared between
    Assistants and Chat Completions. :hammer_and_wrench:

  • Code for Assistants API v1 was entirely removed. :hammer_and_wrench:

Take a look at simple-openai .

New Release 3.1.0

Simple-OpenAI has been updated with the latest changes from OpenAI until May 6th, 2024:

  • Support for the stream_options parameter :fire:
    for Chat Completions and Completions APIs

Take a look at simple-openai .

“AI is like electricity. Just as electricity transformed every major industry a century ago, AI is now poised to do the same.” By Andrew Ng

New Release 3.2.0

Simple-OpenAI seeks to stay up to date with the most recent changes in OpenAI. Currently, it supports all existing features until May 9th, 2024 and will continue to update with future changes.

What’s new in this release?

  • Support for image inputs to the Assistants API :fire:
  • Fix some minor issues :hammer_and_wrench:

If you are a Java developer venturing into the world of AI, don’t miss the opportunity to take a look at simple-openai.

New Release 3.3.0

What’s new?

  • FunctionExecutor allows functions auto selection based on toolChoice :fire:
  • Conversation examples with gpt-4o with streaming and functions :fire:
  • Enable ToolFunctionDef instantiation (for custom function handlers) :fire:
  • Fix some minor issues (AssistantTool, File Path Windows, Javadoc) :hammer_and_wrench:

Take a look at simple-openai and enjoy the most up-to-date OpenAI features available for use in your Java projects.

New Release 3.4.0

Simple-OpenAI has been updated with the latest changes from OpenAI until Jun 3rd, 2024:

  • Support for File Search Customizations :fire:

Take a look at simple-openai and enjoy the most up-to-date OpenAI features available for use in your Java projects.

New Release 3.5.0

Simple-OpenAI has been updated with the latest changes from OpenAI until Jun 6th, 2024:

  • Support for disabling Parallel Function Calling :fire:

Take a look at simple-openai and enjoy the most up-to-date OpenAI features available for use in your Java projects.

1 Like

New Release 3.6.0

Simple-OpenAI has been updated with the latest changes from OpenAI:

  • Support for the new Upload API :fire:
  • Examples were updated to use gpt-4o-mini :fire:
  • Customizing JsonSchema for functions :hammer_and_wrench:
  • Fix for creating VectorStoreFile :hammer_and_wrench:

Take a look at simple-openai.

1 Like

:bust_in_silhouette: Who Is Using Simple-OpenAI?

New additions to the list:

New Release 3.7.0

Simple-OpenAI has been updated to support Structured Outputs :fire: to ensure the model will always generate responses that adhere to a Json Schema defined through Java classes.

Take a look at simple-openai.

1 Like

New Release 3.8.0

Simple-OpenAI has been updated with the latest changes from OpenAI:

  • File Search Improvements in Assistants API :fire::
    • Configure Ranking Options.
    • Inspecting details for File Steps.
  • Fixing issue to handle Functions without parameters :hammer_and_wrench:

Take a look at simple-openai.

Take a look at my latest article about Simple-OpenAI and learn about the library that allows you to integrate cutting-edge AI services into your Java applications in the easiest way possible. :rocket::brain::computer:

New Release 3.9.0

simple-openai has been updated to support Audio on Chat Completions API.

You can take a look at the following demo code to see async speech to speech interactions with a model (audio in, audio out):

2 Likes