Skip to content

Potential misleading documentation on OpenAiClientAsync #644

@StefanZanderInacta

Description

@StefanZanderInacta

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationquestionFurther information is requestedsdk

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions