File tree Expand file tree Collapse file tree 4 files changed +30
-0
lines changed
openai-java-core/src/main/kotlin/com/openai/client Expand file tree Collapse file tree 4 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -39,4 +39,17 @@ interface OpenAIClient {
39
39
fun batches (): BatchService
40
40
41
41
fun uploads (): UploadService
42
+
43
+ /* *
44
+ * Closes this client, relinquishing any underlying resources.
45
+ *
46
+ * This is purposefully not inherited from [AutoCloseable] because the client is long-lived and
47
+ * usually should not be synchronously closed via try-with-resources.
48
+ *
49
+ * It's also usually not necessary to call this method at all. the default HTTP client
50
+ * automatically releases threads and connections if they remain idle, but if you are writing an
51
+ * application that needs to aggressively release unused resources, then you may call this
52
+ * method.
53
+ */
54
+ fun close ()
42
55
}
Original file line number Diff line number Diff line change @@ -39,4 +39,17 @@ interface OpenAIClientAsync {
39
39
fun batches (): BatchServiceAsync
40
40
41
41
fun uploads (): UploadServiceAsync
42
+
43
+ /* *
44
+ * Closes this client, relinquishing any underlying resources.
45
+ *
46
+ * This is purposefully not inherited from [AutoCloseable] because the client is long-lived and
47
+ * usually should not be synchronously closed via try-with-resources.
48
+ *
49
+ * It's also usually not necessary to call this method at all. the default HTTP client
50
+ * automatically releases threads and connections if they remain idle, but if you are writing an
51
+ * application that needs to aggressively release unused resources, then you may call this
52
+ * method.
53
+ */
54
+ fun close ()
42
55
}
Original file line number Diff line number Diff line change @@ -104,4 +104,6 @@ constructor(
104
104
override fun batches (): BatchServiceAsync = batches
105
105
106
106
override fun uploads (): UploadServiceAsync = uploads
107
+
108
+ override fun close () = clientOptions.httpClient.close()
107
109
}
Original file line number Diff line number Diff line change @@ -96,4 +96,6 @@ constructor(
96
96
override fun batches (): BatchService = batches
97
97
98
98
override fun uploads (): UploadService = uploads
99
+
100
+ override fun close () = clientOptions.httpClient.close()
99
101
}
You can’t perform that action at this time.
0 commit comments