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
14
14
import com.openai.services.blocking.ModerationService
15
15
import com.openai.services.blocking.UploadService
16
16
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
+ */
17
31
interface OpenAIClient {
18
32
19
33
fun async (): OpenAIClientAsync
Original file line number Diff line number Diff line change @@ -14,6 +14,20 @@ import com.openai.services.async.ModelServiceAsync
14
14
import com.openai.services.async.ModerationServiceAsync
15
15
import com.openai.services.async.UploadServiceAsync
16
16
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
+ */
17
31
interface OpenAIClientAsync {
18
32
19
33
fun sync (): OpenAIClient
You can’t perform that action at this time.
0 commit comments