diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index eba8a04..1887bd5 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "3.21.0"
+ ".": "3.22.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 15099ca..90ce078 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 8
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase/stagehand-c7910965e66e73ad8b65b6cc391d431094b2a6c6577c3e9d82feaa8138e74cff.yml
-openapi_spec_hash: 37748bb69c22a9ce721d9b5a5861f964
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase/stagehand-4d0d50b4f18fd74f58aca0b84d6968d1228499f2fa4e5714516f13ff6f820c9d.yml
+openapi_spec_hash: f7b1a869f3e412aea4d4bd42467791bb
config_hash: 1fb12ae9b478488bc1e56bfbdc210b01
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1677dfa..f6c9884 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,13 @@
# Changelog
+## 3.22.0 (2026-06-09)
+
+Full Changelog: [v3.21.0...v3.22.0](https://github.com/browserbase/stagehand-java/compare/v3.21.0...v3.22.0)
+
+### Features
+
+* [STG-2090] Add Azure Entra model auth support ([3f3c1fa](https://github.com/browserbase/stagehand-java/commit/3f3c1fa68b001bf721eceefe6f34ad4384662294))
+
## 3.21.0 (2026-05-29)
Full Changelog: [v3.20.0...v3.21.0](https://github.com/browserbase/stagehand-java/compare/v3.20.0...v3.21.0)
diff --git a/README.md b/README.md
index b18062f..915df1f 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
-[](https://central.sonatype.com/artifact/com.browserbase.api/stagehand-java/3.21.0)
-[](https://javadoc.io/doc/com.browserbase.api/stagehand-java/3.21.0)
+[](https://central.sonatype.com/artifact/com.browserbase.api/stagehand-java/3.22.0)
+[](https://javadoc.io/doc/com.browserbase.api/stagehand-java/3.22.0)
@@ -85,7 +85,7 @@ Most existing browser automation tools either require you to write low-level cod
### Gradle
```kotlin
-implementation("com.browserbase.api:stagehand-java:3.21.0")
+implementation("com.browserbase.api:stagehand-java:3.22.0")
```
### Maven
@@ -94,7 +94,7 @@ implementation("com.browserbase.api:stagehand-java:3.21.0")
com.browserbase.api
stagehand-java
- 3.21.0
+ 3.22.0
```
diff --git a/build.gradle.kts b/build.gradle.kts
index 2f55137..f75a874 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,7 +8,7 @@ repositories {
allprojects {
group = "com.browserbase.api"
- version = "3.21.0" // x-release-please-version
+ version = "3.22.0" // x-release-please-version
}
subprojects {
diff --git a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/ModelConfig.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/ModelConfig.kt
index b6cc034..6fdf433 100644
--- a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/ModelConfig.kt
+++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/ModelConfig.kt
@@ -35,6 +35,8 @@ import kotlin.jvm.optionals.getOrNull
class ModelConfig
private constructor(
private val vertexModelConfigObject: VertexModelConfigObject? = null,
+ private val azureEntraModelConfigObject: AzureEntraModelConfigObject? = null,
+ private val azureApiKeyModelConfigObject: AzureApiKeyModelConfigObject? = null,
private val genericModelConfigObject: GenericModelConfigObject? = null,
private val _json: JsonValue? = null,
) {
@@ -42,16 +44,32 @@ private constructor(
fun vertexModelConfigObject(): Optional =
Optional.ofNullable(vertexModelConfigObject)
+ fun azureEntraModelConfigObject(): Optional =
+ Optional.ofNullable(azureEntraModelConfigObject)
+
+ fun azureApiKeyModelConfigObject(): Optional =
+ Optional.ofNullable(azureApiKeyModelConfigObject)
+
fun genericModelConfigObject(): Optional =
Optional.ofNullable(genericModelConfigObject)
fun isVertexModelConfigObject(): Boolean = vertexModelConfigObject != null
+ fun isAzureEntraModelConfigObject(): Boolean = azureEntraModelConfigObject != null
+
+ fun isAzureApiKeyModelConfigObject(): Boolean = azureApiKeyModelConfigObject != null
+
fun isGenericModelConfigObject(): Boolean = genericModelConfigObject != null
fun asVertexModelConfigObject(): VertexModelConfigObject =
vertexModelConfigObject.getOrThrow("vertexModelConfigObject")
+ fun asAzureEntraModelConfigObject(): AzureEntraModelConfigObject =
+ azureEntraModelConfigObject.getOrThrow("azureEntraModelConfigObject")
+
+ fun asAzureApiKeyModelConfigObject(): AzureApiKeyModelConfigObject =
+ azureApiKeyModelConfigObject.getOrThrow("azureApiKeyModelConfigObject")
+
fun asGenericModelConfigObject(): GenericModelConfigObject =
genericModelConfigObject.getOrThrow("genericModelConfigObject")
@@ -90,6 +108,10 @@ private constructor(
when {
vertexModelConfigObject != null ->
visitor.visitVertexModelConfigObject(vertexModelConfigObject)
+ azureEntraModelConfigObject != null ->
+ visitor.visitAzureEntraModelConfigObject(azureEntraModelConfigObject)
+ azureApiKeyModelConfigObject != null ->
+ visitor.visitAzureApiKeyModelConfigObject(azureApiKeyModelConfigObject)
genericModelConfigObject != null ->
visitor.visitGenericModelConfigObject(genericModelConfigObject)
else -> visitor.unknown(_json)
@@ -118,6 +140,18 @@ private constructor(
vertexModelConfigObject.validate()
}
+ override fun visitAzureEntraModelConfigObject(
+ azureEntraModelConfigObject: AzureEntraModelConfigObject
+ ) {
+ azureEntraModelConfigObject.validate()
+ }
+
+ override fun visitAzureApiKeyModelConfigObject(
+ azureApiKeyModelConfigObject: AzureApiKeyModelConfigObject
+ ) {
+ azureApiKeyModelConfigObject.validate()
+ }
+
override fun visitGenericModelConfigObject(
genericModelConfigObject: GenericModelConfigObject
) {
@@ -149,6 +183,14 @@ private constructor(
vertexModelConfigObject: VertexModelConfigObject
) = vertexModelConfigObject.validity()
+ override fun visitAzureEntraModelConfigObject(
+ azureEntraModelConfigObject: AzureEntraModelConfigObject
+ ) = azureEntraModelConfigObject.validity()
+
+ override fun visitAzureApiKeyModelConfigObject(
+ azureApiKeyModelConfigObject: AzureApiKeyModelConfigObject
+ ) = azureApiKeyModelConfigObject.validity()
+
override fun visitGenericModelConfigObject(
genericModelConfigObject: GenericModelConfigObject
) = genericModelConfigObject.validity()
@@ -164,15 +206,27 @@ private constructor(
return other is ModelConfig &&
vertexModelConfigObject == other.vertexModelConfigObject &&
+ azureEntraModelConfigObject == other.azureEntraModelConfigObject &&
+ azureApiKeyModelConfigObject == other.azureApiKeyModelConfigObject &&
genericModelConfigObject == other.genericModelConfigObject
}
- override fun hashCode(): Int = Objects.hash(vertexModelConfigObject, genericModelConfigObject)
+ override fun hashCode(): Int =
+ Objects.hash(
+ vertexModelConfigObject,
+ azureEntraModelConfigObject,
+ azureApiKeyModelConfigObject,
+ genericModelConfigObject,
+ )
override fun toString(): String =
when {
vertexModelConfigObject != null ->
"ModelConfig{vertexModelConfigObject=$vertexModelConfigObject}"
+ azureEntraModelConfigObject != null ->
+ "ModelConfig{azureEntraModelConfigObject=$azureEntraModelConfigObject}"
+ azureApiKeyModelConfigObject != null ->
+ "ModelConfig{azureApiKeyModelConfigObject=$azureApiKeyModelConfigObject}"
genericModelConfigObject != null ->
"ModelConfig{genericModelConfigObject=$genericModelConfigObject}"
_json != null -> "ModelConfig{_unknown=$_json}"
@@ -185,6 +239,16 @@ private constructor(
fun ofVertexModelConfigObject(vertexModelConfigObject: VertexModelConfigObject) =
ModelConfig(vertexModelConfigObject = vertexModelConfigObject)
+ @JvmStatic
+ fun ofAzureEntraModelConfigObject(
+ azureEntraModelConfigObject: AzureEntraModelConfigObject
+ ) = ModelConfig(azureEntraModelConfigObject = azureEntraModelConfigObject)
+
+ @JvmStatic
+ fun ofAzureApiKeyModelConfigObject(
+ azureApiKeyModelConfigObject: AzureApiKeyModelConfigObject
+ ) = ModelConfig(azureApiKeyModelConfigObject = azureApiKeyModelConfigObject)
+
@JvmStatic
fun ofGenericModelConfigObject(genericModelConfigObject: GenericModelConfigObject) =
ModelConfig(genericModelConfigObject = genericModelConfigObject)
@@ -197,6 +261,14 @@ private constructor(
fun visitVertexModelConfigObject(vertexModelConfigObject: VertexModelConfigObject): T
+ fun visitAzureEntraModelConfigObject(
+ azureEntraModelConfigObject: AzureEntraModelConfigObject
+ ): T
+
+ fun visitAzureApiKeyModelConfigObject(
+ azureApiKeyModelConfigObject: AzureApiKeyModelConfigObject
+ ): T
+
fun visitGenericModelConfigObject(genericModelConfigObject: GenericModelConfigObject): T
/**
@@ -223,6 +295,12 @@ private constructor(
tryDeserialize(node, jacksonTypeRef())?.let {
ModelConfig(vertexModelConfigObject = it, _json = json)
},
+ tryDeserialize(node, jacksonTypeRef())?.let {
+ ModelConfig(azureEntraModelConfigObject = it, _json = json)
+ },
+ tryDeserialize(node, jacksonTypeRef())?.let {
+ ModelConfig(azureApiKeyModelConfigObject = it, _json = json)
+ },
tryDeserialize(node, jacksonTypeRef())?.let {
ModelConfig(genericModelConfigObject = it, _json = json)
},
@@ -252,6 +330,10 @@ private constructor(
when {
value.vertexModelConfigObject != null ->
generator.writeObject(value.vertexModelConfigObject)
+ value.azureEntraModelConfigObject != null ->
+ generator.writeObject(value.azureEntraModelConfigObject)
+ value.azureApiKeyModelConfigObject != null ->
+ generator.writeObject(value.azureApiKeyModelConfigObject)
value.genericModelConfigObject != null ->
generator.writeObject(value.genericModelConfigObject)
value._json != null -> generator.writeObject(value._json)
@@ -2689,6 +2771,2473 @@ private constructor(
"VertexModelConfigObject{auth=$auth, modelName=$modelName, provider=$provider, providerOptions=$providerOptions, apiKey=$apiKey, baseUrl=$baseUrl, headers=$headers, additionalProperties=$additionalProperties}"
}
+ class AzureEntraModelConfigObject
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val auth: JsonField,
+ private val modelName: JsonField,
+ private val provider: JsonValue,
+ private val providerOptions: JsonField,
+ private val baseUrl: JsonField,
+ private val headers: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("auth") @ExcludeMissing auth: JsonField = JsonMissing.of(),
+ @JsonProperty("modelName")
+ @ExcludeMissing
+ modelName: JsonField = JsonMissing.of(),
+ @JsonProperty("provider") @ExcludeMissing provider: JsonValue = JsonMissing.of(),
+ @JsonProperty("providerOptions")
+ @ExcludeMissing
+ providerOptions: JsonField = JsonMissing.of(),
+ @JsonProperty("baseURL") @ExcludeMissing baseUrl: JsonField = JsonMissing.of(),
+ @JsonProperty("headers") @ExcludeMissing headers: JsonField = JsonMissing.of(),
+ ) : this(auth, modelName, provider, providerOptions, baseUrl, headers, mutableMapOf())
+
+ /**
+ * Azure provider authentication configuration
+ *
+ * @throws StagehandInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun auth(): Auth = auth.getRequired("auth")
+
+ /**
+ * Model name string with provider prefix (e.g., 'openai/gpt-5-nano')
+ *
+ * @throws StagehandInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun modelName(): String = modelName.getRequired("modelName")
+
+ /**
+ * Azure OpenAI model provider
+ *
+ * Expected to always return the following:
+ * ```java
+ * JsonValue.from("azure")
+ * ```
+ *
+ * However, this method can be useful for debugging and logging (e.g. if the server
+ * responded with an unexpected value).
+ */
+ @JsonProperty("provider") @ExcludeMissing fun _provider(): JsonValue = provider
+
+ /**
+ * Azure provider-specific model configuration
+ *
+ * @throws StagehandInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun providerOptions(): ProviderOptions = providerOptions.getRequired("providerOptions")
+
+ /**
+ * Base URL for the model provider
+ *
+ * @throws StagehandInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun baseUrl(): Optional = baseUrl.getOptional("baseURL")
+
+ /**
+ * Custom headers sent with every request to the model provider
+ *
+ * @throws StagehandInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun headers(): Optional = headers.getOptional("headers")
+
+ /**
+ * Returns the raw JSON value of [auth].
+ *
+ * Unlike [auth], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("auth") @ExcludeMissing fun _auth(): JsonField = auth
+
+ /**
+ * Returns the raw JSON value of [modelName].
+ *
+ * Unlike [modelName], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("modelName") @ExcludeMissing fun _modelName(): JsonField = modelName
+
+ /**
+ * Returns the raw JSON value of [providerOptions].
+ *
+ * Unlike [providerOptions], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("providerOptions")
+ @ExcludeMissing
+ fun _providerOptions(): JsonField = providerOptions
+
+ /**
+ * Returns the raw JSON value of [baseUrl].
+ *
+ * Unlike [baseUrl], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("baseURL") @ExcludeMissing fun _baseUrl(): JsonField = baseUrl
+
+ /**
+ * Returns the raw JSON value of [headers].
+ *
+ * Unlike [headers], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("headers") @ExcludeMissing fun _headers(): JsonField = headers
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of
+ * [AzureEntraModelConfigObject].
+ *
+ * The following fields are required:
+ * ```java
+ * .auth()
+ * .modelName()
+ * .providerOptions()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [AzureEntraModelConfigObject]. */
+ class Builder internal constructor() {
+
+ private var auth: JsonField? = null
+ private var modelName: JsonField? = null
+ private var provider: JsonValue = JsonValue.from("azure")
+ private var providerOptions: JsonField? = null
+ private var baseUrl: JsonField = JsonMissing.of()
+ private var headers: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(azureEntraModelConfigObject: AzureEntraModelConfigObject) = apply {
+ auth = azureEntraModelConfigObject.auth
+ modelName = azureEntraModelConfigObject.modelName
+ provider = azureEntraModelConfigObject.provider
+ providerOptions = azureEntraModelConfigObject.providerOptions
+ baseUrl = azureEntraModelConfigObject.baseUrl
+ headers = azureEntraModelConfigObject.headers
+ additionalProperties =
+ azureEntraModelConfigObject.additionalProperties.toMutableMap()
+ }
+
+ /** Azure provider authentication configuration */
+ fun auth(auth: Auth) = auth(JsonField.of(auth))
+
+ /**
+ * Sets [Builder.auth] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.auth] with a well-typed [Auth] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun auth(auth: JsonField) = apply { this.auth = auth }
+
+ /** Model name string with provider prefix (e.g., 'openai/gpt-5-nano') */
+ fun modelName(modelName: String) = modelName(JsonField.of(modelName))
+
+ /**
+ * Sets [Builder.modelName] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.modelName] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun modelName(modelName: JsonField) = apply { this.modelName = modelName }
+
+ /**
+ * Sets the field to an arbitrary JSON value.
+ *
+ * It is usually unnecessary to call this method because the field defaults to the
+ * following:
+ * ```java
+ * JsonValue.from("azure")
+ * ```
+ *
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun provider(provider: JsonValue) = apply { this.provider = provider }
+
+ /** Azure provider-specific model configuration */
+ fun providerOptions(providerOptions: ProviderOptions) =
+ providerOptions(JsonField.of(providerOptions))
+
+ /**
+ * Sets [Builder.providerOptions] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.providerOptions] with a well-typed [ProviderOptions]
+ * value instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun providerOptions(providerOptions: JsonField) = apply {
+ this.providerOptions = providerOptions
+ }
+
+ /** Base URL for the model provider */
+ fun baseUrl(baseUrl: String) = baseUrl(JsonField.of(baseUrl))
+
+ /**
+ * Sets [Builder.baseUrl] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.baseUrl] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun baseUrl(baseUrl: JsonField) = apply { this.baseUrl = baseUrl }
+
+ /** Custom headers sent with every request to the model provider */
+ fun headers(headers: Headers) = headers(JsonField.of(headers))
+
+ /**
+ * Sets [Builder.headers] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.headers] with a well-typed [Headers] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun headers(headers: JsonField) = apply { this.headers = headers }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [AzureEntraModelConfigObject].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .auth()
+ * .modelName()
+ * .providerOptions()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): AzureEntraModelConfigObject =
+ AzureEntraModelConfigObject(
+ checkRequired("auth", auth),
+ checkRequired("modelName", modelName),
+ provider,
+ checkRequired("providerOptions", providerOptions),
+ baseUrl,
+ headers,
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): AzureEntraModelConfigObject = apply {
+ if (validated) {
+ return@apply
+ }
+
+ auth().validate()
+ modelName()
+ _provider().let {
+ if (it != JsonValue.from("azure")) {
+ throw StagehandInvalidDataException("'provider' is invalid, received $it")
+ }
+ }
+ providerOptions().validate()
+ baseUrl()
+ headers().ifPresent { it.validate() }
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: StagehandInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (auth.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (modelName.asKnown().isPresent) 1 else 0) +
+ provider.let { if (it == JsonValue.from("azure")) 1 else 0 } +
+ (providerOptions.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (baseUrl.asKnown().isPresent) 1 else 0) +
+ (headers.asKnown().getOrNull()?.validity() ?: 0)
+
+ /** Azure provider authentication configuration */
+ class Auth
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val token: JsonField,
+ private val type: JsonValue,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(),
+ @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(),
+ ) : this(token, type, mutableMapOf())
+
+ /**
+ * Microsoft Entra ID bearer token for Azure OpenAI
+ *
+ * @throws StagehandInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected
+ * value).
+ */
+ fun token(): String = token.getRequired("token")
+
+ /**
+ * Use a Microsoft Entra ID bearer token for authentication
+ *
+ * Expected to always return the following:
+ * ```java
+ * JsonValue.from("azureEntraId")
+ * ```
+ *
+ * However, this method can be useful for debugging and logging (e.g. if the server
+ * responded with an unexpected value).
+ */
+ @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type
+
+ /**
+ * Returns the raw JSON value of [token].
+ *
+ * Unlike [token], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("token") @ExcludeMissing fun _token(): JsonField = token
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [Auth].
+ *
+ * The following fields are required:
+ * ```java
+ * .token()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Auth]. */
+ class Builder internal constructor() {
+
+ private var token: JsonField? = null
+ private var type: JsonValue = JsonValue.from("azureEntraId")
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(auth: Auth) = apply {
+ token = auth.token
+ type = auth.type
+ additionalProperties = auth.additionalProperties.toMutableMap()
+ }
+
+ /** Microsoft Entra ID bearer token for Azure OpenAI */
+ fun token(token: String) = token(JsonField.of(token))
+
+ /**
+ * Sets [Builder.token] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.token] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun token(token: JsonField) = apply { this.token = token }
+
+ /**
+ * Sets the field to an arbitrary JSON value.
+ *
+ * It is usually unnecessary to call this method because the field defaults to the
+ * following:
+ * ```java
+ * JsonValue.from("azureEntraId")
+ * ```
+ *
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun type(type: JsonValue) = apply { this.type = type }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) =
+ apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply {
+ additionalProperties.remove(key)
+ }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [Auth].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .token()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): Auth =
+ Auth(checkRequired("token", token), type, additionalProperties.toMutableMap())
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
+ fun validate(): Auth = apply {
+ if (validated) {
+ return@apply
+ }
+
+ token()
+ _type().let {
+ if (it != JsonValue.from("azureEntraId")) {
+ throw StagehandInvalidDataException("'type' is invalid, received $it")
+ }
+ }
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: StagehandInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (token.asKnown().isPresent) 1 else 0) +
+ type.let { if (it == JsonValue.from("azureEntraId")) 1 else 0 }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Auth &&
+ token == other.token &&
+ type == other.type &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(token, type, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Auth{token=$token, type=$type, additionalProperties=$additionalProperties}"
+ }
+
+ /** Azure provider-specific model configuration */
+ class ProviderOptions
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val azure: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("azure") @ExcludeMissing azure: JsonField = JsonMissing.of()
+ ) : this(azure, mutableMapOf())
+
+ /**
+ * Azure OpenAI provider-specific settings
+ *
+ * @throws StagehandInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected
+ * value).
+ */
+ fun azure(): Azure = azure.getRequired("azure")
+
+ /**
+ * Returns the raw JSON value of [azure].
+ *
+ * Unlike [azure], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("azure") @ExcludeMissing fun _azure(): JsonField = azure
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [ProviderOptions].
+ *
+ * The following fields are required:
+ * ```java
+ * .azure()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [ProviderOptions]. */
+ class Builder internal constructor() {
+
+ private var azure: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(providerOptions: ProviderOptions) = apply {
+ azure = providerOptions.azure
+ additionalProperties = providerOptions.additionalProperties.toMutableMap()
+ }
+
+ /** Azure OpenAI provider-specific settings */
+ fun azure(azure: Azure) = azure(JsonField.of(azure))
+
+ /**
+ * Sets [Builder.azure] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.azure] with a well-typed [Azure] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun azure(azure: JsonField) = apply { this.azure = azure }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) =
+ apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply {
+ additionalProperties.remove(key)
+ }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [ProviderOptions].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .azure()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): ProviderOptions =
+ ProviderOptions(
+ checkRequired("azure", azure),
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
+ fun validate(): ProviderOptions = apply {
+ if (validated) {
+ return@apply
+ }
+
+ azure().validate()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: StagehandInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int = (azure.asKnown().getOrNull()?.validity() ?: 0)
+
+ /** Azure OpenAI provider-specific settings */
+ class Azure
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val apiVersion: JsonField,
+ private val baseUrl: JsonField,
+ private val headers: JsonField,
+ private val resourceName: JsonField,
+ private val useDeploymentBasedUrls: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("apiVersion")
+ @ExcludeMissing
+ apiVersion: JsonField = JsonMissing.of(),
+ @JsonProperty("baseURL")
+ @ExcludeMissing
+ baseUrl: JsonField = JsonMissing.of(),
+ @JsonProperty("headers")
+ @ExcludeMissing
+ headers: JsonField = JsonMissing.of(),
+ @JsonProperty("resourceName")
+ @ExcludeMissing
+ resourceName: JsonField = JsonMissing.of(),
+ @JsonProperty("useDeploymentBasedUrls")
+ @ExcludeMissing
+ useDeploymentBasedUrls: JsonField = JsonMissing.of(),
+ ) : this(
+ apiVersion,
+ baseUrl,
+ headers,
+ resourceName,
+ useDeploymentBasedUrls,
+ mutableMapOf(),
+ )
+
+ /**
+ * Azure OpenAI API version
+ *
+ * @throws StagehandInvalidDataException if the JSON field has an unexpected type
+ * (e.g. if the server responded with an unexpected value).
+ */
+ fun apiVersion(): Optional = apiVersion.getOptional("apiVersion")
+
+ /**
+ * Base URL for the Azure OpenAI provider
+ *
+ * @throws StagehandInvalidDataException if the JSON field has an unexpected type
+ * (e.g. if the server responded with an unexpected value).
+ */
+ fun baseUrl(): Optional = baseUrl.getOptional("baseURL")
+
+ /**
+ * Custom headers sent with every request to the Azure OpenAI provider
+ *
+ * @throws StagehandInvalidDataException if the JSON field has an unexpected type
+ * (e.g. if the server responded with an unexpected value).
+ */
+ fun headers(): Optional = headers.getOptional("headers")
+
+ /**
+ * Azure OpenAI resource name
+ *
+ * @throws StagehandInvalidDataException if the JSON field has an unexpected type
+ * (e.g. if the server responded with an unexpected value).
+ */
+ fun resourceName(): Optional = resourceName.getOptional("resourceName")
+
+ /**
+ * Whether to use deployment-based Azure OpenAI URLs
+ *
+ * @throws StagehandInvalidDataException if the JSON field has an unexpected type
+ * (e.g. if the server responded with an unexpected value).
+ */
+ fun useDeploymentBasedUrls(): Optional =
+ useDeploymentBasedUrls.getOptional("useDeploymentBasedUrls")
+
+ /**
+ * Returns the raw JSON value of [apiVersion].
+ *
+ * Unlike [apiVersion], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("apiVersion")
+ @ExcludeMissing
+ fun _apiVersion(): JsonField = apiVersion
+
+ /**
+ * Returns the raw JSON value of [baseUrl].
+ *
+ * Unlike [baseUrl], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("baseURL") @ExcludeMissing fun _baseUrl(): JsonField = baseUrl
+
+ /**
+ * Returns the raw JSON value of [headers].
+ *
+ * Unlike [headers], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("headers")
+ @ExcludeMissing
+ fun _headers(): JsonField = headers
+
+ /**
+ * Returns the raw JSON value of [resourceName].
+ *
+ * Unlike [resourceName], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("resourceName")
+ @ExcludeMissing
+ fun _resourceName(): JsonField = resourceName
+
+ /**
+ * Returns the raw JSON value of [useDeploymentBasedUrls].
+ *
+ * Unlike [useDeploymentBasedUrls], this method doesn't throw if the JSON field has
+ * an unexpected type.
+ */
+ @JsonProperty("useDeploymentBasedUrls")
+ @ExcludeMissing
+ fun _useDeploymentBasedUrls(): JsonField = useDeploymentBasedUrls
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /** Returns a mutable builder for constructing an instance of [Azure]. */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Azure]. */
+ class Builder internal constructor() {
+
+ private var apiVersion: JsonField = JsonMissing.of()
+ private var baseUrl: JsonField = JsonMissing.of()
+ private var headers: JsonField = JsonMissing.of()
+ private var resourceName: JsonField = JsonMissing.of()
+ private var useDeploymentBasedUrls: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(azure: Azure) = apply {
+ apiVersion = azure.apiVersion
+ baseUrl = azure.baseUrl
+ headers = azure.headers
+ resourceName = azure.resourceName
+ useDeploymentBasedUrls = azure.useDeploymentBasedUrls
+ additionalProperties = azure.additionalProperties.toMutableMap()
+ }
+
+ /** Azure OpenAI API version */
+ fun apiVersion(apiVersion: String) = apiVersion(JsonField.of(apiVersion))
+
+ /**
+ * Sets [Builder.apiVersion] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.apiVersion] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun apiVersion(apiVersion: JsonField) = apply {
+ this.apiVersion = apiVersion
+ }
+
+ /** Base URL for the Azure OpenAI provider */
+ fun baseUrl(baseUrl: String) = baseUrl(JsonField.of(baseUrl))
+
+ /**
+ * Sets [Builder.baseUrl] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.baseUrl] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun baseUrl(baseUrl: JsonField) = apply { this.baseUrl = baseUrl }
+
+ /** Custom headers sent with every request to the Azure OpenAI provider */
+ fun headers(headers: Headers) = headers(JsonField.of(headers))
+
+ /**
+ * Sets [Builder.headers] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.headers] with a well-typed [Headers] value
+ * instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun headers(headers: JsonField) = apply { this.headers = headers }
+
+ /** Azure OpenAI resource name */
+ fun resourceName(resourceName: String) =
+ resourceName(JsonField.of(resourceName))
+
+ /**
+ * Sets [Builder.resourceName] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.resourceName] with a well-typed [String]
+ * value instead. This method is primarily for setting the field to an
+ * undocumented or not yet supported value.
+ */
+ fun resourceName(resourceName: JsonField) = apply {
+ this.resourceName = resourceName
+ }
+
+ /** Whether to use deployment-based Azure OpenAI URLs */
+ fun useDeploymentBasedUrls(useDeploymentBasedUrls: Boolean) =
+ useDeploymentBasedUrls(JsonField.of(useDeploymentBasedUrls))
+
+ /**
+ * Sets [Builder.useDeploymentBasedUrls] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.useDeploymentBasedUrls] with a well-typed
+ * [Boolean] value instead. This method is primarily for setting the field to an
+ * undocumented or not yet supported value.
+ */
+ fun useDeploymentBasedUrls(useDeploymentBasedUrls: JsonField) = apply {
+ this.useDeploymentBasedUrls = useDeploymentBasedUrls
+ }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) =
+ apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply {
+ additionalProperties.remove(key)
+ }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [Azure].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): Azure =
+ Azure(
+ apiVersion,
+ baseUrl,
+ headers,
+ resourceName,
+ useDeploymentBasedUrls,
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't
+ * match its expected type.
+ */
+ fun validate(): Azure = apply {
+ if (validated) {
+ return@apply
+ }
+
+ apiVersion()
+ baseUrl()
+ headers().ifPresent { it.validate() }
+ resourceName()
+ useDeploymentBasedUrls()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: StagehandInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (apiVersion.asKnown().isPresent) 1 else 0) +
+ (if (baseUrl.asKnown().isPresent) 1 else 0) +
+ (headers.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (resourceName.asKnown().isPresent) 1 else 0) +
+ (if (useDeploymentBasedUrls.asKnown().isPresent) 1 else 0)
+
+ /** Custom headers sent with every request to the Azure OpenAI provider */
+ class Headers
+ @JsonCreator
+ private constructor(
+ @com.fasterxml.jackson.annotation.JsonValue
+ private val additionalProperties: Map
+ ) {
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map = additionalProperties
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /** Returns a mutable builder for constructing an instance of [Headers]. */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Headers]. */
+ class Builder internal constructor() {
+
+ private var additionalProperties: MutableMap =
+ mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(headers: Headers) = apply {
+ additionalProperties = headers.additionalProperties.toMutableMap()
+ }
+
+ fun additionalProperties(additionalProperties: Map) =
+ apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(
+ additionalProperties: Map
+ ) = apply { this.additionalProperties.putAll(additionalProperties) }
+
+ fun removeAdditionalProperty(key: String) = apply {
+ additionalProperties.remove(key)
+ }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [Headers].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): Headers = Headers(additionalProperties.toImmutable())
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected
+ * types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for
+ * existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object
+ * doesn't match its expected type.
+ */
+ fun validate(): Headers = apply {
+ if (validated) {
+ return@apply
+ }
+
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: StagehandInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) ->
+ !value.isNull() && !value.isMissing()
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Headers &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() = "Headers{additionalProperties=$additionalProperties}"
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Azure &&
+ apiVersion == other.apiVersion &&
+ baseUrl == other.baseUrl &&
+ headers == other.headers &&
+ resourceName == other.resourceName &&
+ useDeploymentBasedUrls == other.useDeploymentBasedUrls &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(
+ apiVersion,
+ baseUrl,
+ headers,
+ resourceName,
+ useDeploymentBasedUrls,
+ additionalProperties,
+ )
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Azure{apiVersion=$apiVersion, baseUrl=$baseUrl, headers=$headers, resourceName=$resourceName, useDeploymentBasedUrls=$useDeploymentBasedUrls, additionalProperties=$additionalProperties}"
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is ProviderOptions &&
+ azure == other.azure &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(azure, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "ProviderOptions{azure=$azure, additionalProperties=$additionalProperties}"
+ }
+
+ /** Custom headers sent with every request to the model provider */
+ class Headers
+ @JsonCreator
+ private constructor(
+ @com.fasterxml.jackson.annotation.JsonValue
+ private val additionalProperties: Map
+ ) {
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map = additionalProperties
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /** Returns a mutable builder for constructing an instance of [Headers]. */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Headers]. */
+ class Builder internal constructor() {
+
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(headers: Headers) = apply {
+ additionalProperties = headers.additionalProperties.toMutableMap()
+ }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) =
+ apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply {
+ additionalProperties.remove(key)
+ }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [Headers].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): Headers = Headers(additionalProperties.toImmutable())
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
+ fun validate(): Headers = apply {
+ if (validated) {
+ return@apply
+ }
+
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: StagehandInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Headers && additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() = "Headers{additionalProperties=$additionalProperties}"
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is AzureEntraModelConfigObject &&
+ auth == other.auth &&
+ modelName == other.modelName &&
+ provider == other.provider &&
+ providerOptions == other.providerOptions &&
+ baseUrl == other.baseUrl &&
+ headers == other.headers &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(
+ auth,
+ modelName,
+ provider,
+ providerOptions,
+ baseUrl,
+ headers,
+ additionalProperties,
+ )
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "AzureEntraModelConfigObject{auth=$auth, modelName=$modelName, provider=$provider, providerOptions=$providerOptions, baseUrl=$baseUrl, headers=$headers, additionalProperties=$additionalProperties}"
+ }
+
+ class AzureApiKeyModelConfigObject
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val modelName: JsonField,
+ private val provider: JsonValue,
+ private val providerOptions: JsonField,
+ private val apiKey: JsonField,
+ private val baseUrl: JsonField,
+ private val headers: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("modelName")
+ @ExcludeMissing
+ modelName: JsonField = JsonMissing.of(),
+ @JsonProperty("provider") @ExcludeMissing provider: JsonValue = JsonMissing.of(),
+ @JsonProperty("providerOptions")
+ @ExcludeMissing
+ providerOptions: JsonField = JsonMissing.of(),
+ @JsonProperty("apiKey") @ExcludeMissing apiKey: JsonField = JsonMissing.of(),
+ @JsonProperty("baseURL") @ExcludeMissing baseUrl: JsonField = JsonMissing.of(),
+ @JsonProperty("headers") @ExcludeMissing headers: JsonField = JsonMissing.of(),
+ ) : this(modelName, provider, providerOptions, apiKey, baseUrl, headers, mutableMapOf())
+
+ /**
+ * Model name string with provider prefix (e.g., 'openai/gpt-5-nano')
+ *
+ * @throws StagehandInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun modelName(): String = modelName.getRequired("modelName")
+
+ /**
+ * Azure OpenAI model provider
+ *
+ * Expected to always return the following:
+ * ```java
+ * JsonValue.from("azure")
+ * ```
+ *
+ * However, this method can be useful for debugging and logging (e.g. if the server
+ * responded with an unexpected value).
+ */
+ @JsonProperty("provider") @ExcludeMissing fun _provider(): JsonValue = provider
+
+ /**
+ * Azure provider-specific model configuration
+ *
+ * @throws StagehandInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun providerOptions(): ProviderOptions = providerOptions.getRequired("providerOptions")
+
+ /**
+ * API key for the model provider
+ *
+ * @throws StagehandInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun apiKey(): Optional = apiKey.getOptional("apiKey")
+
+ /**
+ * Base URL for the model provider
+ *
+ * @throws StagehandInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun baseUrl(): Optional = baseUrl.getOptional("baseURL")
+
+ /**
+ * Custom headers sent with every request to the model provider
+ *
+ * @throws StagehandInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun headers(): Optional = headers.getOptional("headers")
+
+ /**
+ * Returns the raw JSON value of [modelName].
+ *
+ * Unlike [modelName], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("modelName") @ExcludeMissing fun _modelName(): JsonField = modelName
+
+ /**
+ * Returns the raw JSON value of [providerOptions].
+ *
+ * Unlike [providerOptions], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("providerOptions")
+ @ExcludeMissing
+ fun _providerOptions(): JsonField = providerOptions
+
+ /**
+ * Returns the raw JSON value of [apiKey].
+ *
+ * Unlike [apiKey], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("apiKey") @ExcludeMissing fun _apiKey(): JsonField = apiKey
+
+ /**
+ * Returns the raw JSON value of [baseUrl].
+ *
+ * Unlike [baseUrl], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("baseURL") @ExcludeMissing fun _baseUrl(): JsonField = baseUrl
+
+ /**
+ * Returns the raw JSON value of [headers].
+ *
+ * Unlike [headers], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("headers") @ExcludeMissing fun _headers(): JsonField = headers
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of
+ * [AzureApiKeyModelConfigObject].
+ *
+ * The following fields are required:
+ * ```java
+ * .modelName()
+ * .providerOptions()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [AzureApiKeyModelConfigObject]. */
+ class Builder internal constructor() {
+
+ private var modelName: JsonField? = null
+ private var provider: JsonValue = JsonValue.from("azure")
+ private var providerOptions: JsonField? = null
+ private var apiKey: JsonField = JsonMissing.of()
+ private var baseUrl: JsonField = JsonMissing.of()
+ private var headers: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(azureApiKeyModelConfigObject: AzureApiKeyModelConfigObject) = apply {
+ modelName = azureApiKeyModelConfigObject.modelName
+ provider = azureApiKeyModelConfigObject.provider
+ providerOptions = azureApiKeyModelConfigObject.providerOptions
+ apiKey = azureApiKeyModelConfigObject.apiKey
+ baseUrl = azureApiKeyModelConfigObject.baseUrl
+ headers = azureApiKeyModelConfigObject.headers
+ additionalProperties =
+ azureApiKeyModelConfigObject.additionalProperties.toMutableMap()
+ }
+
+ /** Model name string with provider prefix (e.g., 'openai/gpt-5-nano') */
+ fun modelName(modelName: String) = modelName(JsonField.of(modelName))
+
+ /**
+ * Sets [Builder.modelName] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.modelName] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun modelName(modelName: JsonField) = apply { this.modelName = modelName }
+
+ /**
+ * Sets the field to an arbitrary JSON value.
+ *
+ * It is usually unnecessary to call this method because the field defaults to the
+ * following:
+ * ```java
+ * JsonValue.from("azure")
+ * ```
+ *
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun provider(provider: JsonValue) = apply { this.provider = provider }
+
+ /** Azure provider-specific model configuration */
+ fun providerOptions(providerOptions: ProviderOptions) =
+ providerOptions(JsonField.of(providerOptions))
+
+ /**
+ * Sets [Builder.providerOptions] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.providerOptions] with a well-typed [ProviderOptions]
+ * value instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun providerOptions(providerOptions: JsonField) = apply {
+ this.providerOptions = providerOptions
+ }
+
+ /** API key for the model provider */
+ fun apiKey(apiKey: String) = apiKey(JsonField.of(apiKey))
+
+ /**
+ * Sets [Builder.apiKey] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.apiKey] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun apiKey(apiKey: JsonField) = apply { this.apiKey = apiKey }
+
+ /** Base URL for the model provider */
+ fun baseUrl(baseUrl: String) = baseUrl(JsonField.of(baseUrl))
+
+ /**
+ * Sets [Builder.baseUrl] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.baseUrl] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun baseUrl(baseUrl: JsonField) = apply { this.baseUrl = baseUrl }
+
+ /** Custom headers sent with every request to the model provider */
+ fun headers(headers: Headers) = headers(JsonField.of(headers))
+
+ /**
+ * Sets [Builder.headers] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.headers] with a well-typed [Headers] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun headers(headers: JsonField) = apply { this.headers = headers }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [AzureApiKeyModelConfigObject].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .modelName()
+ * .providerOptions()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): AzureApiKeyModelConfigObject =
+ AzureApiKeyModelConfigObject(
+ checkRequired("modelName", modelName),
+ provider,
+ checkRequired("providerOptions", providerOptions),
+ apiKey,
+ baseUrl,
+ headers,
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): AzureApiKeyModelConfigObject = apply {
+ if (validated) {
+ return@apply
+ }
+
+ modelName()
+ _provider().let {
+ if (it != JsonValue.from("azure")) {
+ throw StagehandInvalidDataException("'provider' is invalid, received $it")
+ }
+ }
+ providerOptions().validate()
+ apiKey()
+ baseUrl()
+ headers().ifPresent { it.validate() }
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: StagehandInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (modelName.asKnown().isPresent) 1 else 0) +
+ provider.let { if (it == JsonValue.from("azure")) 1 else 0 } +
+ (providerOptions.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (apiKey.asKnown().isPresent) 1 else 0) +
+ (if (baseUrl.asKnown().isPresent) 1 else 0) +
+ (headers.asKnown().getOrNull()?.validity() ?: 0)
+
+ /** Azure provider-specific model configuration */
+ class ProviderOptions
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val azure: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("azure") @ExcludeMissing azure: JsonField = JsonMissing.of()
+ ) : this(azure, mutableMapOf())
+
+ /**
+ * Azure OpenAI provider-specific settings
+ *
+ * @throws StagehandInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected
+ * value).
+ */
+ fun azure(): Azure = azure.getRequired("azure")
+
+ /**
+ * Returns the raw JSON value of [azure].
+ *
+ * Unlike [azure], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("azure") @ExcludeMissing fun _azure(): JsonField = azure
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [ProviderOptions].
+ *
+ * The following fields are required:
+ * ```java
+ * .azure()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [ProviderOptions]. */
+ class Builder internal constructor() {
+
+ private var azure: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(providerOptions: ProviderOptions) = apply {
+ azure = providerOptions.azure
+ additionalProperties = providerOptions.additionalProperties.toMutableMap()
+ }
+
+ /** Azure OpenAI provider-specific settings */
+ fun azure(azure: Azure) = azure(JsonField.of(azure))
+
+ /**
+ * Sets [Builder.azure] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.azure] with a well-typed [Azure] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun azure(azure: JsonField) = apply { this.azure = azure }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) =
+ apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply {
+ additionalProperties.remove(key)
+ }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [ProviderOptions].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .azure()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): ProviderOptions =
+ ProviderOptions(
+ checkRequired("azure", azure),
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
+ fun validate(): ProviderOptions = apply {
+ if (validated) {
+ return@apply
+ }
+
+ azure().validate()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: StagehandInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int = (azure.asKnown().getOrNull()?.validity() ?: 0)
+
+ /** Azure OpenAI provider-specific settings */
+ class Azure
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val apiVersion: JsonField,
+ private val baseUrl: JsonField,
+ private val headers: JsonField,
+ private val resourceName: JsonField,
+ private val useDeploymentBasedUrls: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("apiVersion")
+ @ExcludeMissing
+ apiVersion: JsonField = JsonMissing.of(),
+ @JsonProperty("baseURL")
+ @ExcludeMissing
+ baseUrl: JsonField = JsonMissing.of(),
+ @JsonProperty("headers")
+ @ExcludeMissing
+ headers: JsonField = JsonMissing.of(),
+ @JsonProperty("resourceName")
+ @ExcludeMissing
+ resourceName: JsonField = JsonMissing.of(),
+ @JsonProperty("useDeploymentBasedUrls")
+ @ExcludeMissing
+ useDeploymentBasedUrls: JsonField = JsonMissing.of(),
+ ) : this(
+ apiVersion,
+ baseUrl,
+ headers,
+ resourceName,
+ useDeploymentBasedUrls,
+ mutableMapOf(),
+ )
+
+ /**
+ * Azure OpenAI API version
+ *
+ * @throws StagehandInvalidDataException if the JSON field has an unexpected type
+ * (e.g. if the server responded with an unexpected value).
+ */
+ fun apiVersion(): Optional = apiVersion.getOptional("apiVersion")
+
+ /**
+ * Base URL for the Azure OpenAI provider
+ *
+ * @throws StagehandInvalidDataException if the JSON field has an unexpected type
+ * (e.g. if the server responded with an unexpected value).
+ */
+ fun baseUrl(): Optional = baseUrl.getOptional("baseURL")
+
+ /**
+ * Custom headers sent with every request to the Azure OpenAI provider
+ *
+ * @throws StagehandInvalidDataException if the JSON field has an unexpected type
+ * (e.g. if the server responded with an unexpected value).
+ */
+ fun headers(): Optional = headers.getOptional("headers")
+
+ /**
+ * Azure OpenAI resource name
+ *
+ * @throws StagehandInvalidDataException if the JSON field has an unexpected type
+ * (e.g. if the server responded with an unexpected value).
+ */
+ fun resourceName(): Optional = resourceName.getOptional("resourceName")
+
+ /**
+ * Whether to use deployment-based Azure OpenAI URLs
+ *
+ * @throws StagehandInvalidDataException if the JSON field has an unexpected type
+ * (e.g. if the server responded with an unexpected value).
+ */
+ fun useDeploymentBasedUrls(): Optional =
+ useDeploymentBasedUrls.getOptional("useDeploymentBasedUrls")
+
+ /**
+ * Returns the raw JSON value of [apiVersion].
+ *
+ * Unlike [apiVersion], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("apiVersion")
+ @ExcludeMissing
+ fun _apiVersion(): JsonField = apiVersion
+
+ /**
+ * Returns the raw JSON value of [baseUrl].
+ *
+ * Unlike [baseUrl], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("baseURL") @ExcludeMissing fun _baseUrl(): JsonField = baseUrl
+
+ /**
+ * Returns the raw JSON value of [headers].
+ *
+ * Unlike [headers], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("headers")
+ @ExcludeMissing
+ fun _headers(): JsonField = headers
+
+ /**
+ * Returns the raw JSON value of [resourceName].
+ *
+ * Unlike [resourceName], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("resourceName")
+ @ExcludeMissing
+ fun _resourceName(): JsonField = resourceName
+
+ /**
+ * Returns the raw JSON value of [useDeploymentBasedUrls].
+ *
+ * Unlike [useDeploymentBasedUrls], this method doesn't throw if the JSON field has
+ * an unexpected type.
+ */
+ @JsonProperty("useDeploymentBasedUrls")
+ @ExcludeMissing
+ fun _useDeploymentBasedUrls(): JsonField = useDeploymentBasedUrls
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /** Returns a mutable builder for constructing an instance of [Azure]. */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Azure]. */
+ class Builder internal constructor() {
+
+ private var apiVersion: JsonField = JsonMissing.of()
+ private var baseUrl: JsonField = JsonMissing.of()
+ private var headers: JsonField = JsonMissing.of()
+ private var resourceName: JsonField = JsonMissing.of()
+ private var useDeploymentBasedUrls: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(azure: Azure) = apply {
+ apiVersion = azure.apiVersion
+ baseUrl = azure.baseUrl
+ headers = azure.headers
+ resourceName = azure.resourceName
+ useDeploymentBasedUrls = azure.useDeploymentBasedUrls
+ additionalProperties = azure.additionalProperties.toMutableMap()
+ }
+
+ /** Azure OpenAI API version */
+ fun apiVersion(apiVersion: String) = apiVersion(JsonField.of(apiVersion))
+
+ /**
+ * Sets [Builder.apiVersion] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.apiVersion] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun apiVersion(apiVersion: JsonField) = apply {
+ this.apiVersion = apiVersion
+ }
+
+ /** Base URL for the Azure OpenAI provider */
+ fun baseUrl(baseUrl: String) = baseUrl(JsonField.of(baseUrl))
+
+ /**
+ * Sets [Builder.baseUrl] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.baseUrl] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun baseUrl(baseUrl: JsonField) = apply { this.baseUrl = baseUrl }
+
+ /** Custom headers sent with every request to the Azure OpenAI provider */
+ fun headers(headers: Headers) = headers(JsonField.of(headers))
+
+ /**
+ * Sets [Builder.headers] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.headers] with a well-typed [Headers] value
+ * instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun headers(headers: JsonField) = apply { this.headers = headers }
+
+ /** Azure OpenAI resource name */
+ fun resourceName(resourceName: String) =
+ resourceName(JsonField.of(resourceName))
+
+ /**
+ * Sets [Builder.resourceName] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.resourceName] with a well-typed [String]
+ * value instead. This method is primarily for setting the field to an
+ * undocumented or not yet supported value.
+ */
+ fun resourceName(resourceName: JsonField) = apply {
+ this.resourceName = resourceName
+ }
+
+ /** Whether to use deployment-based Azure OpenAI URLs */
+ fun useDeploymentBasedUrls(useDeploymentBasedUrls: Boolean) =
+ useDeploymentBasedUrls(JsonField.of(useDeploymentBasedUrls))
+
+ /**
+ * Sets [Builder.useDeploymentBasedUrls] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.useDeploymentBasedUrls] with a well-typed
+ * [Boolean] value instead. This method is primarily for setting the field to an
+ * undocumented or not yet supported value.
+ */
+ fun useDeploymentBasedUrls(useDeploymentBasedUrls: JsonField) = apply {
+ this.useDeploymentBasedUrls = useDeploymentBasedUrls
+ }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) =
+ apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply {
+ additionalProperties.remove(key)
+ }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [Azure].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): Azure =
+ Azure(
+ apiVersion,
+ baseUrl,
+ headers,
+ resourceName,
+ useDeploymentBasedUrls,
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't
+ * match its expected type.
+ */
+ fun validate(): Azure = apply {
+ if (validated) {
+ return@apply
+ }
+
+ apiVersion()
+ baseUrl()
+ headers().ifPresent { it.validate() }
+ resourceName()
+ useDeploymentBasedUrls()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: StagehandInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (apiVersion.asKnown().isPresent) 1 else 0) +
+ (if (baseUrl.asKnown().isPresent) 1 else 0) +
+ (headers.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (resourceName.asKnown().isPresent) 1 else 0) +
+ (if (useDeploymentBasedUrls.asKnown().isPresent) 1 else 0)
+
+ /** Custom headers sent with every request to the Azure OpenAI provider */
+ class Headers
+ @JsonCreator
+ private constructor(
+ @com.fasterxml.jackson.annotation.JsonValue
+ private val additionalProperties: Map
+ ) {
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map = additionalProperties
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /** Returns a mutable builder for constructing an instance of [Headers]. */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Headers]. */
+ class Builder internal constructor() {
+
+ private var additionalProperties: MutableMap =
+ mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(headers: Headers) = apply {
+ additionalProperties = headers.additionalProperties.toMutableMap()
+ }
+
+ fun additionalProperties(additionalProperties: Map) =
+ apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(
+ additionalProperties: Map
+ ) = apply { this.additionalProperties.putAll(additionalProperties) }
+
+ fun removeAdditionalProperty(key: String) = apply {
+ additionalProperties.remove(key)
+ }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [Headers].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): Headers = Headers(additionalProperties.toImmutable())
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected
+ * types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for
+ * existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object
+ * doesn't match its expected type.
+ */
+ fun validate(): Headers = apply {
+ if (validated) {
+ return@apply
+ }
+
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: StagehandInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) ->
+ !value.isNull() && !value.isMissing()
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Headers &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() = "Headers{additionalProperties=$additionalProperties}"
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Azure &&
+ apiVersion == other.apiVersion &&
+ baseUrl == other.baseUrl &&
+ headers == other.headers &&
+ resourceName == other.resourceName &&
+ useDeploymentBasedUrls == other.useDeploymentBasedUrls &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(
+ apiVersion,
+ baseUrl,
+ headers,
+ resourceName,
+ useDeploymentBasedUrls,
+ additionalProperties,
+ )
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Azure{apiVersion=$apiVersion, baseUrl=$baseUrl, headers=$headers, resourceName=$resourceName, useDeploymentBasedUrls=$useDeploymentBasedUrls, additionalProperties=$additionalProperties}"
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is ProviderOptions &&
+ azure == other.azure &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(azure, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "ProviderOptions{azure=$azure, additionalProperties=$additionalProperties}"
+ }
+
+ /** Custom headers sent with every request to the model provider */
+ class Headers
+ @JsonCreator
+ private constructor(
+ @com.fasterxml.jackson.annotation.JsonValue
+ private val additionalProperties: Map
+ ) {
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map = additionalProperties
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /** Returns a mutable builder for constructing an instance of [Headers]. */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Headers]. */
+ class Builder internal constructor() {
+
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(headers: Headers) = apply {
+ additionalProperties = headers.additionalProperties.toMutableMap()
+ }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) =
+ apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply {
+ additionalProperties.remove(key)
+ }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [Headers].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): Headers = Headers(additionalProperties.toImmutable())
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
+ fun validate(): Headers = apply {
+ if (validated) {
+ return@apply
+ }
+
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: StagehandInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Headers && additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() = "Headers{additionalProperties=$additionalProperties}"
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is AzureApiKeyModelConfigObject &&
+ modelName == other.modelName &&
+ provider == other.provider &&
+ providerOptions == other.providerOptions &&
+ apiKey == other.apiKey &&
+ baseUrl == other.baseUrl &&
+ headers == other.headers &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(
+ modelName,
+ provider,
+ providerOptions,
+ apiKey,
+ baseUrl,
+ headers,
+ additionalProperties,
+ )
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "AzureApiKeyModelConfigObject{modelName=$modelName, provider=$provider, providerOptions=$providerOptions, apiKey=$apiKey, baseUrl=$baseUrl, headers=$headers, additionalProperties=$additionalProperties}"
+ }
+
class GenericModelConfigObject
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
diff --git a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionActParams.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionActParams.kt
index 3085f28..27b63b0 100644
--- a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionActParams.kt
+++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionActParams.kt
@@ -936,6 +936,20 @@ private constructor(
fun model(vertexModelConfigObject: Model.VertexModelConfigObject) =
model(Model.ofVertexModelConfigObject(vertexModelConfigObject))
+ /**
+ * Alias for calling [model] with
+ * `Model.ofAzureEntraModelConfigObject(azureEntraModelConfigObject)`.
+ */
+ fun model(azureEntraModelConfigObject: Model.AzureEntraModelConfigObject) =
+ model(Model.ofAzureEntraModelConfigObject(azureEntraModelConfigObject))
+
+ /**
+ * Alias for calling [model] with
+ * `Model.ofAzureApiKeyModelConfigObject(azureApiKeyModelConfigObject)`.
+ */
+ fun model(azureApiKeyModelConfigObject: Model.AzureApiKeyModelConfigObject) =
+ model(Model.ofAzureApiKeyModelConfigObject(azureApiKeyModelConfigObject))
+
/**
* Alias for calling [model] with
* `Model.ofGenericModelConfigObject(genericModelConfigObject)`.
@@ -1049,6 +1063,8 @@ private constructor(
class Model
private constructor(
private val vertexModelConfigObject: VertexModelConfigObject? = null,
+ private val azureEntraModelConfigObject: AzureEntraModelConfigObject? = null,
+ private val azureApiKeyModelConfigObject: AzureApiKeyModelConfigObject? = null,
private val genericModelConfigObject: GenericModelConfigObject? = null,
private val string: String? = null,
private val _json: JsonValue? = null,
@@ -1057,6 +1073,12 @@ private constructor(
fun vertexModelConfigObject(): Optional =
Optional.ofNullable(vertexModelConfigObject)
+ fun azureEntraModelConfigObject(): Optional =
+ Optional.ofNullable(azureEntraModelConfigObject)
+
+ fun azureApiKeyModelConfigObject(): Optional =
+ Optional.ofNullable(azureApiKeyModelConfigObject)
+
fun genericModelConfigObject(): Optional =
Optional.ofNullable(genericModelConfigObject)
@@ -1064,6 +1086,10 @@ private constructor(
fun isVertexModelConfigObject(): Boolean = vertexModelConfigObject != null
+ fun isAzureEntraModelConfigObject(): Boolean = azureEntraModelConfigObject != null
+
+ fun isAzureApiKeyModelConfigObject(): Boolean = azureApiKeyModelConfigObject != null
+
fun isGenericModelConfigObject(): Boolean = genericModelConfigObject != null
fun isString(): Boolean = string != null
@@ -1071,6 +1097,12 @@ private constructor(
fun asVertexModelConfigObject(): VertexModelConfigObject =
vertexModelConfigObject.getOrThrow("vertexModelConfigObject")
+ fun asAzureEntraModelConfigObject(): AzureEntraModelConfigObject =
+ azureEntraModelConfigObject.getOrThrow("azureEntraModelConfigObject")
+
+ fun asAzureApiKeyModelConfigObject(): AzureApiKeyModelConfigObject =
+ azureApiKeyModelConfigObject.getOrThrow("azureApiKeyModelConfigObject")
+
fun asGenericModelConfigObject(): GenericModelConfigObject =
genericModelConfigObject.getOrThrow("genericModelConfigObject")
@@ -1112,6 +1144,10 @@ private constructor(
when {
vertexModelConfigObject != null ->
visitor.visitVertexModelConfigObject(vertexModelConfigObject)
+ azureEntraModelConfigObject != null ->
+ visitor.visitAzureEntraModelConfigObject(azureEntraModelConfigObject)
+ azureApiKeyModelConfigObject != null ->
+ visitor.visitAzureApiKeyModelConfigObject(azureApiKeyModelConfigObject)
genericModelConfigObject != null ->
visitor.visitGenericModelConfigObject(genericModelConfigObject)
string != null -> visitor.visitString(string)
@@ -1143,6 +1179,18 @@ private constructor(
vertexModelConfigObject.validate()
}
+ override fun visitAzureEntraModelConfigObject(
+ azureEntraModelConfigObject: AzureEntraModelConfigObject
+ ) {
+ azureEntraModelConfigObject.validate()
+ }
+
+ override fun visitAzureApiKeyModelConfigObject(
+ azureApiKeyModelConfigObject: AzureApiKeyModelConfigObject
+ ) {
+ azureApiKeyModelConfigObject.validate()
+ }
+
override fun visitGenericModelConfigObject(
genericModelConfigObject: GenericModelConfigObject
) {
@@ -1177,6 +1225,14 @@ private constructor(
vertexModelConfigObject: VertexModelConfigObject
) = vertexModelConfigObject.validity()
+ override fun visitAzureEntraModelConfigObject(
+ azureEntraModelConfigObject: AzureEntraModelConfigObject
+ ) = azureEntraModelConfigObject.validity()
+
+ override fun visitAzureApiKeyModelConfigObject(
+ azureApiKeyModelConfigObject: AzureApiKeyModelConfigObject
+ ) = azureApiKeyModelConfigObject.validity()
+
override fun visitGenericModelConfigObject(
genericModelConfigObject: GenericModelConfigObject
) = genericModelConfigObject.validity()
@@ -1194,17 +1250,29 @@ private constructor(
return other is Model &&
vertexModelConfigObject == other.vertexModelConfigObject &&
+ azureEntraModelConfigObject == other.azureEntraModelConfigObject &&
+ azureApiKeyModelConfigObject == other.azureApiKeyModelConfigObject &&
genericModelConfigObject == other.genericModelConfigObject &&
string == other.string
}
override fun hashCode(): Int =
- Objects.hash(vertexModelConfigObject, genericModelConfigObject, string)
+ Objects.hash(
+ vertexModelConfigObject,
+ azureEntraModelConfigObject,
+ azureApiKeyModelConfigObject,
+ genericModelConfigObject,
+ string,
+ )
override fun toString(): String =
when {
vertexModelConfigObject != null ->
"Model{vertexModelConfigObject=$vertexModelConfigObject}"
+ azureEntraModelConfigObject != null ->
+ "Model{azureEntraModelConfigObject=$azureEntraModelConfigObject}"
+ azureApiKeyModelConfigObject != null ->
+ "Model{azureApiKeyModelConfigObject=$azureApiKeyModelConfigObject}"
genericModelConfigObject != null ->
"Model{genericModelConfigObject=$genericModelConfigObject}"
string != null -> "Model{string=$string}"
@@ -1218,6 +1286,16 @@ private constructor(
fun ofVertexModelConfigObject(vertexModelConfigObject: VertexModelConfigObject) =
Model(vertexModelConfigObject = vertexModelConfigObject)
+ @JvmStatic
+ fun ofAzureEntraModelConfigObject(
+ azureEntraModelConfigObject: AzureEntraModelConfigObject
+ ) = Model(azureEntraModelConfigObject = azureEntraModelConfigObject)
+
+ @JvmStatic
+ fun ofAzureApiKeyModelConfigObject(
+ azureApiKeyModelConfigObject: AzureApiKeyModelConfigObject
+ ) = Model(azureApiKeyModelConfigObject = azureApiKeyModelConfigObject)
+
@JvmStatic
fun ofGenericModelConfigObject(genericModelConfigObject: GenericModelConfigObject) =
Model(genericModelConfigObject = genericModelConfigObject)
@@ -1234,6 +1312,14 @@ private constructor(
vertexModelConfigObject: VertexModelConfigObject
): T
+ fun visitAzureEntraModelConfigObject(
+ azureEntraModelConfigObject: AzureEntraModelConfigObject
+ ): T
+
+ fun visitAzureApiKeyModelConfigObject(
+ azureApiKeyModelConfigObject: AzureApiKeyModelConfigObject
+ ): T
+
fun visitGenericModelConfigObject(
genericModelConfigObject: GenericModelConfigObject
): T
@@ -1264,6 +1350,12 @@ private constructor(
sequenceOf(
tryDeserialize(node, jacksonTypeRef())
?.let { Model(vertexModelConfigObject = it, _json = json) },
+ tryDeserialize(node, jacksonTypeRef())
+ ?.let { Model(azureEntraModelConfigObject = it, _json = json) },
+ tryDeserialize(node, jacksonTypeRef())
+ ?.let {
+ Model(azureApiKeyModelConfigObject = it, _json = json)
+ },
tryDeserialize(node, jacksonTypeRef())
?.let { Model(genericModelConfigObject = it, _json = json) },
tryDeserialize(node, jacksonTypeRef())?.let {
@@ -1296,6 +1388,10 @@ private constructor(
when {
value.vertexModelConfigObject != null ->
generator.writeObject(value.vertexModelConfigObject)
+ value.azureEntraModelConfigObject != null ->
+ generator.writeObject(value.azureEntraModelConfigObject)
+ value.azureApiKeyModelConfigObject != null ->
+ generator.writeObject(value.azureApiKeyModelConfigObject)
value.genericModelConfigObject != null ->
generator.writeObject(value.genericModelConfigObject)
value.string != null -> generator.writeObject(value.string)
@@ -3838,6 +3934,2624 @@ private constructor(
"VertexModelConfigObject{auth=$auth, modelName=$modelName, provider=$provider, providerOptions=$providerOptions, apiKey=$apiKey, baseUrl=$baseUrl, headers=$headers, additionalProperties=$additionalProperties}"
}
+ class AzureEntraModelConfigObject
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val auth: JsonField,
+ private val modelName: JsonField,
+ private val provider: JsonValue,
+ private val providerOptions: JsonField,
+ private val baseUrl: JsonField,
+ private val headers: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("auth") @ExcludeMissing auth: JsonField = JsonMissing.of(),
+ @JsonProperty("modelName")
+ @ExcludeMissing
+ modelName: JsonField = JsonMissing.of(),
+ @JsonProperty("provider")
+ @ExcludeMissing
+ provider: JsonValue = JsonMissing.of(),
+ @JsonProperty("providerOptions")
+ @ExcludeMissing
+ providerOptions: JsonField = JsonMissing.of(),
+ @JsonProperty("baseURL")
+ @ExcludeMissing
+ baseUrl: JsonField = JsonMissing.of(),
+ @JsonProperty("headers")
+ @ExcludeMissing
+ headers: JsonField = JsonMissing.of(),
+ ) : this(
+ auth,
+ modelName,
+ provider,
+ providerOptions,
+ baseUrl,
+ headers,
+ mutableMapOf(),
+ )
+
+ /**
+ * Azure provider authentication configuration
+ *
+ * @throws StagehandInvalidDataException if the JSON field has an unexpected type or
+ * is unexpectedly missing or null (e.g. if the server responded with an
+ * unexpected value).
+ */
+ fun auth(): Auth = auth.getRequired("auth")
+
+ /**
+ * Model name string with provider prefix (e.g., 'openai/gpt-5-nano')
+ *
+ * @throws StagehandInvalidDataException if the JSON field has an unexpected type or
+ * is unexpectedly missing or null (e.g. if the server responded with an
+ * unexpected value).
+ */
+ fun modelName(): String = modelName.getRequired("modelName")
+
+ /**
+ * Azure OpenAI model provider
+ *
+ * Expected to always return the following:
+ * ```java
+ * JsonValue.from("azure")
+ * ```
+ *
+ * However, this method can be useful for debugging and logging (e.g. if the server
+ * responded with an unexpected value).
+ */
+ @JsonProperty("provider") @ExcludeMissing fun _provider(): JsonValue = provider
+
+ /**
+ * Azure provider-specific model configuration
+ *
+ * @throws StagehandInvalidDataException if the JSON field has an unexpected type or
+ * is unexpectedly missing or null (e.g. if the server responded with an
+ * unexpected value).
+ */
+ fun providerOptions(): ProviderOptions =
+ providerOptions.getRequired("providerOptions")
+
+ /**
+ * Base URL for the model provider
+ *
+ * @throws StagehandInvalidDataException if the JSON field has an unexpected type
+ * (e.g. if the server responded with an unexpected value).
+ */
+ fun baseUrl(): Optional = baseUrl.getOptional("baseURL")
+
+ /**
+ * Custom headers sent with every request to the model provider
+ *
+ * @throws StagehandInvalidDataException if the JSON field has an unexpected type
+ * (e.g. if the server responded with an unexpected value).
+ */
+ fun headers(): Optional = headers.getOptional("headers")
+
+ /**
+ * Returns the raw JSON value of [auth].
+ *
+ * Unlike [auth], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("auth") @ExcludeMissing fun _auth(): JsonField = auth
+
+ /**
+ * Returns the raw JSON value of [modelName].
+ *
+ * Unlike [modelName], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("modelName")
+ @ExcludeMissing
+ fun _modelName(): JsonField = modelName
+
+ /**
+ * Returns the raw JSON value of [providerOptions].
+ *
+ * Unlike [providerOptions], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("providerOptions")
+ @ExcludeMissing
+ fun _providerOptions(): JsonField = providerOptions
+
+ /**
+ * Returns the raw JSON value of [baseUrl].
+ *
+ * Unlike [baseUrl], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("baseURL") @ExcludeMissing fun _baseUrl(): JsonField = baseUrl
+
+ /**
+ * Returns the raw JSON value of [headers].
+ *
+ * Unlike [headers], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("headers")
+ @ExcludeMissing
+ fun _headers(): JsonField = headers
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of
+ * [AzureEntraModelConfigObject].
+ *
+ * The following fields are required:
+ * ```java
+ * .auth()
+ * .modelName()
+ * .providerOptions()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [AzureEntraModelConfigObject]. */
+ class Builder internal constructor() {
+
+ private var auth: JsonField? = null
+ private var modelName: JsonField? = null
+ private var provider: JsonValue = JsonValue.from("azure")
+ private var providerOptions: JsonField? = null
+ private var baseUrl: JsonField = JsonMissing.of()
+ private var headers: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(azureEntraModelConfigObject: AzureEntraModelConfigObject) =
+ apply {
+ auth = azureEntraModelConfigObject.auth
+ modelName = azureEntraModelConfigObject.modelName
+ provider = azureEntraModelConfigObject.provider
+ providerOptions = azureEntraModelConfigObject.providerOptions
+ baseUrl = azureEntraModelConfigObject.baseUrl
+ headers = azureEntraModelConfigObject.headers
+ additionalProperties =
+ azureEntraModelConfigObject.additionalProperties.toMutableMap()
+ }
+
+ /** Azure provider authentication configuration */
+ fun auth(auth: Auth) = auth(JsonField.of(auth))
+
+ /**
+ * Sets [Builder.auth] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.auth] with a well-typed [Auth] value
+ * instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun auth(auth: JsonField) = apply { this.auth = auth }
+
+ /** Model name string with provider prefix (e.g., 'openai/gpt-5-nano') */
+ fun modelName(modelName: String) = modelName(JsonField.of(modelName))
+
+ /**
+ * Sets [Builder.modelName] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.modelName] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun modelName(modelName: JsonField) = apply {
+ this.modelName = modelName
+ }
+
+ /**
+ * Sets the field to an arbitrary JSON value.
+ *
+ * It is usually unnecessary to call this method because the field defaults to
+ * the following:
+ * ```java
+ * JsonValue.from("azure")
+ * ```
+ *
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun provider(provider: JsonValue) = apply { this.provider = provider }
+
+ /** Azure provider-specific model configuration */
+ fun providerOptions(providerOptions: ProviderOptions) =
+ providerOptions(JsonField.of(providerOptions))
+
+ /**
+ * Sets [Builder.providerOptions] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.providerOptions] with a well-typed
+ * [ProviderOptions] value instead. This method is primarily for setting the
+ * field to an undocumented or not yet supported value.
+ */
+ fun providerOptions(providerOptions: JsonField) = apply {
+ this.providerOptions = providerOptions
+ }
+
+ /** Base URL for the model provider */
+ fun baseUrl(baseUrl: String) = baseUrl(JsonField.of(baseUrl))
+
+ /**
+ * Sets [Builder.baseUrl] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.baseUrl] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun baseUrl(baseUrl: JsonField) = apply { this.baseUrl = baseUrl }
+
+ /** Custom headers sent with every request to the model provider */
+ fun headers(headers: Headers) = headers(JsonField.of(headers))
+
+ /**
+ * Sets [Builder.headers] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.headers] with a well-typed [Headers] value
+ * instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun headers(headers: JsonField) = apply { this.headers = headers }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) =
+ apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply {
+ additionalProperties.remove(key)
+ }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [AzureEntraModelConfigObject].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .auth()
+ * .modelName()
+ * .providerOptions()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): AzureEntraModelConfigObject =
+ AzureEntraModelConfigObject(
+ checkRequired("auth", auth),
+ checkRequired("modelName", modelName),
+ provider,
+ checkRequired("providerOptions", providerOptions),
+ baseUrl,
+ headers,
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't
+ * match its expected type.
+ */
+ fun validate(): AzureEntraModelConfigObject = apply {
+ if (validated) {
+ return@apply
+ }
+
+ auth().validate()
+ modelName()
+ _provider().let {
+ if (it != JsonValue.from("azure")) {
+ throw StagehandInvalidDataException(
+ "'provider' is invalid, received $it"
+ )
+ }
+ }
+ providerOptions().validate()
+ baseUrl()
+ headers().ifPresent { it.validate() }
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: StagehandInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (auth.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (modelName.asKnown().isPresent) 1 else 0) +
+ provider.let { if (it == JsonValue.from("azure")) 1 else 0 } +
+ (providerOptions.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (baseUrl.asKnown().isPresent) 1 else 0) +
+ (headers.asKnown().getOrNull()?.validity() ?: 0)
+
+ /** Azure provider authentication configuration */
+ class Auth
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val token: JsonField,
+ private val type: JsonValue,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("token")
+ @ExcludeMissing
+ token: JsonField = JsonMissing.of(),
+ @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(),
+ ) : this(token, type, mutableMapOf())
+
+ /**
+ * Microsoft Entra ID bearer token for Azure OpenAI
+ *
+ * @throws StagehandInvalidDataException if the JSON field has an unexpected
+ * type or is unexpectedly missing or null (e.g. if the server responded with
+ * an unexpected value).
+ */
+ fun token(): String = token.getRequired("token")
+
+ /**
+ * Use a Microsoft Entra ID bearer token for authentication
+ *
+ * Expected to always return the following:
+ * ```java
+ * JsonValue.from("azureEntraId")
+ * ```
+ *
+ * However, this method can be useful for debugging and logging (e.g. if the
+ * server responded with an unexpected value).
+ */
+ @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type
+
+ /**
+ * Returns the raw JSON value of [token].
+ *
+ * Unlike [token], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("token") @ExcludeMissing fun _token(): JsonField = token
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [Auth].
+ *
+ * The following fields are required:
+ * ```java
+ * .token()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Auth]. */
+ class Builder internal constructor() {
+
+ private var token: JsonField? = null
+ private var type: JsonValue = JsonValue.from("azureEntraId")
+ private var additionalProperties: MutableMap =
+ mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(auth: Auth) = apply {
+ token = auth.token
+ type = auth.type
+ additionalProperties = auth.additionalProperties.toMutableMap()
+ }
+
+ /** Microsoft Entra ID bearer token for Azure OpenAI */
+ fun token(token: String) = token(JsonField.of(token))
+
+ /**
+ * Sets [Builder.token] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.token] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an
+ * undocumented or not yet supported value.
+ */
+ fun token(token: JsonField) = apply { this.token = token }
+
+ /**
+ * Sets the field to an arbitrary JSON value.
+ *
+ * It is usually unnecessary to call this method because the field defaults
+ * to the following:
+ * ```java
+ * JsonValue.from("azureEntraId")
+ * ```
+ *
+ * This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun type(type: JsonValue) = apply { this.type = type }
+
+ fun additionalProperties(additionalProperties: Map