File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed
openai-java-core/src/main/kotlin/com/openai/client Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,20 @@ import com.openai.services.blocking.ModelService
1414import com.openai.services.blocking.ModerationService
1515import com.openai.services.blocking.UploadService
1616
17+ /* *
18+ * A client for interacting with the OpenAI REST API synchronously. You can also switch to
19+ * asynchronous execution via the [async] method.
20+ *
21+ * This client performs best when you create a single instance and reuse it for all interactions
22+ * with the REST API. This is because each client holds its own connection pool and thread pools.
23+ * Reusing connections and threads reduces latency and saves memory. The client also handles rate
24+ * limiting per client. This means that creating and using multiple instances at the same time will
25+ * not respect rate limits.
26+ *
27+ * The threads and connections that are held will be released automatically if they remain idle. But
28+ * if you are writing an application that needs to aggressively release unused resources, then you
29+ * may call [close].
30+ */
1731interface OpenAIClient {
1832
1933 fun async (): OpenAIClientAsync
Original file line number Diff line number Diff line change @@ -14,6 +14,20 @@ import com.openai.services.async.ModelServiceAsync
1414import com.openai.services.async.ModerationServiceAsync
1515import com.openai.services.async.UploadServiceAsync
1616
17+ /* *
18+ * A client for interacting with the OpenAI REST API asynchronously. You can also switch to
19+ * synchronous execution via the [sync] method.
20+ *
21+ * This client performs best when you create a single instance and reuse it for all interactions
22+ * with the REST API. This is because each client holds its own connection pool and thread pools.
23+ * Reusing connections and threads reduces latency and saves memory. The client also handles rate
24+ * limiting per client. This means that creating and using multiple instances at the same time will
25+ * not respect rate limits.
26+ *
27+ * The threads and connections that are held will be released automatically if they remain idle. But
28+ * if you are writing an application that needs to aggressively release unused resources, then you
29+ * may call [close].
30+ */
1731interface OpenAIClientAsync {
1832
1933 fun sync (): OpenAIClient
You can’t perform that action at this time.
0 commit comments