@@ -132,26 +132,64 @@ interface OpenAI {
132
132
* Returns the handler for the assistants endpoint. This handler can be used
133
133
* to create, retrieve, and delete assistants.
134
134
*/
135
+ @get:ApiStatus.Experimental
135
136
val assistants: AssistantHandler
136
137
137
138
/* *
138
139
* Returns the handler for the threads endpoint. This handler can be used
139
140
* to create, retrieve, and delete threads.
140
141
*/
142
+ @get:ApiStatus.Experimental
141
143
val threads: ThreadHandler
142
144
145
+ /* *
146
+ * Constructs a default [OpenAI] instance.
147
+ */
143
148
@OpenAIDslMarker
144
149
open class Builder internal constructor() {
145
150
protected var apiKey: String? = null
146
151
protected var organization: String? = null
147
152
protected var client: OkHttpClient = OkHttpClient ()
148
153
protected var baseUrl: String = " https://api.openai.com"
149
154
155
+ /* *
156
+ * Sets the API key to use for requests. This is required.
157
+ *
158
+ * Your API key can be found at: [https://platform.openai.com/api-keys](https://platform.openai.com/api-keys).
159
+ *
160
+ * @param apiKey The API key to use for requests, starting with `sk-`
161
+ */
150
162
fun apiKey (apiKey : String ) = apply { this .apiKey = apiKey }
163
+
164
+ /* *
165
+ * If you belong to multiple organizations, you can specify which one to use.
166
+ * Defaults to your default organization configured in the OpenAI dashboard.
167
+ *
168
+ * @param organization The organization ID to use for requests, starting with `org-`
169
+ */
151
170
fun organization (organization : String? ) = apply { this .organization = organization }
171
+
172
+ /* *
173
+ * Sets the [OkHttpClient] used to make requests. Modify this if you want to
174
+ * change the timeout, add interceptors, add a proxy, etc.
175
+ *
176
+ * @param client The client to use for requests
177
+ */
152
178
fun client (client : OkHttpClient ) = apply { this .client = client }
179
+
180
+ /* *
181
+ * Sets the base URL to use for requests. This is useful for testing.
182
+ * This can also be used to use the Azure OpenAI API, though we
183
+ * recommend using [azureBuilder] instead for that. Defaults to
184
+ * `https://api.openai.com`.
185
+ *
186
+ * @param baseUrl The base url
187
+ */
153
188
fun baseUrl (baseUrl : String ) = apply { this .baseUrl = baseUrl }
154
189
190
+ /* *
191
+ * Builds the OpenAI instance.
192
+ */
155
193
@Contract(pure = true )
156
194
open fun build (): OpenAI {
157
195
return OpenAIImpl (
@@ -168,9 +206,19 @@ interface OpenAI {
168
206
private var apiVersion: String? = null
169
207
private var modelName: String? = null
170
208
209
+ /* *
210
+ * Sets the azure api version
211
+ */
171
212
fun apiVersion (apiVersion : String ) = apply { this .apiVersion = apiVersion }
213
+
214
+ /* *
215
+ * Sets the azure model name
216
+ */
172
217
fun modelName (modelName : String ) = apply { this .modelName = modelName }
173
218
219
+ /* *
220
+ * Builds the OpenAI instance.
221
+ */
174
222
@Contract(pure = true )
175
223
override fun build (): OpenAI {
176
224
return AzureOpenAI (
0 commit comments