openai / openai/openai-java

Potential misleading documentation on OpenAiClientAsync

Open
#644 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation question sdk
Dominant language
Kotlin
Stars
1.5k
Forks
264
Avg merge
9h 46m
Merged PRs (30d)
96

Description

OpenAIClientAsync's documentation states:

This client performs best when you create a single instance and reuse it for all interactions
with the REST API. This is because each client holds its own connection pool and thread pools.
Reusing connections and threads reduces latency and saves memory. The client also handles rate
limiting per client. This means that creating and using multiple instances at the same time will
not respect rate limits.
(emphasis mine)

Source: https://github.com/openai/openai-java/blob/main/openai-java-core/src/main/kotlin/com/openai/client/OpenAIClientAsync.kt#L30-L41

However I find no evidence on rate limits actually being used proactively as the text suggests. I can only find evidence of reactive retry, when encountering 429 errors it automatically retries with an exponential backoff. However, that is request specific, not global to the client.

Is my understanding incorrect here or is this a documentation error? Thanks in advance.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the documentation in openai-java-core/src/main/kotlin/com/openai/client/OpenAIClientAsync.kt around the cited lines. Compare its rate-limit wording with the retry behavior described in the issue and inspect the relevant client behavior. Done means confirming whether the statement is accurate and updating the documentation if it is misleading.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
api, documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.