Skip to content

Commit 48825ea

Browse files
feat(api): manual updates
1 parent daa8c1c commit 48825ea

5 files changed

Lines changed: 11 additions & 19 deletions

File tree

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 7
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-3607b588cab78536eb7de9f6acffe8ddda1d34aebe5910c2147421aa6c16bf22.yml
33
openapi_spec_hash: fb507e8d38b4978a5717fbb144197868
4-
config_hash: fc6606301b5142487a69d296f154b265
4+
config_hash: 9d54b9fd851ec7ac25b85f579be64425

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ See this table for the available options:
108108
| ---------------------- | -------------------------------- | ------------------------ | -------- | -------------------------------------------- |
109109
| `browserbaseApiKey` | `stagehand.browserbaseApiKey` | `BROWSERBASE_API_KEY` | true | - |
110110
| `browserbaseProjectId` | `stagehand.browserbaseProjectId` | `BROWSERBASE_PROJECT_ID` | true | - |
111-
| `modelApiKey` | `stagehand.modelApiKey` | `MODEL_API_KEY` | false | - |
111+
| `modelApiKey` | `stagehand.modelApiKey` | `MODEL_API_KEY` | true | - |
112112
| `baseUrl` | `stagehand.baseUrl` | `STAGEHAND_BASE_URL` | true | `"https://api.stagehand.browserbase.com/v1"` |
113113

114114
System properties take precedence over environment variables.

stagehand-java-client-okhttp/src/main/kotlin/com/browserbase/api/client/okhttp/StagehandOkHttpClient.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,7 @@ class StagehandOkHttpClient private constructor() {
203203
clientOptions.browserbaseProjectId(browserbaseProjectId)
204204
}
205205

206-
fun modelApiKey(modelApiKey: String?) = apply { clientOptions.modelApiKey(modelApiKey) }
207-
208-
/** Alias for calling [Builder.modelApiKey] with `modelApiKey.orElse(null)`. */
209-
fun modelApiKey(modelApiKey: Optional<String>) = modelApiKey(modelApiKey.getOrNull())
206+
fun modelApiKey(modelApiKey: String) = apply { clientOptions.modelApiKey(modelApiKey) }
210207

211208
fun headers(headers: Headers) = apply { clientOptions.headers(headers) }
212209

stagehand-java-client-okhttp/src/main/kotlin/com/browserbase/api/client/okhttp/StagehandOkHttpClientAsync.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,7 @@ class StagehandOkHttpClientAsync private constructor() {
203203
clientOptions.browserbaseProjectId(browserbaseProjectId)
204204
}
205205

206-
fun modelApiKey(modelApiKey: String?) = apply { clientOptions.modelApiKey(modelApiKey) }
207-
208-
/** Alias for calling [Builder.modelApiKey] with `modelApiKey.orElse(null)`. */
209-
fun modelApiKey(modelApiKey: Optional<String>) = modelApiKey(modelApiKey.getOrNull())
206+
fun modelApiKey(modelApiKey: String) = apply { clientOptions.modelApiKey(modelApiKey) }
210207

211208
fun headers(headers: Headers) = apply { clientOptions.headers(headers) }
212209

stagehand-java-core/src/main/kotlin/com/browserbase/api/core/ClientOptions.kt

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ private constructor(
9595
@get:JvmName("maxRetries") val maxRetries: Int,
9696
@get:JvmName("browserbaseApiKey") val browserbaseApiKey: String,
9797
@get:JvmName("browserbaseProjectId") val browserbaseProjectId: String,
98-
private val modelApiKey: String?,
98+
@get:JvmName("modelApiKey") val modelApiKey: String,
9999
) {
100100

101101
init {
@@ -111,8 +111,6 @@ private constructor(
111111
*/
112112
fun baseUrl(): String = baseUrl ?: PRODUCTION_URL
113113

114-
fun modelApiKey(): Optional<String> = Optional.ofNullable(modelApiKey)
115-
116114
fun toBuilder() = Builder().from(this)
117115

118116
companion object {
@@ -127,6 +125,7 @@ private constructor(
127125
* .httpClient()
128126
* .browserbaseApiKey()
129127
* .browserbaseProjectId()
128+
* .modelApiKey()
130129
* ```
131130
*/
132131
@JvmStatic fun builder() = Builder()
@@ -287,10 +286,7 @@ private constructor(
287286
this.browserbaseProjectId = browserbaseProjectId
288287
}
289288

290-
fun modelApiKey(modelApiKey: String?) = apply { this.modelApiKey = modelApiKey }
291-
292-
/** Alias for calling [Builder.modelApiKey] with `modelApiKey.orElse(null)`. */
293-
fun modelApiKey(modelApiKey: Optional<String>) = modelApiKey(modelApiKey.getOrNull())
289+
fun modelApiKey(modelApiKey: String) = apply { this.modelApiKey = modelApiKey }
294290

295291
fun headers(headers: Headers) = apply {
296292
this.headers.clear()
@@ -383,7 +379,7 @@ private constructor(
383379
* |----------------------|--------------------------------|------------------------|--------|--------------------------------------------|
384380
* |`browserbaseApiKey` |`stagehand.browserbaseApiKey` |`BROWSERBASE_API_KEY` |true |- |
385381
* |`browserbaseProjectId`|`stagehand.browserbaseProjectId`|`BROWSERBASE_PROJECT_ID`|true |- |
386-
* |`modelApiKey` |`stagehand.modelApiKey` |`MODEL_API_KEY` |false |- |
382+
* |`modelApiKey` |`stagehand.modelApiKey` |`MODEL_API_KEY` |true |- |
387383
* |`baseUrl` |`stagehand.baseUrl` |`STAGEHAND_BASE_URL` |true |`"https://api.stagehand.browserbase.com/v1"`|
388384
*
389385
* System properties take precedence over environment variables.
@@ -413,6 +409,7 @@ private constructor(
413409
* .httpClient()
414410
* .browserbaseApiKey()
415411
* .browserbaseProjectId()
412+
* .modelApiKey()
416413
* ```
417414
*
418415
* @throws IllegalStateException if any required field is unset.
@@ -422,6 +419,7 @@ private constructor(
422419
val sleeper = sleeper ?: PhantomReachableSleeper(DefaultSleeper())
423420
val browserbaseApiKey = checkRequired("browserbaseApiKey", browserbaseApiKey)
424421
val browserbaseProjectId = checkRequired("browserbaseProjectId", browserbaseProjectId)
422+
val modelApiKey = checkRequired("modelApiKey", modelApiKey)
425423

426424
val headers = Headers.builder()
427425
val queryParams = QueryParams.builder()
@@ -442,7 +440,7 @@ private constructor(
442440
headers.put("x-bb-project-id", it)
443441
}
444442
}
445-
modelApiKey?.let {
443+
modelApiKey.let {
446444
if (!it.isEmpty()) {
447445
headers.put("x-model-api-key", it)
448446
}

0 commit comments

Comments
 (0)