Skip to content

Commit 7153e2e

Browse files
committed
mark assistants api as experimental
1 parent 9261220 commit 7153e2e

File tree

1 file changed

+48
-0
lines changed
  • src/main/kotlin/com/cjcrafter/openai

1 file changed

+48
-0
lines changed

src/main/kotlin/com/cjcrafter/openai/OpenAI.kt

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,26 +132,64 @@ interface OpenAI {
132132
* Returns the handler for the assistants endpoint. This handler can be used
133133
* to create, retrieve, and delete assistants.
134134
*/
135+
@get:ApiStatus.Experimental
135136
val assistants: AssistantHandler
136137

137138
/**
138139
* Returns the handler for the threads endpoint. This handler can be used
139140
* to create, retrieve, and delete threads.
140141
*/
142+
@get:ApiStatus.Experimental
141143
val threads: ThreadHandler
142144

145+
/**
146+
* Constructs a default [OpenAI] instance.
147+
*/
143148
@OpenAIDslMarker
144149
open class Builder internal constructor() {
145150
protected var apiKey: String? = null
146151
protected var organization: String? = null
147152
protected var client: OkHttpClient = OkHttpClient()
148153
protected var baseUrl: String = "https://api.openai.com"
149154

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+
*/
150162
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+
*/
151170
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+
*/
152178
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+
*/
153188
fun baseUrl(baseUrl: String) = apply { this.baseUrl = baseUrl }
154189

190+
/**
191+
* Builds the OpenAI instance.
192+
*/
155193
@Contract(pure = true)
156194
open fun build(): OpenAI {
157195
return OpenAIImpl(
@@ -168,9 +206,19 @@ interface OpenAI {
168206
private var apiVersion: String? = null
169207
private var modelName: String? = null
170208

209+
/**
210+
* Sets the azure api version
211+
*/
171212
fun apiVersion(apiVersion: String) = apply { this.apiVersion = apiVersion }
213+
214+
/**
215+
* Sets the azure model name
216+
*/
172217
fun modelName(modelName: String) = apply { this.modelName = modelName }
173218

219+
/**
220+
* Builds the OpenAI instance.
221+
*/
174222
@Contract(pure = true)
175223
override fun build(): OpenAI {
176224
return AzureOpenAI(

0 commit comments

Comments
 (0)