diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d4a9bcb..84d8fb1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: lint: timeout-minutes: 10 name: lint - runs-on: ${{ github.repository == 'stainless-sdks/stagehand-php' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: @@ -37,7 +37,7 @@ jobs: test: timeout-minutes: 10 name: test - runs-on: ${{ github.repository == 'stainless-sdks/stagehand-php' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 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..7b1f04d 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-64b47a6dd07208d708130e739a272f7d37d4e42494a7c8e566ef66007f8ff25f.yml +openapi_spec_hash: 4cdfcfed592c8631fbab9117bf45bb67 config_hash: 1fb12ae9b478488bc1e56bfbdc210b01 diff --git a/CHANGELOG.md b/CHANGELOG.md index 513a727..e145528 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## 3.22.0 (2026-07-21) + +Full Changelog: [v3.21.0...v3.22.0](https://github.com/browserbase/stagehand-php/compare/v3.21.0...v3.22.0) + +### Features + +* [STG-2090] Add Azure Entra model auth support ([804b83d](https://github.com/browserbase/stagehand-php/commit/804b83d439fb62c8abf8d25853d41dc524a78d69)) +* **server-v3:** expose OpenAI endpoint format ([389a4db](https://github.com/browserbase/stagehand-php/commit/389a4db907137c7cc32f4cc01ddd503a73de6e80)) +* **stlc:** configurable CI runner and private-production-repo support in workflow templates ([0f76548](https://github.com/browserbase/stagehand-php/commit/0f76548bdf0f6a9e77aa3fd5e20a9224ed81ebc7)) + ## 3.21.0 (2026-05-27) Full Changelog: [v3.20.0...v3.21.0](https://github.com/browserbase/stagehand-php/compare/v3.20.0...v3.21.0) diff --git a/README.md b/README.md index dd7e623..84c1594 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ The REST API documentation can be found on [docs.stagehand.dev](https://docs.sta ``` -composer require "browserbase/stagehand 3.21.0" +composer require "browserbase/stagehand 3.22.0" ``` diff --git a/src/Sessions/ModelConfig.php b/src/Sessions/ModelConfig.php index dc6b3fd..142fa7b 100644 --- a/src/Sessions/ModelConfig.php +++ b/src/Sessions/ModelConfig.php @@ -7,15 +7,19 @@ use Stagehand\Core\Concerns\SdkUnion; use Stagehand\Core\Conversion\Contracts\Converter; use Stagehand\Core\Conversion\Contracts\ConverterSource; +use Stagehand\Sessions\ModelConfig\AzureAPIKeyModelConfigObject; +use Stagehand\Sessions\ModelConfig\AzureEntraModelConfigObject; use Stagehand\Sessions\ModelConfig\GenericModelConfigObject; use Stagehand\Sessions\ModelConfig\VertexModelConfigObject; /** * @phpstan-import-type VertexModelConfigObjectShape from \Stagehand\Sessions\ModelConfig\VertexModelConfigObject + * @phpstan-import-type AzureEntraModelConfigObjectShape from \Stagehand\Sessions\ModelConfig\AzureEntraModelConfigObject + * @phpstan-import-type AzureAPIKeyModelConfigObjectShape from \Stagehand\Sessions\ModelConfig\AzureAPIKeyModelConfigObject * @phpstan-import-type GenericModelConfigObjectShape from \Stagehand\Sessions\ModelConfig\GenericModelConfigObject * - * @phpstan-type ModelConfigVariants = VertexModelConfigObject|GenericModelConfigObject - * @phpstan-type ModelConfigShape = ModelConfigVariants|VertexModelConfigObjectShape|GenericModelConfigObjectShape + * @phpstan-type ModelConfigVariants = VertexModelConfigObject|AzureEntraModelConfigObject|AzureAPIKeyModelConfigObject|GenericModelConfigObject + * @phpstan-type ModelConfigShape = ModelConfigVariants|VertexModelConfigObjectShape|AzureEntraModelConfigObjectShape|AzureAPIKeyModelConfigObjectShape|GenericModelConfigObjectShape */ final class ModelConfig implements ConverterSource { @@ -26,6 +30,11 @@ final class ModelConfig implements ConverterSource */ public static function variants(): array { - return [VertexModelConfigObject::class, GenericModelConfigObject::class]; + return [ + VertexModelConfigObject::class, + AzureEntraModelConfigObject::class, + AzureAPIKeyModelConfigObject::class, + GenericModelConfigObject::class, + ]; } } diff --git a/src/Sessions/ModelConfig/AzureAPIKeyModelConfigObject.php b/src/Sessions/ModelConfig/AzureAPIKeyModelConfigObject.php new file mode 100644 index 0000000..eb0ddf9 --- /dev/null +++ b/src/Sessions/ModelConfig/AzureAPIKeyModelConfigObject.php @@ -0,0 +1,188 @@ +|null, + * } + */ +final class AzureAPIKeyModelConfigObject implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Azure OpenAI model provider. + * + * @var 'azure' $provider + */ + #[Required] + public string $provider = 'azure'; + + /** + * Model name string with provider prefix (e.g., 'openai/gpt-5-nano'). + */ + #[Required] + public string $modelName; + + /** + * Azure provider-specific model configuration. + */ + #[Required] + public ProviderOptions $providerOptions; + + /** + * API key for the model provider. + */ + #[Optional] + public ?string $apiKey; + + /** + * Base URL for the model provider. + */ + #[Optional] + public ?string $baseURL; + + /** + * Custom headers sent with every request to the model provider. + * + * @var array|null $headers + */ + #[Optional(map: 'string')] + public ?array $headers; + + /** + * `new AzureAPIKeyModelConfigObject()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * AzureAPIKeyModelConfigObject::with(modelName: ..., providerOptions: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new AzureAPIKeyModelConfigObject)->withModelName(...)->withProviderOptions(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ProviderOptions|ProviderOptionsShape $providerOptions + * @param array|null $headers + */ + public static function with( + string $modelName, + ProviderOptions|array $providerOptions, + ?string $apiKey = null, + ?string $baseURL = null, + ?array $headers = null, + ): self { + $self = new self; + + $self['modelName'] = $modelName; + $self['providerOptions'] = $providerOptions; + + null !== $apiKey && $self['apiKey'] = $apiKey; + null !== $baseURL && $self['baseURL'] = $baseURL; + null !== $headers && $self['headers'] = $headers; + + return $self; + } + + /** + * Model name string with provider prefix (e.g., 'openai/gpt-5-nano'). + */ + public function withModelName(string $modelName): self + { + $self = clone $this; + $self['modelName'] = $modelName; + + return $self; + } + + /** + * Azure OpenAI model provider. + * + * @param 'azure' $provider + */ + public function withProvider(string $provider): self + { + $self = clone $this; + $self['provider'] = $provider; + + return $self; + } + + /** + * Azure provider-specific model configuration. + * + * @param ProviderOptions|ProviderOptionsShape $providerOptions + */ + public function withProviderOptions( + ProviderOptions|array $providerOptions + ): self { + $self = clone $this; + $self['providerOptions'] = $providerOptions; + + return $self; + } + + /** + * API key for the model provider. + */ + public function withAPIKey(string $apiKey): self + { + $self = clone $this; + $self['apiKey'] = $apiKey; + + return $self; + } + + /** + * Base URL for the model provider. + */ + public function withBaseURL(string $baseURL): self + { + $self = clone $this; + $self['baseURL'] = $baseURL; + + return $self; + } + + /** + * Custom headers sent with every request to the model provider. + * + * @param array $headers + */ + public function withHeaders(array $headers): self + { + $self = clone $this; + $self['headers'] = $headers; + + return $self; + } +} diff --git a/src/Sessions/ModelConfig/AzureAPIKeyModelConfigObject/ProviderOptions.php b/src/Sessions/ModelConfig/AzureAPIKeyModelConfigObject/ProviderOptions.php new file mode 100644 index 0000000..6f592b3 --- /dev/null +++ b/src/Sessions/ModelConfig/AzureAPIKeyModelConfigObject/ProviderOptions.php @@ -0,0 +1,77 @@ + */ + use SdkModel; + + /** + * Azure OpenAI provider-specific settings. + */ + #[Required] + public Azure $azure; + + /** + * `new ProviderOptions()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * ProviderOptions::with(azure: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new ProviderOptions)->withAzure(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Azure|AzureShape $azure + */ + public static function with(Azure|array $azure): self + { + $self = new self; + + $self['azure'] = $azure; + + return $self; + } + + /** + * Azure OpenAI provider-specific settings. + * + * @param Azure|AzureShape $azure + */ + public function withAzure(Azure|array $azure): self + { + $self = clone $this; + $self['azure'] = $azure; + + return $self; + } +} diff --git a/src/Sessions/ModelConfig/AzureAPIKeyModelConfigObject/ProviderOptions/Azure.php b/src/Sessions/ModelConfig/AzureAPIKeyModelConfigObject/ProviderOptions/Azure.php new file mode 100644 index 0000000..ac2bdc7 --- /dev/null +++ b/src/Sessions/ModelConfig/AzureAPIKeyModelConfigObject/ProviderOptions/Azure.php @@ -0,0 +1,146 @@ +|null, + * resourceName?: string|null, + * useDeploymentBasedURLs?: bool|null, + * } + */ +final class Azure implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Azure OpenAI API version. + */ + #[Optional] + public ?string $apiVersion; + + /** + * Base URL for the Azure OpenAI provider. + */ + #[Optional] + public ?string $baseURL; + + /** + * Custom headers sent with every request to the Azure OpenAI provider. + * + * @var array|null $headers + */ + #[Optional(map: 'string')] + public ?array $headers; + + /** + * Azure OpenAI resource name. + */ + #[Optional] + public ?string $resourceName; + + /** + * Whether to use deployment-based Azure OpenAI URLs. + */ + #[Optional('useDeploymentBasedUrls')] + public ?bool $useDeploymentBasedURLs; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param array|null $headers + */ + public static function with( + ?string $apiVersion = null, + ?string $baseURL = null, + ?array $headers = null, + ?string $resourceName = null, + ?bool $useDeploymentBasedURLs = null, + ): self { + $self = new self; + + null !== $apiVersion && $self['apiVersion'] = $apiVersion; + null !== $baseURL && $self['baseURL'] = $baseURL; + null !== $headers && $self['headers'] = $headers; + null !== $resourceName && $self['resourceName'] = $resourceName; + null !== $useDeploymentBasedURLs && $self['useDeploymentBasedURLs'] = $useDeploymentBasedURLs; + + return $self; + } + + /** + * Azure OpenAI API version. + */ + public function withAPIVersion(string $apiVersion): self + { + $self = clone $this; + $self['apiVersion'] = $apiVersion; + + return $self; + } + + /** + * Base URL for the Azure OpenAI provider. + */ + public function withBaseURL(string $baseURL): self + { + $self = clone $this; + $self['baseURL'] = $baseURL; + + return $self; + } + + /** + * Custom headers sent with every request to the Azure OpenAI provider. + * + * @param array $headers + */ + public function withHeaders(array $headers): self + { + $self = clone $this; + $self['headers'] = $headers; + + return $self; + } + + /** + * Azure OpenAI resource name. + */ + public function withResourceName(string $resourceName): self + { + $self = clone $this; + $self['resourceName'] = $resourceName; + + return $self; + } + + /** + * Whether to use deployment-based Azure OpenAI URLs. + */ + public function withUseDeploymentBasedURLs( + bool $useDeploymentBasedURLs + ): self { + $self = clone $this; + $self['useDeploymentBasedURLs'] = $useDeploymentBasedURLs; + + return $self; + } +} diff --git a/src/Sessions/ModelConfig/AzureEntraModelConfigObject.php b/src/Sessions/ModelConfig/AzureEntraModelConfigObject.php new file mode 100644 index 0000000..0971a20 --- /dev/null +++ b/src/Sessions/ModelConfig/AzureEntraModelConfigObject.php @@ -0,0 +1,198 @@ +|null, + * } + */ +final class AzureEntraModelConfigObject implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Azure OpenAI model provider. + * + * @var 'azure' $provider + */ + #[Required] + public string $provider = 'azure'; + + /** + * Azure provider authentication configuration. + */ + #[Required] + public Auth $auth; + + /** + * Model name string with provider prefix (e.g., 'openai/gpt-5-nano'). + */ + #[Required] + public string $modelName; + + /** + * Azure provider-specific model configuration. + */ + #[Required] + public ProviderOptions $providerOptions; + + /** + * Base URL for the model provider. + */ + #[Optional] + public ?string $baseURL; + + /** + * Custom headers sent with every request to the model provider. + * + * @var array|null $headers + */ + #[Optional(map: 'string')] + public ?array $headers; + + /** + * `new AzureEntraModelConfigObject()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * AzureEntraModelConfigObject::with( + * auth: ..., modelName: ..., providerOptions: ... + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new AzureEntraModelConfigObject) + * ->withAuth(...) + * ->withModelName(...) + * ->withProviderOptions(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Auth|AuthShape $auth + * @param ProviderOptions|ProviderOptionsShape $providerOptions + * @param array|null $headers + */ + public static function with( + Auth|array $auth, + string $modelName, + ProviderOptions|array $providerOptions, + ?string $baseURL = null, + ?array $headers = null, + ): self { + $self = new self; + + $self['auth'] = $auth; + $self['modelName'] = $modelName; + $self['providerOptions'] = $providerOptions; + + null !== $baseURL && $self['baseURL'] = $baseURL; + null !== $headers && $self['headers'] = $headers; + + return $self; + } + + /** + * Azure provider authentication configuration. + * + * @param Auth|AuthShape $auth + */ + public function withAuth(Auth|array $auth): self + { + $self = clone $this; + $self['auth'] = $auth; + + return $self; + } + + /** + * Model name string with provider prefix (e.g., 'openai/gpt-5-nano'). + */ + public function withModelName(string $modelName): self + { + $self = clone $this; + $self['modelName'] = $modelName; + + return $self; + } + + /** + * Azure OpenAI model provider. + * + * @param 'azure' $provider + */ + public function withProvider(string $provider): self + { + $self = clone $this; + $self['provider'] = $provider; + + return $self; + } + + /** + * Azure provider-specific model configuration. + * + * @param ProviderOptions|ProviderOptionsShape $providerOptions + */ + public function withProviderOptions( + ProviderOptions|array $providerOptions + ): self { + $self = clone $this; + $self['providerOptions'] = $providerOptions; + + return $self; + } + + /** + * Base URL for the model provider. + */ + public function withBaseURL(string $baseURL): self + { + $self = clone $this; + $self['baseURL'] = $baseURL; + + return $self; + } + + /** + * Custom headers sent with every request to the model provider. + * + * @param array $headers + */ + public function withHeaders(array $headers): self + { + $self = clone $this; + $self['headers'] = $headers; + + return $self; + } +} diff --git a/src/Sessions/ModelConfig/AzureEntraModelConfigObject/Auth.php b/src/Sessions/ModelConfig/AzureEntraModelConfigObject/Auth.php new file mode 100644 index 0000000..141e215 --- /dev/null +++ b/src/Sessions/ModelConfig/AzureEntraModelConfigObject/Auth.php @@ -0,0 +1,91 @@ + */ + use SdkModel; + + /** + * Use a Microsoft Entra ID bearer token for authentication. + * + * @var 'azureEntraId' $type + */ + #[Required] + public string $type = 'azureEntraId'; + + /** + * Microsoft Entra ID bearer token for Azure OpenAI. + */ + #[Required] + public string $token; + + /** + * `new Auth()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Auth::with(token: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Auth)->withToken(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $token): self + { + $self = new self; + + $self['token'] = $token; + + return $self; + } + + /** + * Microsoft Entra ID bearer token for Azure OpenAI. + */ + public function withToken(string $token): self + { + $self = clone $this; + $self['token'] = $token; + + return $self; + } + + /** + * Use a Microsoft Entra ID bearer token for authentication. + * + * @param 'azureEntraId' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Sessions/ModelConfig/AzureEntraModelConfigObject/ProviderOptions.php b/src/Sessions/ModelConfig/AzureEntraModelConfigObject/ProviderOptions.php new file mode 100644 index 0000000..efc0178 --- /dev/null +++ b/src/Sessions/ModelConfig/AzureEntraModelConfigObject/ProviderOptions.php @@ -0,0 +1,77 @@ + */ + use SdkModel; + + /** + * Azure OpenAI provider-specific settings. + */ + #[Required] + public Azure $azure; + + /** + * `new ProviderOptions()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * ProviderOptions::with(azure: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new ProviderOptions)->withAzure(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Azure|AzureShape $azure + */ + public static function with(Azure|array $azure): self + { + $self = new self; + + $self['azure'] = $azure; + + return $self; + } + + /** + * Azure OpenAI provider-specific settings. + * + * @param Azure|AzureShape $azure + */ + public function withAzure(Azure|array $azure): self + { + $self = clone $this; + $self['azure'] = $azure; + + return $self; + } +} diff --git a/src/Sessions/ModelConfig/AzureEntraModelConfigObject/ProviderOptions/Azure.php b/src/Sessions/ModelConfig/AzureEntraModelConfigObject/ProviderOptions/Azure.php new file mode 100644 index 0000000..0e3f5f8 --- /dev/null +++ b/src/Sessions/ModelConfig/AzureEntraModelConfigObject/ProviderOptions/Azure.php @@ -0,0 +1,146 @@ +|null, + * resourceName?: string|null, + * useDeploymentBasedURLs?: bool|null, + * } + */ +final class Azure implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Azure OpenAI API version. + */ + #[Optional] + public ?string $apiVersion; + + /** + * Base URL for the Azure OpenAI provider. + */ + #[Optional] + public ?string $baseURL; + + /** + * Custom headers sent with every request to the Azure OpenAI provider. + * + * @var array|null $headers + */ + #[Optional(map: 'string')] + public ?array $headers; + + /** + * Azure OpenAI resource name. + */ + #[Optional] + public ?string $resourceName; + + /** + * Whether to use deployment-based Azure OpenAI URLs. + */ + #[Optional('useDeploymentBasedUrls')] + public ?bool $useDeploymentBasedURLs; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param array|null $headers + */ + public static function with( + ?string $apiVersion = null, + ?string $baseURL = null, + ?array $headers = null, + ?string $resourceName = null, + ?bool $useDeploymentBasedURLs = null, + ): self { + $self = new self; + + null !== $apiVersion && $self['apiVersion'] = $apiVersion; + null !== $baseURL && $self['baseURL'] = $baseURL; + null !== $headers && $self['headers'] = $headers; + null !== $resourceName && $self['resourceName'] = $resourceName; + null !== $useDeploymentBasedURLs && $self['useDeploymentBasedURLs'] = $useDeploymentBasedURLs; + + return $self; + } + + /** + * Azure OpenAI API version. + */ + public function withAPIVersion(string $apiVersion): self + { + $self = clone $this; + $self['apiVersion'] = $apiVersion; + + return $self; + } + + /** + * Base URL for the Azure OpenAI provider. + */ + public function withBaseURL(string $baseURL): self + { + $self = clone $this; + $self['baseURL'] = $baseURL; + + return $self; + } + + /** + * Custom headers sent with every request to the Azure OpenAI provider. + * + * @param array $headers + */ + public function withHeaders(array $headers): self + { + $self = clone $this; + $self['headers'] = $headers; + + return $self; + } + + /** + * Azure OpenAI resource name. + */ + public function withResourceName(string $resourceName): self + { + $self = clone $this; + $self['resourceName'] = $resourceName; + + return $self; + } + + /** + * Whether to use deployment-based Azure OpenAI URLs. + */ + public function withUseDeploymentBasedURLs( + bool $useDeploymentBasedURLs + ): self { + $self = clone $this; + $self['useDeploymentBasedURLs'] = $useDeploymentBasedURLs; + + return $self; + } +} diff --git a/src/Sessions/ModelConfig/GenericModelConfigObject.php b/src/Sessions/ModelConfig/GenericModelConfigObject.php index 6a0556c..272f02c 100644 --- a/src/Sessions/ModelConfig/GenericModelConfigObject.php +++ b/src/Sessions/ModelConfig/GenericModelConfigObject.php @@ -8,6 +8,7 @@ use Stagehand\Core\Attributes\Required; use Stagehand\Core\Concerns\SdkModel; use Stagehand\Core\Contracts\BaseModel; +use Stagehand\Sessions\ModelConfig\GenericModelConfigObject\OpenAIEndpointFormat; use Stagehand\Sessions\ModelConfig\GenericModelConfigObject\Provider; /** @@ -16,6 +17,7 @@ * apiKey?: string|null, * baseURL?: string|null, * headers?: array|null, + * openaiEndpointFormat?: null|OpenAIEndpointFormat|value-of, * provider?: null|Provider|value-of, * } */ @@ -50,6 +52,14 @@ final class GenericModelConfigObject implements BaseModel #[Optional(map: 'string')] public ?array $headers; + /** + * Wire format used by an OpenAI-compatible endpoint. Defaults to the Responses API; use chat for Chat Completions-only endpoints. + * + * @var value-of|null $openaiEndpointFormat + */ + #[Optional(enum: OpenAIEndpointFormat::class)] + public ?string $openaiEndpointFormat; + /** * AI provider for the model (or provide a baseURL endpoint instead). * @@ -83,6 +93,7 @@ public function __construct() * You must use named parameters to construct any parameters with a default value. * * @param array|null $headers + * @param OpenAIEndpointFormat|value-of|null $openaiEndpointFormat * @param Provider|value-of|null $provider */ public static function with( @@ -90,6 +101,7 @@ public static function with( ?string $apiKey = null, ?string $baseURL = null, ?array $headers = null, + OpenAIEndpointFormat|string|null $openaiEndpointFormat = null, Provider|string|null $provider = null, ): self { $self = new self; @@ -99,6 +111,7 @@ public static function with( null !== $apiKey && $self['apiKey'] = $apiKey; null !== $baseURL && $self['baseURL'] = $baseURL; null !== $headers && $self['headers'] = $headers; + null !== $openaiEndpointFormat && $self['openaiEndpointFormat'] = $openaiEndpointFormat; null !== $provider && $self['provider'] = $provider; return $self; @@ -150,6 +163,20 @@ public function withHeaders(array $headers): self return $self; } + /** + * Wire format used by an OpenAI-compatible endpoint. Defaults to the Responses API; use chat for Chat Completions-only endpoints. + * + * @param OpenAIEndpointFormat|value-of $openaiEndpointFormat + */ + public function withOpenAIEndpointFormat( + OpenAIEndpointFormat|string $openaiEndpointFormat + ): self { + $self = clone $this; + $self['openaiEndpointFormat'] = $openaiEndpointFormat; + + return $self; + } + /** * AI provider for the model (or provide a baseURL endpoint instead). * diff --git a/src/Sessions/ModelConfig/GenericModelConfigObject/OpenAIEndpointFormat.php b/src/Sessions/ModelConfig/GenericModelConfigObject/OpenAIEndpointFormat.php new file mode 100644 index 0000000..ad97696 --- /dev/null +++ b/src/Sessions/ModelConfig/GenericModelConfigObject/OpenAIEndpointFormat.php @@ -0,0 +1,15 @@ +|null $variables */ public static function with( - string|VertexModelConfigObject|array|GenericModelConfigObject|null $model = null, + string|VertexModelConfigObject|array|AzureEntraModelConfigObject|AzureAPIKeyModelConfigObject|GenericModelConfigObject|null $model = null, ?float $timeout = null, ?array $variables = null, ): self { @@ -83,7 +85,7 @@ public static function with( * @param ModelShape $model */ public function withModel( - string|VertexModelConfigObject|array|GenericModelConfigObject $model + string|VertexModelConfigObject|array|AzureEntraModelConfigObject|AzureAPIKeyModelConfigObject|GenericModelConfigObject $model, ): self { $self = clone $this; $self['model'] = $model; diff --git a/src/Sessions/SessionActParams/Options/Model.php b/src/Sessions/SessionActParams/Options/Model.php index da1cc51..58acf42 100644 --- a/src/Sessions/SessionActParams/Options/Model.php +++ b/src/Sessions/SessionActParams/Options/Model.php @@ -7,6 +7,8 @@ use Stagehand\Core\Concerns\SdkUnion; use Stagehand\Core\Conversion\Contracts\Converter; use Stagehand\Core\Conversion\Contracts\ConverterSource; +use Stagehand\Sessions\SessionActParams\Options\Model\AzureAPIKeyModelConfigObject; +use Stagehand\Sessions\SessionActParams\Options\Model\AzureEntraModelConfigObject; use Stagehand\Sessions\SessionActParams\Options\Model\GenericModelConfigObject; use Stagehand\Sessions\SessionActParams\Options\Model\VertexModelConfigObject; @@ -14,10 +16,12 @@ * Model configuration object or model name string (e.g., 'openai/gpt-5-nano'). * * @phpstan-import-type VertexModelConfigObjectShape from \Stagehand\Sessions\SessionActParams\Options\Model\VertexModelConfigObject + * @phpstan-import-type AzureEntraModelConfigObjectShape from \Stagehand\Sessions\SessionActParams\Options\Model\AzureEntraModelConfigObject + * @phpstan-import-type AzureAPIKeyModelConfigObjectShape from \Stagehand\Sessions\SessionActParams\Options\Model\AzureAPIKeyModelConfigObject * @phpstan-import-type GenericModelConfigObjectShape from \Stagehand\Sessions\SessionActParams\Options\Model\GenericModelConfigObject * - * @phpstan-type ModelVariants = string|VertexModelConfigObject|GenericModelConfigObject - * @phpstan-type ModelShape = ModelVariants|VertexModelConfigObjectShape|GenericModelConfigObjectShape + * @phpstan-type ModelVariants = string|VertexModelConfigObject|AzureEntraModelConfigObject|AzureAPIKeyModelConfigObject|GenericModelConfigObject + * @phpstan-type ModelShape = ModelVariants|VertexModelConfigObjectShape|AzureEntraModelConfigObjectShape|AzureAPIKeyModelConfigObjectShape|GenericModelConfigObjectShape */ final class Model implements ConverterSource { @@ -29,7 +33,11 @@ final class Model implements ConverterSource public static function variants(): array { return [ - VertexModelConfigObject::class, GenericModelConfigObject::class, 'string', + VertexModelConfigObject::class, + AzureEntraModelConfigObject::class, + AzureAPIKeyModelConfigObject::class, + GenericModelConfigObject::class, + 'string', ]; } } diff --git a/src/Sessions/SessionActParams/Options/Model/AzureAPIKeyModelConfigObject.php b/src/Sessions/SessionActParams/Options/Model/AzureAPIKeyModelConfigObject.php new file mode 100644 index 0000000..51675fc --- /dev/null +++ b/src/Sessions/SessionActParams/Options/Model/AzureAPIKeyModelConfigObject.php @@ -0,0 +1,188 @@ +|null, + * } + */ +final class AzureAPIKeyModelConfigObject implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Azure OpenAI model provider. + * + * @var 'azure' $provider + */ + #[Required] + public string $provider = 'azure'; + + /** + * Model name string with provider prefix (e.g., 'openai/gpt-5-nano'). + */ + #[Required] + public string $modelName; + + /** + * Azure provider-specific model configuration. + */ + #[Required] + public ProviderOptions $providerOptions; + + /** + * API key for the model provider. + */ + #[Optional] + public ?string $apiKey; + + /** + * Base URL for the model provider. + */ + #[Optional] + public ?string $baseURL; + + /** + * Custom headers sent with every request to the model provider. + * + * @var array|null $headers + */ + #[Optional(map: 'string')] + public ?array $headers; + + /** + * `new AzureAPIKeyModelConfigObject()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * AzureAPIKeyModelConfigObject::with(modelName: ..., providerOptions: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new AzureAPIKeyModelConfigObject)->withModelName(...)->withProviderOptions(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ProviderOptions|ProviderOptionsShape $providerOptions + * @param array|null $headers + */ + public static function with( + string $modelName, + ProviderOptions|array $providerOptions, + ?string $apiKey = null, + ?string $baseURL = null, + ?array $headers = null, + ): self { + $self = new self; + + $self['modelName'] = $modelName; + $self['providerOptions'] = $providerOptions; + + null !== $apiKey && $self['apiKey'] = $apiKey; + null !== $baseURL && $self['baseURL'] = $baseURL; + null !== $headers && $self['headers'] = $headers; + + return $self; + } + + /** + * Model name string with provider prefix (e.g., 'openai/gpt-5-nano'). + */ + public function withModelName(string $modelName): self + { + $self = clone $this; + $self['modelName'] = $modelName; + + return $self; + } + + /** + * Azure OpenAI model provider. + * + * @param 'azure' $provider + */ + public function withProvider(string $provider): self + { + $self = clone $this; + $self['provider'] = $provider; + + return $self; + } + + /** + * Azure provider-specific model configuration. + * + * @param ProviderOptions|ProviderOptionsShape $providerOptions + */ + public function withProviderOptions( + ProviderOptions|array $providerOptions + ): self { + $self = clone $this; + $self['providerOptions'] = $providerOptions; + + return $self; + } + + /** + * API key for the model provider. + */ + public function withAPIKey(string $apiKey): self + { + $self = clone $this; + $self['apiKey'] = $apiKey; + + return $self; + } + + /** + * Base URL for the model provider. + */ + public function withBaseURL(string $baseURL): self + { + $self = clone $this; + $self['baseURL'] = $baseURL; + + return $self; + } + + /** + * Custom headers sent with every request to the model provider. + * + * @param array $headers + */ + public function withHeaders(array $headers): self + { + $self = clone $this; + $self['headers'] = $headers; + + return $self; + } +} diff --git a/src/Sessions/SessionActParams/Options/Model/AzureAPIKeyModelConfigObject/ProviderOptions.php b/src/Sessions/SessionActParams/Options/Model/AzureAPIKeyModelConfigObject/ProviderOptions.php new file mode 100644 index 0000000..d78369e --- /dev/null +++ b/src/Sessions/SessionActParams/Options/Model/AzureAPIKeyModelConfigObject/ProviderOptions.php @@ -0,0 +1,77 @@ + */ + use SdkModel; + + /** + * Azure OpenAI provider-specific settings. + */ + #[Required] + public Azure $azure; + + /** + * `new ProviderOptions()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * ProviderOptions::with(azure: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new ProviderOptions)->withAzure(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Azure|AzureShape $azure + */ + public static function with(Azure|array $azure): self + { + $self = new self; + + $self['azure'] = $azure; + + return $self; + } + + /** + * Azure OpenAI provider-specific settings. + * + * @param Azure|AzureShape $azure + */ + public function withAzure(Azure|array $azure): self + { + $self = clone $this; + $self['azure'] = $azure; + + return $self; + } +} diff --git a/src/Sessions/SessionActParams/Options/Model/AzureAPIKeyModelConfigObject/ProviderOptions/Azure.php b/src/Sessions/SessionActParams/Options/Model/AzureAPIKeyModelConfigObject/ProviderOptions/Azure.php new file mode 100644 index 0000000..360aa69 --- /dev/null +++ b/src/Sessions/SessionActParams/Options/Model/AzureAPIKeyModelConfigObject/ProviderOptions/Azure.php @@ -0,0 +1,146 @@ +|null, + * resourceName?: string|null, + * useDeploymentBasedURLs?: bool|null, + * } + */ +final class Azure implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Azure OpenAI API version. + */ + #[Optional] + public ?string $apiVersion; + + /** + * Base URL for the Azure OpenAI provider. + */ + #[Optional] + public ?string $baseURL; + + /** + * Custom headers sent with every request to the Azure OpenAI provider. + * + * @var array|null $headers + */ + #[Optional(map: 'string')] + public ?array $headers; + + /** + * Azure OpenAI resource name. + */ + #[Optional] + public ?string $resourceName; + + /** + * Whether to use deployment-based Azure OpenAI URLs. + */ + #[Optional('useDeploymentBasedUrls')] + public ?bool $useDeploymentBasedURLs; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param array|null $headers + */ + public static function with( + ?string $apiVersion = null, + ?string $baseURL = null, + ?array $headers = null, + ?string $resourceName = null, + ?bool $useDeploymentBasedURLs = null, + ): self { + $self = new self; + + null !== $apiVersion && $self['apiVersion'] = $apiVersion; + null !== $baseURL && $self['baseURL'] = $baseURL; + null !== $headers && $self['headers'] = $headers; + null !== $resourceName && $self['resourceName'] = $resourceName; + null !== $useDeploymentBasedURLs && $self['useDeploymentBasedURLs'] = $useDeploymentBasedURLs; + + return $self; + } + + /** + * Azure OpenAI API version. + */ + public function withAPIVersion(string $apiVersion): self + { + $self = clone $this; + $self['apiVersion'] = $apiVersion; + + return $self; + } + + /** + * Base URL for the Azure OpenAI provider. + */ + public function withBaseURL(string $baseURL): self + { + $self = clone $this; + $self['baseURL'] = $baseURL; + + return $self; + } + + /** + * Custom headers sent with every request to the Azure OpenAI provider. + * + * @param array $headers + */ + public function withHeaders(array $headers): self + { + $self = clone $this; + $self['headers'] = $headers; + + return $self; + } + + /** + * Azure OpenAI resource name. + */ + public function withResourceName(string $resourceName): self + { + $self = clone $this; + $self['resourceName'] = $resourceName; + + return $self; + } + + /** + * Whether to use deployment-based Azure OpenAI URLs. + */ + public function withUseDeploymentBasedURLs( + bool $useDeploymentBasedURLs + ): self { + $self = clone $this; + $self['useDeploymentBasedURLs'] = $useDeploymentBasedURLs; + + return $self; + } +} diff --git a/src/Sessions/SessionActParams/Options/Model/AzureEntraModelConfigObject.php b/src/Sessions/SessionActParams/Options/Model/AzureEntraModelConfigObject.php new file mode 100644 index 0000000..83a40f4 --- /dev/null +++ b/src/Sessions/SessionActParams/Options/Model/AzureEntraModelConfigObject.php @@ -0,0 +1,198 @@ +|null, + * } + */ +final class AzureEntraModelConfigObject implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Azure OpenAI model provider. + * + * @var 'azure' $provider + */ + #[Required] + public string $provider = 'azure'; + + /** + * Azure provider authentication configuration. + */ + #[Required] + public Auth $auth; + + /** + * Model name string with provider prefix (e.g., 'openai/gpt-5-nano'). + */ + #[Required] + public string $modelName; + + /** + * Azure provider-specific model configuration. + */ + #[Required] + public ProviderOptions $providerOptions; + + /** + * Base URL for the model provider. + */ + #[Optional] + public ?string $baseURL; + + /** + * Custom headers sent with every request to the model provider. + * + * @var array|null $headers + */ + #[Optional(map: 'string')] + public ?array $headers; + + /** + * `new AzureEntraModelConfigObject()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * AzureEntraModelConfigObject::with( + * auth: ..., modelName: ..., providerOptions: ... + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new AzureEntraModelConfigObject) + * ->withAuth(...) + * ->withModelName(...) + * ->withProviderOptions(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Auth|AuthShape $auth + * @param ProviderOptions|ProviderOptionsShape $providerOptions + * @param array|null $headers + */ + public static function with( + Auth|array $auth, + string $modelName, + ProviderOptions|array $providerOptions, + ?string $baseURL = null, + ?array $headers = null, + ): self { + $self = new self; + + $self['auth'] = $auth; + $self['modelName'] = $modelName; + $self['providerOptions'] = $providerOptions; + + null !== $baseURL && $self['baseURL'] = $baseURL; + null !== $headers && $self['headers'] = $headers; + + return $self; + } + + /** + * Azure provider authentication configuration. + * + * @param Auth|AuthShape $auth + */ + public function withAuth(Auth|array $auth): self + { + $self = clone $this; + $self['auth'] = $auth; + + return $self; + } + + /** + * Model name string with provider prefix (e.g., 'openai/gpt-5-nano'). + */ + public function withModelName(string $modelName): self + { + $self = clone $this; + $self['modelName'] = $modelName; + + return $self; + } + + /** + * Azure OpenAI model provider. + * + * @param 'azure' $provider + */ + public function withProvider(string $provider): self + { + $self = clone $this; + $self['provider'] = $provider; + + return $self; + } + + /** + * Azure provider-specific model configuration. + * + * @param ProviderOptions|ProviderOptionsShape $providerOptions + */ + public function withProviderOptions( + ProviderOptions|array $providerOptions + ): self { + $self = clone $this; + $self['providerOptions'] = $providerOptions; + + return $self; + } + + /** + * Base URL for the model provider. + */ + public function withBaseURL(string $baseURL): self + { + $self = clone $this; + $self['baseURL'] = $baseURL; + + return $self; + } + + /** + * Custom headers sent with every request to the model provider. + * + * @param array $headers + */ + public function withHeaders(array $headers): self + { + $self = clone $this; + $self['headers'] = $headers; + + return $self; + } +} diff --git a/src/Sessions/SessionActParams/Options/Model/AzureEntraModelConfigObject/Auth.php b/src/Sessions/SessionActParams/Options/Model/AzureEntraModelConfigObject/Auth.php new file mode 100644 index 0000000..385be35 --- /dev/null +++ b/src/Sessions/SessionActParams/Options/Model/AzureEntraModelConfigObject/Auth.php @@ -0,0 +1,91 @@ + */ + use SdkModel; + + /** + * Use a Microsoft Entra ID bearer token for authentication. + * + * @var 'azureEntraId' $type + */ + #[Required] + public string $type = 'azureEntraId'; + + /** + * Microsoft Entra ID bearer token for Azure OpenAI. + */ + #[Required] + public string $token; + + /** + * `new Auth()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Auth::with(token: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Auth)->withToken(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $token): self + { + $self = new self; + + $self['token'] = $token; + + return $self; + } + + /** + * Microsoft Entra ID bearer token for Azure OpenAI. + */ + public function withToken(string $token): self + { + $self = clone $this; + $self['token'] = $token; + + return $self; + } + + /** + * Use a Microsoft Entra ID bearer token for authentication. + * + * @param 'azureEntraId' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Sessions/SessionActParams/Options/Model/AzureEntraModelConfigObject/ProviderOptions.php b/src/Sessions/SessionActParams/Options/Model/AzureEntraModelConfigObject/ProviderOptions.php new file mode 100644 index 0000000..15614e2 --- /dev/null +++ b/src/Sessions/SessionActParams/Options/Model/AzureEntraModelConfigObject/ProviderOptions.php @@ -0,0 +1,77 @@ + */ + use SdkModel; + + /** + * Azure OpenAI provider-specific settings. + */ + #[Required] + public Azure $azure; + + /** + * `new ProviderOptions()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * ProviderOptions::with(azure: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new ProviderOptions)->withAzure(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Azure|AzureShape $azure + */ + public static function with(Azure|array $azure): self + { + $self = new self; + + $self['azure'] = $azure; + + return $self; + } + + /** + * Azure OpenAI provider-specific settings. + * + * @param Azure|AzureShape $azure + */ + public function withAzure(Azure|array $azure): self + { + $self = clone $this; + $self['azure'] = $azure; + + return $self; + } +} diff --git a/src/Sessions/SessionActParams/Options/Model/AzureEntraModelConfigObject/ProviderOptions/Azure.php b/src/Sessions/SessionActParams/Options/Model/AzureEntraModelConfigObject/ProviderOptions/Azure.php new file mode 100644 index 0000000..517bd18 --- /dev/null +++ b/src/Sessions/SessionActParams/Options/Model/AzureEntraModelConfigObject/ProviderOptions/Azure.php @@ -0,0 +1,146 @@ +|null, + * resourceName?: string|null, + * useDeploymentBasedURLs?: bool|null, + * } + */ +final class Azure implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Azure OpenAI API version. + */ + #[Optional] + public ?string $apiVersion; + + /** + * Base URL for the Azure OpenAI provider. + */ + #[Optional] + public ?string $baseURL; + + /** + * Custom headers sent with every request to the Azure OpenAI provider. + * + * @var array|null $headers + */ + #[Optional(map: 'string')] + public ?array $headers; + + /** + * Azure OpenAI resource name. + */ + #[Optional] + public ?string $resourceName; + + /** + * Whether to use deployment-based Azure OpenAI URLs. + */ + #[Optional('useDeploymentBasedUrls')] + public ?bool $useDeploymentBasedURLs; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param array|null $headers + */ + public static function with( + ?string $apiVersion = null, + ?string $baseURL = null, + ?array $headers = null, + ?string $resourceName = null, + ?bool $useDeploymentBasedURLs = null, + ): self { + $self = new self; + + null !== $apiVersion && $self['apiVersion'] = $apiVersion; + null !== $baseURL && $self['baseURL'] = $baseURL; + null !== $headers && $self['headers'] = $headers; + null !== $resourceName && $self['resourceName'] = $resourceName; + null !== $useDeploymentBasedURLs && $self['useDeploymentBasedURLs'] = $useDeploymentBasedURLs; + + return $self; + } + + /** + * Azure OpenAI API version. + */ + public function withAPIVersion(string $apiVersion): self + { + $self = clone $this; + $self['apiVersion'] = $apiVersion; + + return $self; + } + + /** + * Base URL for the Azure OpenAI provider. + */ + public function withBaseURL(string $baseURL): self + { + $self = clone $this; + $self['baseURL'] = $baseURL; + + return $self; + } + + /** + * Custom headers sent with every request to the Azure OpenAI provider. + * + * @param array $headers + */ + public function withHeaders(array $headers): self + { + $self = clone $this; + $self['headers'] = $headers; + + return $self; + } + + /** + * Azure OpenAI resource name. + */ + public function withResourceName(string $resourceName): self + { + $self = clone $this; + $self['resourceName'] = $resourceName; + + return $self; + } + + /** + * Whether to use deployment-based Azure OpenAI URLs. + */ + public function withUseDeploymentBasedURLs( + bool $useDeploymentBasedURLs + ): self { + $self = clone $this; + $self['useDeploymentBasedURLs'] = $useDeploymentBasedURLs; + + return $self; + } +} diff --git a/src/Sessions/SessionActParams/Options/Model/GenericModelConfigObject.php b/src/Sessions/SessionActParams/Options/Model/GenericModelConfigObject.php index 3709575..0b9fd0f 100644 --- a/src/Sessions/SessionActParams/Options/Model/GenericModelConfigObject.php +++ b/src/Sessions/SessionActParams/Options/Model/GenericModelConfigObject.php @@ -8,6 +8,7 @@ use Stagehand\Core\Attributes\Required; use Stagehand\Core\Concerns\SdkModel; use Stagehand\Core\Contracts\BaseModel; +use Stagehand\Sessions\SessionActParams\Options\Model\GenericModelConfigObject\OpenAIEndpointFormat; use Stagehand\Sessions\SessionActParams\Options\Model\GenericModelConfigObject\Provider; /** @@ -16,6 +17,7 @@ * apiKey?: string|null, * baseURL?: string|null, * headers?: array|null, + * openaiEndpointFormat?: null|OpenAIEndpointFormat|value-of, * provider?: null|Provider|value-of, * } */ @@ -50,6 +52,14 @@ final class GenericModelConfigObject implements BaseModel #[Optional(map: 'string')] public ?array $headers; + /** + * Wire format used by an OpenAI-compatible endpoint. Defaults to the Responses API; use chat for Chat Completions-only endpoints. + * + * @var value-of|null $openaiEndpointFormat + */ + #[Optional(enum: OpenAIEndpointFormat::class)] + public ?string $openaiEndpointFormat; + /** * AI provider for the model (or provide a baseURL endpoint instead). * @@ -83,6 +93,7 @@ public function __construct() * You must use named parameters to construct any parameters with a default value. * * @param array|null $headers + * @param OpenAIEndpointFormat|value-of|null $openaiEndpointFormat * @param Provider|value-of|null $provider */ public static function with( @@ -90,6 +101,7 @@ public static function with( ?string $apiKey = null, ?string $baseURL = null, ?array $headers = null, + OpenAIEndpointFormat|string|null $openaiEndpointFormat = null, Provider|string|null $provider = null, ): self { $self = new self; @@ -99,6 +111,7 @@ public static function with( null !== $apiKey && $self['apiKey'] = $apiKey; null !== $baseURL && $self['baseURL'] = $baseURL; null !== $headers && $self['headers'] = $headers; + null !== $openaiEndpointFormat && $self['openaiEndpointFormat'] = $openaiEndpointFormat; null !== $provider && $self['provider'] = $provider; return $self; @@ -150,6 +163,20 @@ public function withHeaders(array $headers): self return $self; } + /** + * Wire format used by an OpenAI-compatible endpoint. Defaults to the Responses API; use chat for Chat Completions-only endpoints. + * + * @param OpenAIEndpointFormat|value-of $openaiEndpointFormat + */ + public function withOpenAIEndpointFormat( + OpenAIEndpointFormat|string $openaiEndpointFormat + ): self { + $self = clone $this; + $self['openaiEndpointFormat'] = $openaiEndpointFormat; + + return $self; + } + /** * AI provider for the model (or provide a baseURL endpoint instead). * diff --git a/src/Sessions/SessionActParams/Options/Model/GenericModelConfigObject/OpenAIEndpointFormat.php b/src/Sessions/SessionActParams/Options/Model/GenericModelConfigObject/OpenAIEndpointFormat.php new file mode 100644 index 0000000..2dee091 --- /dev/null +++ b/src/Sessions/SessionActParams/Options/Model/GenericModelConfigObject/OpenAIEndpointFormat.php @@ -0,0 +1,15 @@ +|null, + * } + */ +final class AzureAPIKeyModelConfigObject implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Azure OpenAI model provider. + * + * @var 'azure' $provider + */ + #[Required] + public string $provider = 'azure'; + + /** + * Model name string with provider prefix (e.g., 'openai/gpt-5-nano'). + */ + #[Required] + public string $modelName; + + /** + * Azure provider-specific model configuration. + */ + #[Required] + public ProviderOptions $providerOptions; + + /** + * API key for the model provider. + */ + #[Optional] + public ?string $apiKey; + + /** + * Base URL for the model provider. + */ + #[Optional] + public ?string $baseURL; + + /** + * Custom headers sent with every request to the model provider. + * + * @var array|null $headers + */ + #[Optional(map: 'string')] + public ?array $headers; + + /** + * `new AzureAPIKeyModelConfigObject()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * AzureAPIKeyModelConfigObject::with(modelName: ..., providerOptions: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new AzureAPIKeyModelConfigObject)->withModelName(...)->withProviderOptions(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ProviderOptions|ProviderOptionsShape $providerOptions + * @param array|null $headers + */ + public static function with( + string $modelName, + ProviderOptions|array $providerOptions, + ?string $apiKey = null, + ?string $baseURL = null, + ?array $headers = null, + ): self { + $self = new self; + + $self['modelName'] = $modelName; + $self['providerOptions'] = $providerOptions; + + null !== $apiKey && $self['apiKey'] = $apiKey; + null !== $baseURL && $self['baseURL'] = $baseURL; + null !== $headers && $self['headers'] = $headers; + + return $self; + } + + /** + * Model name string with provider prefix (e.g., 'openai/gpt-5-nano'). + */ + public function withModelName(string $modelName): self + { + $self = clone $this; + $self['modelName'] = $modelName; + + return $self; + } + + /** + * Azure OpenAI model provider. + * + * @param 'azure' $provider + */ + public function withProvider(string $provider): self + { + $self = clone $this; + $self['provider'] = $provider; + + return $self; + } + + /** + * Azure provider-specific model configuration. + * + * @param ProviderOptions|ProviderOptionsShape $providerOptions + */ + public function withProviderOptions( + ProviderOptions|array $providerOptions + ): self { + $self = clone $this; + $self['providerOptions'] = $providerOptions; + + return $self; + } + + /** + * API key for the model provider. + */ + public function withAPIKey(string $apiKey): self + { + $self = clone $this; + $self['apiKey'] = $apiKey; + + return $self; + } + + /** + * Base URL for the model provider. + */ + public function withBaseURL(string $baseURL): self + { + $self = clone $this; + $self['baseURL'] = $baseURL; + + return $self; + } + + /** + * Custom headers sent with every request to the model provider. + * + * @param array $headers + */ + public function withHeaders(array $headers): self + { + $self = clone $this; + $self['headers'] = $headers; + + return $self; + } +} diff --git a/src/Sessions/SessionExecuteParams/AgentConfig/ExecutionModel/AzureAPIKeyModelConfigObject/ProviderOptions.php b/src/Sessions/SessionExecuteParams/AgentConfig/ExecutionModel/AzureAPIKeyModelConfigObject/ProviderOptions.php new file mode 100644 index 0000000..bb56a52 --- /dev/null +++ b/src/Sessions/SessionExecuteParams/AgentConfig/ExecutionModel/AzureAPIKeyModelConfigObject/ProviderOptions.php @@ -0,0 +1,77 @@ + */ + use SdkModel; + + /** + * Azure OpenAI provider-specific settings. + */ + #[Required] + public Azure $azure; + + /** + * `new ProviderOptions()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * ProviderOptions::with(azure: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new ProviderOptions)->withAzure(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Azure|AzureShape $azure + */ + public static function with(Azure|array $azure): self + { + $self = new self; + + $self['azure'] = $azure; + + return $self; + } + + /** + * Azure OpenAI provider-specific settings. + * + * @param Azure|AzureShape $azure + */ + public function withAzure(Azure|array $azure): self + { + $self = clone $this; + $self['azure'] = $azure; + + return $self; + } +} diff --git a/src/Sessions/SessionExecuteParams/AgentConfig/ExecutionModel/AzureAPIKeyModelConfigObject/ProviderOptions/Azure.php b/src/Sessions/SessionExecuteParams/AgentConfig/ExecutionModel/AzureAPIKeyModelConfigObject/ProviderOptions/Azure.php new file mode 100644 index 0000000..dbe5935 --- /dev/null +++ b/src/Sessions/SessionExecuteParams/AgentConfig/ExecutionModel/AzureAPIKeyModelConfigObject/ProviderOptions/Azure.php @@ -0,0 +1,146 @@ +|null, + * resourceName?: string|null, + * useDeploymentBasedURLs?: bool|null, + * } + */ +final class Azure implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Azure OpenAI API version. + */ + #[Optional] + public ?string $apiVersion; + + /** + * Base URL for the Azure OpenAI provider. + */ + #[Optional] + public ?string $baseURL; + + /** + * Custom headers sent with every request to the Azure OpenAI provider. + * + * @var array|null $headers + */ + #[Optional(map: 'string')] + public ?array $headers; + + /** + * Azure OpenAI resource name. + */ + #[Optional] + public ?string $resourceName; + + /** + * Whether to use deployment-based Azure OpenAI URLs. + */ + #[Optional('useDeploymentBasedUrls')] + public ?bool $useDeploymentBasedURLs; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param array|null $headers + */ + public static function with( + ?string $apiVersion = null, + ?string $baseURL = null, + ?array $headers = null, + ?string $resourceName = null, + ?bool $useDeploymentBasedURLs = null, + ): self { + $self = new self; + + null !== $apiVersion && $self['apiVersion'] = $apiVersion; + null !== $baseURL && $self['baseURL'] = $baseURL; + null !== $headers && $self['headers'] = $headers; + null !== $resourceName && $self['resourceName'] = $resourceName; + null !== $useDeploymentBasedURLs && $self['useDeploymentBasedURLs'] = $useDeploymentBasedURLs; + + return $self; + } + + /** + * Azure OpenAI API version. + */ + public function withAPIVersion(string $apiVersion): self + { + $self = clone $this; + $self['apiVersion'] = $apiVersion; + + return $self; + } + + /** + * Base URL for the Azure OpenAI provider. + */ + public function withBaseURL(string $baseURL): self + { + $self = clone $this; + $self['baseURL'] = $baseURL; + + return $self; + } + + /** + * Custom headers sent with every request to the Azure OpenAI provider. + * + * @param array $headers + */ + public function withHeaders(array $headers): self + { + $self = clone $this; + $self['headers'] = $headers; + + return $self; + } + + /** + * Azure OpenAI resource name. + */ + public function withResourceName(string $resourceName): self + { + $self = clone $this; + $self['resourceName'] = $resourceName; + + return $self; + } + + /** + * Whether to use deployment-based Azure OpenAI URLs. + */ + public function withUseDeploymentBasedURLs( + bool $useDeploymentBasedURLs + ): self { + $self = clone $this; + $self['useDeploymentBasedURLs'] = $useDeploymentBasedURLs; + + return $self; + } +} diff --git a/src/Sessions/SessionExecuteParams/AgentConfig/ExecutionModel/AzureEntraModelConfigObject.php b/src/Sessions/SessionExecuteParams/AgentConfig/ExecutionModel/AzureEntraModelConfigObject.php new file mode 100644 index 0000000..3a1bd19 --- /dev/null +++ b/src/Sessions/SessionExecuteParams/AgentConfig/ExecutionModel/AzureEntraModelConfigObject.php @@ -0,0 +1,198 @@ +|null, + * } + */ +final class AzureEntraModelConfigObject implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Azure OpenAI model provider. + * + * @var 'azure' $provider + */ + #[Required] + public string $provider = 'azure'; + + /** + * Azure provider authentication configuration. + */ + #[Required] + public Auth $auth; + + /** + * Model name string with provider prefix (e.g., 'openai/gpt-5-nano'). + */ + #[Required] + public string $modelName; + + /** + * Azure provider-specific model configuration. + */ + #[Required] + public ProviderOptions $providerOptions; + + /** + * Base URL for the model provider. + */ + #[Optional] + public ?string $baseURL; + + /** + * Custom headers sent with every request to the model provider. + * + * @var array|null $headers + */ + #[Optional(map: 'string')] + public ?array $headers; + + /** + * `new AzureEntraModelConfigObject()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * AzureEntraModelConfigObject::with( + * auth: ..., modelName: ..., providerOptions: ... + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new AzureEntraModelConfigObject) + * ->withAuth(...) + * ->withModelName(...) + * ->withProviderOptions(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Auth|AuthShape $auth + * @param ProviderOptions|ProviderOptionsShape $providerOptions + * @param array|null $headers + */ + public static function with( + Auth|array $auth, + string $modelName, + ProviderOptions|array $providerOptions, + ?string $baseURL = null, + ?array $headers = null, + ): self { + $self = new self; + + $self['auth'] = $auth; + $self['modelName'] = $modelName; + $self['providerOptions'] = $providerOptions; + + null !== $baseURL && $self['baseURL'] = $baseURL; + null !== $headers && $self['headers'] = $headers; + + return $self; + } + + /** + * Azure provider authentication configuration. + * + * @param Auth|AuthShape $auth + */ + public function withAuth(Auth|array $auth): self + { + $self = clone $this; + $self['auth'] = $auth; + + return $self; + } + + /** + * Model name string with provider prefix (e.g., 'openai/gpt-5-nano'). + */ + public function withModelName(string $modelName): self + { + $self = clone $this; + $self['modelName'] = $modelName; + + return $self; + } + + /** + * Azure OpenAI model provider. + * + * @param 'azure' $provider + */ + public function withProvider(string $provider): self + { + $self = clone $this; + $self['provider'] = $provider; + + return $self; + } + + /** + * Azure provider-specific model configuration. + * + * @param ProviderOptions|ProviderOptionsShape $providerOptions + */ + public function withProviderOptions( + ProviderOptions|array $providerOptions + ): self { + $self = clone $this; + $self['providerOptions'] = $providerOptions; + + return $self; + } + + /** + * Base URL for the model provider. + */ + public function withBaseURL(string $baseURL): self + { + $self = clone $this; + $self['baseURL'] = $baseURL; + + return $self; + } + + /** + * Custom headers sent with every request to the model provider. + * + * @param array $headers + */ + public function withHeaders(array $headers): self + { + $self = clone $this; + $self['headers'] = $headers; + + return $self; + } +} diff --git a/src/Sessions/SessionExecuteParams/AgentConfig/ExecutionModel/AzureEntraModelConfigObject/Auth.php b/src/Sessions/SessionExecuteParams/AgentConfig/ExecutionModel/AzureEntraModelConfigObject/Auth.php new file mode 100644 index 0000000..843a789 --- /dev/null +++ b/src/Sessions/SessionExecuteParams/AgentConfig/ExecutionModel/AzureEntraModelConfigObject/Auth.php @@ -0,0 +1,91 @@ + */ + use SdkModel; + + /** + * Use a Microsoft Entra ID bearer token for authentication. + * + * @var 'azureEntraId' $type + */ + #[Required] + public string $type = 'azureEntraId'; + + /** + * Microsoft Entra ID bearer token for Azure OpenAI. + */ + #[Required] + public string $token; + + /** + * `new Auth()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Auth::with(token: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Auth)->withToken(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $token): self + { + $self = new self; + + $self['token'] = $token; + + return $self; + } + + /** + * Microsoft Entra ID bearer token for Azure OpenAI. + */ + public function withToken(string $token): self + { + $self = clone $this; + $self['token'] = $token; + + return $self; + } + + /** + * Use a Microsoft Entra ID bearer token for authentication. + * + * @param 'azureEntraId' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Sessions/SessionExecuteParams/AgentConfig/ExecutionModel/AzureEntraModelConfigObject/ProviderOptions.php b/src/Sessions/SessionExecuteParams/AgentConfig/ExecutionModel/AzureEntraModelConfigObject/ProviderOptions.php new file mode 100644 index 0000000..08f5519 --- /dev/null +++ b/src/Sessions/SessionExecuteParams/AgentConfig/ExecutionModel/AzureEntraModelConfigObject/ProviderOptions.php @@ -0,0 +1,77 @@ + */ + use SdkModel; + + /** + * Azure OpenAI provider-specific settings. + */ + #[Required] + public Azure $azure; + + /** + * `new ProviderOptions()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * ProviderOptions::with(azure: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new ProviderOptions)->withAzure(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Azure|AzureShape $azure + */ + public static function with(Azure|array $azure): self + { + $self = new self; + + $self['azure'] = $azure; + + return $self; + } + + /** + * Azure OpenAI provider-specific settings. + * + * @param Azure|AzureShape $azure + */ + public function withAzure(Azure|array $azure): self + { + $self = clone $this; + $self['azure'] = $azure; + + return $self; + } +} diff --git a/src/Sessions/SessionExecuteParams/AgentConfig/ExecutionModel/AzureEntraModelConfigObject/ProviderOptions/Azure.php b/src/Sessions/SessionExecuteParams/AgentConfig/ExecutionModel/AzureEntraModelConfigObject/ProviderOptions/Azure.php new file mode 100644 index 0000000..5ab568f --- /dev/null +++ b/src/Sessions/SessionExecuteParams/AgentConfig/ExecutionModel/AzureEntraModelConfigObject/ProviderOptions/Azure.php @@ -0,0 +1,146 @@ +|null, + * resourceName?: string|null, + * useDeploymentBasedURLs?: bool|null, + * } + */ +final class Azure implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Azure OpenAI API version. + */ + #[Optional] + public ?string $apiVersion; + + /** + * Base URL for the Azure OpenAI provider. + */ + #[Optional] + public ?string $baseURL; + + /** + * Custom headers sent with every request to the Azure OpenAI provider. + * + * @var array|null $headers + */ + #[Optional(map: 'string')] + public ?array $headers; + + /** + * Azure OpenAI resource name. + */ + #[Optional] + public ?string $resourceName; + + /** + * Whether to use deployment-based Azure OpenAI URLs. + */ + #[Optional('useDeploymentBasedUrls')] + public ?bool $useDeploymentBasedURLs; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param array|null $headers + */ + public static function with( + ?string $apiVersion = null, + ?string $baseURL = null, + ?array $headers = null, + ?string $resourceName = null, + ?bool $useDeploymentBasedURLs = null, + ): self { + $self = new self; + + null !== $apiVersion && $self['apiVersion'] = $apiVersion; + null !== $baseURL && $self['baseURL'] = $baseURL; + null !== $headers && $self['headers'] = $headers; + null !== $resourceName && $self['resourceName'] = $resourceName; + null !== $useDeploymentBasedURLs && $self['useDeploymentBasedURLs'] = $useDeploymentBasedURLs; + + return $self; + } + + /** + * Azure OpenAI API version. + */ + public function withAPIVersion(string $apiVersion): self + { + $self = clone $this; + $self['apiVersion'] = $apiVersion; + + return $self; + } + + /** + * Base URL for the Azure OpenAI provider. + */ + public function withBaseURL(string $baseURL): self + { + $self = clone $this; + $self['baseURL'] = $baseURL; + + return $self; + } + + /** + * Custom headers sent with every request to the Azure OpenAI provider. + * + * @param array $headers + */ + public function withHeaders(array $headers): self + { + $self = clone $this; + $self['headers'] = $headers; + + return $self; + } + + /** + * Azure OpenAI resource name. + */ + public function withResourceName(string $resourceName): self + { + $self = clone $this; + $self['resourceName'] = $resourceName; + + return $self; + } + + /** + * Whether to use deployment-based Azure OpenAI URLs. + */ + public function withUseDeploymentBasedURLs( + bool $useDeploymentBasedURLs + ): self { + $self = clone $this; + $self['useDeploymentBasedURLs'] = $useDeploymentBasedURLs; + + return $self; + } +} diff --git a/src/Sessions/SessionExecuteParams/AgentConfig/ExecutionModel/GenericModelConfigObject.php b/src/Sessions/SessionExecuteParams/AgentConfig/ExecutionModel/GenericModelConfigObject.php index 8db0773..610d1c8 100644 --- a/src/Sessions/SessionExecuteParams/AgentConfig/ExecutionModel/GenericModelConfigObject.php +++ b/src/Sessions/SessionExecuteParams/AgentConfig/ExecutionModel/GenericModelConfigObject.php @@ -8,6 +8,7 @@ use Stagehand\Core\Attributes\Required; use Stagehand\Core\Concerns\SdkModel; use Stagehand\Core\Contracts\BaseModel; +use Stagehand\Sessions\SessionExecuteParams\AgentConfig\ExecutionModel\GenericModelConfigObject\OpenAIEndpointFormat; use Stagehand\Sessions\SessionExecuteParams\AgentConfig\ExecutionModel\GenericModelConfigObject\Provider; /** @@ -16,6 +17,7 @@ * apiKey?: string|null, * baseURL?: string|null, * headers?: array|null, + * openaiEndpointFormat?: null|OpenAIEndpointFormat|value-of, * provider?: null|Provider|value-of, * } */ @@ -50,6 +52,14 @@ final class GenericModelConfigObject implements BaseModel #[Optional(map: 'string')] public ?array $headers; + /** + * Wire format used by an OpenAI-compatible endpoint. Defaults to the Responses API; use chat for Chat Completions-only endpoints. + * + * @var value-of|null $openaiEndpointFormat + */ + #[Optional(enum: OpenAIEndpointFormat::class)] + public ?string $openaiEndpointFormat; + /** * AI provider for the model (or provide a baseURL endpoint instead). * @@ -83,6 +93,7 @@ public function __construct() * You must use named parameters to construct any parameters with a default value. * * @param array|null $headers + * @param OpenAIEndpointFormat|value-of|null $openaiEndpointFormat * @param Provider|value-of|null $provider */ public static function with( @@ -90,6 +101,7 @@ public static function with( ?string $apiKey = null, ?string $baseURL = null, ?array $headers = null, + OpenAIEndpointFormat|string|null $openaiEndpointFormat = null, Provider|string|null $provider = null, ): self { $self = new self; @@ -99,6 +111,7 @@ public static function with( null !== $apiKey && $self['apiKey'] = $apiKey; null !== $baseURL && $self['baseURL'] = $baseURL; null !== $headers && $self['headers'] = $headers; + null !== $openaiEndpointFormat && $self['openaiEndpointFormat'] = $openaiEndpointFormat; null !== $provider && $self['provider'] = $provider; return $self; @@ -150,6 +163,20 @@ public function withHeaders(array $headers): self return $self; } + /** + * Wire format used by an OpenAI-compatible endpoint. Defaults to the Responses API; use chat for Chat Completions-only endpoints. + * + * @param OpenAIEndpointFormat|value-of $openaiEndpointFormat + */ + public function withOpenAIEndpointFormat( + OpenAIEndpointFormat|string $openaiEndpointFormat + ): self { + $self = clone $this; + $self['openaiEndpointFormat'] = $openaiEndpointFormat; + + return $self; + } + /** * AI provider for the model (or provide a baseURL endpoint instead). * diff --git a/src/Sessions/SessionExecuteParams/AgentConfig/ExecutionModel/GenericModelConfigObject/OpenAIEndpointFormat.php b/src/Sessions/SessionExecuteParams/AgentConfig/ExecutionModel/GenericModelConfigObject/OpenAIEndpointFormat.php new file mode 100644 index 0000000..2ff3d18 --- /dev/null +++ b/src/Sessions/SessionExecuteParams/AgentConfig/ExecutionModel/GenericModelConfigObject/OpenAIEndpointFormat.php @@ -0,0 +1,15 @@ +|null, + * } + */ +final class AzureAPIKeyModelConfigObject implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Azure OpenAI model provider. + * + * @var 'azure' $provider + */ + #[Required] + public string $provider = 'azure'; + + /** + * Model name string with provider prefix (e.g., 'openai/gpt-5-nano'). + */ + #[Required] + public string $modelName; + + /** + * Azure provider-specific model configuration. + */ + #[Required] + public ProviderOptions $providerOptions; + + /** + * API key for the model provider. + */ + #[Optional] + public ?string $apiKey; + + /** + * Base URL for the model provider. + */ + #[Optional] + public ?string $baseURL; + + /** + * Custom headers sent with every request to the model provider. + * + * @var array|null $headers + */ + #[Optional(map: 'string')] + public ?array $headers; + + /** + * `new AzureAPIKeyModelConfigObject()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * AzureAPIKeyModelConfigObject::with(modelName: ..., providerOptions: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new AzureAPIKeyModelConfigObject)->withModelName(...)->withProviderOptions(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ProviderOptions|ProviderOptionsShape $providerOptions + * @param array|null $headers + */ + public static function with( + string $modelName, + ProviderOptions|array $providerOptions, + ?string $apiKey = null, + ?string $baseURL = null, + ?array $headers = null, + ): self { + $self = new self; + + $self['modelName'] = $modelName; + $self['providerOptions'] = $providerOptions; + + null !== $apiKey && $self['apiKey'] = $apiKey; + null !== $baseURL && $self['baseURL'] = $baseURL; + null !== $headers && $self['headers'] = $headers; + + return $self; + } + + /** + * Model name string with provider prefix (e.g., 'openai/gpt-5-nano'). + */ + public function withModelName(string $modelName): self + { + $self = clone $this; + $self['modelName'] = $modelName; + + return $self; + } + + /** + * Azure OpenAI model provider. + * + * @param 'azure' $provider + */ + public function withProvider(string $provider): self + { + $self = clone $this; + $self['provider'] = $provider; + + return $self; + } + + /** + * Azure provider-specific model configuration. + * + * @param ProviderOptions|ProviderOptionsShape $providerOptions + */ + public function withProviderOptions( + ProviderOptions|array $providerOptions + ): self { + $self = clone $this; + $self['providerOptions'] = $providerOptions; + + return $self; + } + + /** + * API key for the model provider. + */ + public function withAPIKey(string $apiKey): self + { + $self = clone $this; + $self['apiKey'] = $apiKey; + + return $self; + } + + /** + * Base URL for the model provider. + */ + public function withBaseURL(string $baseURL): self + { + $self = clone $this; + $self['baseURL'] = $baseURL; + + return $self; + } + + /** + * Custom headers sent with every request to the model provider. + * + * @param array $headers + */ + public function withHeaders(array $headers): self + { + $self = clone $this; + $self['headers'] = $headers; + + return $self; + } +} diff --git a/src/Sessions/SessionExecuteParams/AgentConfig/Model/AzureAPIKeyModelConfigObject/ProviderOptions.php b/src/Sessions/SessionExecuteParams/AgentConfig/Model/AzureAPIKeyModelConfigObject/ProviderOptions.php new file mode 100644 index 0000000..d4bf3dc --- /dev/null +++ b/src/Sessions/SessionExecuteParams/AgentConfig/Model/AzureAPIKeyModelConfigObject/ProviderOptions.php @@ -0,0 +1,77 @@ + */ + use SdkModel; + + /** + * Azure OpenAI provider-specific settings. + */ + #[Required] + public Azure $azure; + + /** + * `new ProviderOptions()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * ProviderOptions::with(azure: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new ProviderOptions)->withAzure(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Azure|AzureShape $azure + */ + public static function with(Azure|array $azure): self + { + $self = new self; + + $self['azure'] = $azure; + + return $self; + } + + /** + * Azure OpenAI provider-specific settings. + * + * @param Azure|AzureShape $azure + */ + public function withAzure(Azure|array $azure): self + { + $self = clone $this; + $self['azure'] = $azure; + + return $self; + } +} diff --git a/src/Sessions/SessionExecuteParams/AgentConfig/Model/AzureAPIKeyModelConfigObject/ProviderOptions/Azure.php b/src/Sessions/SessionExecuteParams/AgentConfig/Model/AzureAPIKeyModelConfigObject/ProviderOptions/Azure.php new file mode 100644 index 0000000..f52cfa2 --- /dev/null +++ b/src/Sessions/SessionExecuteParams/AgentConfig/Model/AzureAPIKeyModelConfigObject/ProviderOptions/Azure.php @@ -0,0 +1,146 @@ +|null, + * resourceName?: string|null, + * useDeploymentBasedURLs?: bool|null, + * } + */ +final class Azure implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Azure OpenAI API version. + */ + #[Optional] + public ?string $apiVersion; + + /** + * Base URL for the Azure OpenAI provider. + */ + #[Optional] + public ?string $baseURL; + + /** + * Custom headers sent with every request to the Azure OpenAI provider. + * + * @var array|null $headers + */ + #[Optional(map: 'string')] + public ?array $headers; + + /** + * Azure OpenAI resource name. + */ + #[Optional] + public ?string $resourceName; + + /** + * Whether to use deployment-based Azure OpenAI URLs. + */ + #[Optional('useDeploymentBasedUrls')] + public ?bool $useDeploymentBasedURLs; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param array|null $headers + */ + public static function with( + ?string $apiVersion = null, + ?string $baseURL = null, + ?array $headers = null, + ?string $resourceName = null, + ?bool $useDeploymentBasedURLs = null, + ): self { + $self = new self; + + null !== $apiVersion && $self['apiVersion'] = $apiVersion; + null !== $baseURL && $self['baseURL'] = $baseURL; + null !== $headers && $self['headers'] = $headers; + null !== $resourceName && $self['resourceName'] = $resourceName; + null !== $useDeploymentBasedURLs && $self['useDeploymentBasedURLs'] = $useDeploymentBasedURLs; + + return $self; + } + + /** + * Azure OpenAI API version. + */ + public function withAPIVersion(string $apiVersion): self + { + $self = clone $this; + $self['apiVersion'] = $apiVersion; + + return $self; + } + + /** + * Base URL for the Azure OpenAI provider. + */ + public function withBaseURL(string $baseURL): self + { + $self = clone $this; + $self['baseURL'] = $baseURL; + + return $self; + } + + /** + * Custom headers sent with every request to the Azure OpenAI provider. + * + * @param array $headers + */ + public function withHeaders(array $headers): self + { + $self = clone $this; + $self['headers'] = $headers; + + return $self; + } + + /** + * Azure OpenAI resource name. + */ + public function withResourceName(string $resourceName): self + { + $self = clone $this; + $self['resourceName'] = $resourceName; + + return $self; + } + + /** + * Whether to use deployment-based Azure OpenAI URLs. + */ + public function withUseDeploymentBasedURLs( + bool $useDeploymentBasedURLs + ): self { + $self = clone $this; + $self['useDeploymentBasedURLs'] = $useDeploymentBasedURLs; + + return $self; + } +} diff --git a/src/Sessions/SessionExecuteParams/AgentConfig/Model/AzureEntraModelConfigObject.php b/src/Sessions/SessionExecuteParams/AgentConfig/Model/AzureEntraModelConfigObject.php new file mode 100644 index 0000000..07fb78f --- /dev/null +++ b/src/Sessions/SessionExecuteParams/AgentConfig/Model/AzureEntraModelConfigObject.php @@ -0,0 +1,198 @@ +|null, + * } + */ +final class AzureEntraModelConfigObject implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Azure OpenAI model provider. + * + * @var 'azure' $provider + */ + #[Required] + public string $provider = 'azure'; + + /** + * Azure provider authentication configuration. + */ + #[Required] + public Auth $auth; + + /** + * Model name string with provider prefix (e.g., 'openai/gpt-5-nano'). + */ + #[Required] + public string $modelName; + + /** + * Azure provider-specific model configuration. + */ + #[Required] + public ProviderOptions $providerOptions; + + /** + * Base URL for the model provider. + */ + #[Optional] + public ?string $baseURL; + + /** + * Custom headers sent with every request to the model provider. + * + * @var array|null $headers + */ + #[Optional(map: 'string')] + public ?array $headers; + + /** + * `new AzureEntraModelConfigObject()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * AzureEntraModelConfigObject::with( + * auth: ..., modelName: ..., providerOptions: ... + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new AzureEntraModelConfigObject) + * ->withAuth(...) + * ->withModelName(...) + * ->withProviderOptions(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Auth|AuthShape $auth + * @param ProviderOptions|ProviderOptionsShape $providerOptions + * @param array|null $headers + */ + public static function with( + Auth|array $auth, + string $modelName, + ProviderOptions|array $providerOptions, + ?string $baseURL = null, + ?array $headers = null, + ): self { + $self = new self; + + $self['auth'] = $auth; + $self['modelName'] = $modelName; + $self['providerOptions'] = $providerOptions; + + null !== $baseURL && $self['baseURL'] = $baseURL; + null !== $headers && $self['headers'] = $headers; + + return $self; + } + + /** + * Azure provider authentication configuration. + * + * @param Auth|AuthShape $auth + */ + public function withAuth(Auth|array $auth): self + { + $self = clone $this; + $self['auth'] = $auth; + + return $self; + } + + /** + * Model name string with provider prefix (e.g., 'openai/gpt-5-nano'). + */ + public function withModelName(string $modelName): self + { + $self = clone $this; + $self['modelName'] = $modelName; + + return $self; + } + + /** + * Azure OpenAI model provider. + * + * @param 'azure' $provider + */ + public function withProvider(string $provider): self + { + $self = clone $this; + $self['provider'] = $provider; + + return $self; + } + + /** + * Azure provider-specific model configuration. + * + * @param ProviderOptions|ProviderOptionsShape $providerOptions + */ + public function withProviderOptions( + ProviderOptions|array $providerOptions + ): self { + $self = clone $this; + $self['providerOptions'] = $providerOptions; + + return $self; + } + + /** + * Base URL for the model provider. + */ + public function withBaseURL(string $baseURL): self + { + $self = clone $this; + $self['baseURL'] = $baseURL; + + return $self; + } + + /** + * Custom headers sent with every request to the model provider. + * + * @param array $headers + */ + public function withHeaders(array $headers): self + { + $self = clone $this; + $self['headers'] = $headers; + + return $self; + } +} diff --git a/src/Sessions/SessionExecuteParams/AgentConfig/Model/AzureEntraModelConfigObject/Auth.php b/src/Sessions/SessionExecuteParams/AgentConfig/Model/AzureEntraModelConfigObject/Auth.php new file mode 100644 index 0000000..267e681 --- /dev/null +++ b/src/Sessions/SessionExecuteParams/AgentConfig/Model/AzureEntraModelConfigObject/Auth.php @@ -0,0 +1,91 @@ + */ + use SdkModel; + + /** + * Use a Microsoft Entra ID bearer token for authentication. + * + * @var 'azureEntraId' $type + */ + #[Required] + public string $type = 'azureEntraId'; + + /** + * Microsoft Entra ID bearer token for Azure OpenAI. + */ + #[Required] + public string $token; + + /** + * `new Auth()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Auth::with(token: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Auth)->withToken(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $token): self + { + $self = new self; + + $self['token'] = $token; + + return $self; + } + + /** + * Microsoft Entra ID bearer token for Azure OpenAI. + */ + public function withToken(string $token): self + { + $self = clone $this; + $self['token'] = $token; + + return $self; + } + + /** + * Use a Microsoft Entra ID bearer token for authentication. + * + * @param 'azureEntraId' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Sessions/SessionExecuteParams/AgentConfig/Model/AzureEntraModelConfigObject/ProviderOptions.php b/src/Sessions/SessionExecuteParams/AgentConfig/Model/AzureEntraModelConfigObject/ProviderOptions.php new file mode 100644 index 0000000..5a0aa4a --- /dev/null +++ b/src/Sessions/SessionExecuteParams/AgentConfig/Model/AzureEntraModelConfigObject/ProviderOptions.php @@ -0,0 +1,77 @@ + */ + use SdkModel; + + /** + * Azure OpenAI provider-specific settings. + */ + #[Required] + public Azure $azure; + + /** + * `new ProviderOptions()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * ProviderOptions::with(azure: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new ProviderOptions)->withAzure(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Azure|AzureShape $azure + */ + public static function with(Azure|array $azure): self + { + $self = new self; + + $self['azure'] = $azure; + + return $self; + } + + /** + * Azure OpenAI provider-specific settings. + * + * @param Azure|AzureShape $azure + */ + public function withAzure(Azure|array $azure): self + { + $self = clone $this; + $self['azure'] = $azure; + + return $self; + } +} diff --git a/src/Sessions/SessionExecuteParams/AgentConfig/Model/AzureEntraModelConfigObject/ProviderOptions/Azure.php b/src/Sessions/SessionExecuteParams/AgentConfig/Model/AzureEntraModelConfigObject/ProviderOptions/Azure.php new file mode 100644 index 0000000..92e07ab --- /dev/null +++ b/src/Sessions/SessionExecuteParams/AgentConfig/Model/AzureEntraModelConfigObject/ProviderOptions/Azure.php @@ -0,0 +1,146 @@ +|null, + * resourceName?: string|null, + * useDeploymentBasedURLs?: bool|null, + * } + */ +final class Azure implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Azure OpenAI API version. + */ + #[Optional] + public ?string $apiVersion; + + /** + * Base URL for the Azure OpenAI provider. + */ + #[Optional] + public ?string $baseURL; + + /** + * Custom headers sent with every request to the Azure OpenAI provider. + * + * @var array|null $headers + */ + #[Optional(map: 'string')] + public ?array $headers; + + /** + * Azure OpenAI resource name. + */ + #[Optional] + public ?string $resourceName; + + /** + * Whether to use deployment-based Azure OpenAI URLs. + */ + #[Optional('useDeploymentBasedUrls')] + public ?bool $useDeploymentBasedURLs; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param array|null $headers + */ + public static function with( + ?string $apiVersion = null, + ?string $baseURL = null, + ?array $headers = null, + ?string $resourceName = null, + ?bool $useDeploymentBasedURLs = null, + ): self { + $self = new self; + + null !== $apiVersion && $self['apiVersion'] = $apiVersion; + null !== $baseURL && $self['baseURL'] = $baseURL; + null !== $headers && $self['headers'] = $headers; + null !== $resourceName && $self['resourceName'] = $resourceName; + null !== $useDeploymentBasedURLs && $self['useDeploymentBasedURLs'] = $useDeploymentBasedURLs; + + return $self; + } + + /** + * Azure OpenAI API version. + */ + public function withAPIVersion(string $apiVersion): self + { + $self = clone $this; + $self['apiVersion'] = $apiVersion; + + return $self; + } + + /** + * Base URL for the Azure OpenAI provider. + */ + public function withBaseURL(string $baseURL): self + { + $self = clone $this; + $self['baseURL'] = $baseURL; + + return $self; + } + + /** + * Custom headers sent with every request to the Azure OpenAI provider. + * + * @param array $headers + */ + public function withHeaders(array $headers): self + { + $self = clone $this; + $self['headers'] = $headers; + + return $self; + } + + /** + * Azure OpenAI resource name. + */ + public function withResourceName(string $resourceName): self + { + $self = clone $this; + $self['resourceName'] = $resourceName; + + return $self; + } + + /** + * Whether to use deployment-based Azure OpenAI URLs. + */ + public function withUseDeploymentBasedURLs( + bool $useDeploymentBasedURLs + ): self { + $self = clone $this; + $self['useDeploymentBasedURLs'] = $useDeploymentBasedURLs; + + return $self; + } +} diff --git a/src/Sessions/SessionExecuteParams/AgentConfig/Model/GenericModelConfigObject.php b/src/Sessions/SessionExecuteParams/AgentConfig/Model/GenericModelConfigObject.php index c8da856..a984f43 100644 --- a/src/Sessions/SessionExecuteParams/AgentConfig/Model/GenericModelConfigObject.php +++ b/src/Sessions/SessionExecuteParams/AgentConfig/Model/GenericModelConfigObject.php @@ -8,6 +8,7 @@ use Stagehand\Core\Attributes\Required; use Stagehand\Core\Concerns\SdkModel; use Stagehand\Core\Contracts\BaseModel; +use Stagehand\Sessions\SessionExecuteParams\AgentConfig\Model\GenericModelConfigObject\OpenAIEndpointFormat; use Stagehand\Sessions\SessionExecuteParams\AgentConfig\Model\GenericModelConfigObject\Provider; /** @@ -16,6 +17,7 @@ * apiKey?: string|null, * baseURL?: string|null, * headers?: array|null, + * openaiEndpointFormat?: null|OpenAIEndpointFormat|value-of, * provider?: null|Provider|value-of, * } */ @@ -50,6 +52,14 @@ final class GenericModelConfigObject implements BaseModel #[Optional(map: 'string')] public ?array $headers; + /** + * Wire format used by an OpenAI-compatible endpoint. Defaults to the Responses API; use chat for Chat Completions-only endpoints. + * + * @var value-of|null $openaiEndpointFormat + */ + #[Optional(enum: OpenAIEndpointFormat::class)] + public ?string $openaiEndpointFormat; + /** * AI provider for the model (or provide a baseURL endpoint instead). * @@ -83,6 +93,7 @@ public function __construct() * You must use named parameters to construct any parameters with a default value. * * @param array|null $headers + * @param OpenAIEndpointFormat|value-of|null $openaiEndpointFormat * @param Provider|value-of|null $provider */ public static function with( @@ -90,6 +101,7 @@ public static function with( ?string $apiKey = null, ?string $baseURL = null, ?array $headers = null, + OpenAIEndpointFormat|string|null $openaiEndpointFormat = null, Provider|string|null $provider = null, ): self { $self = new self; @@ -99,6 +111,7 @@ public static function with( null !== $apiKey && $self['apiKey'] = $apiKey; null !== $baseURL && $self['baseURL'] = $baseURL; null !== $headers && $self['headers'] = $headers; + null !== $openaiEndpointFormat && $self['openaiEndpointFormat'] = $openaiEndpointFormat; null !== $provider && $self['provider'] = $provider; return $self; @@ -150,6 +163,20 @@ public function withHeaders(array $headers): self return $self; } + /** + * Wire format used by an OpenAI-compatible endpoint. Defaults to the Responses API; use chat for Chat Completions-only endpoints. + * + * @param OpenAIEndpointFormat|value-of $openaiEndpointFormat + */ + public function withOpenAIEndpointFormat( + OpenAIEndpointFormat|string $openaiEndpointFormat + ): self { + $self = clone $this; + $self['openaiEndpointFormat'] = $openaiEndpointFormat; + + return $self; + } + /** * AI provider for the model (or provide a baseURL endpoint instead). * diff --git a/src/Sessions/SessionExecuteParams/AgentConfig/Model/GenericModelConfigObject/OpenAIEndpointFormat.php b/src/Sessions/SessionExecuteParams/AgentConfig/Model/GenericModelConfigObject/OpenAIEndpointFormat.php new file mode 100644 index 0000000..adb181c --- /dev/null +++ b/src/Sessions/SessionExecuteParams/AgentConfig/Model/GenericModelConfigObject/OpenAIEndpointFormat.php @@ -0,0 +1,15 @@ +|null, + * } + */ +final class AzureAPIKeyModelConfigObject implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Azure OpenAI model provider. + * + * @var 'azure' $provider + */ + #[Required] + public string $provider = 'azure'; + + /** + * Model name string with provider prefix (e.g., 'openai/gpt-5-nano'). + */ + #[Required] + public string $modelName; + + /** + * Azure provider-specific model configuration. + */ + #[Required] + public ProviderOptions $providerOptions; + + /** + * API key for the model provider. + */ + #[Optional] + public ?string $apiKey; + + /** + * Base URL for the model provider. + */ + #[Optional] + public ?string $baseURL; + + /** + * Custom headers sent with every request to the model provider. + * + * @var array|null $headers + */ + #[Optional(map: 'string')] + public ?array $headers; + + /** + * `new AzureAPIKeyModelConfigObject()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * AzureAPIKeyModelConfigObject::with(modelName: ..., providerOptions: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new AzureAPIKeyModelConfigObject)->withModelName(...)->withProviderOptions(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ProviderOptions|ProviderOptionsShape $providerOptions + * @param array|null $headers + */ + public static function with( + string $modelName, + ProviderOptions|array $providerOptions, + ?string $apiKey = null, + ?string $baseURL = null, + ?array $headers = null, + ): self { + $self = new self; + + $self['modelName'] = $modelName; + $self['providerOptions'] = $providerOptions; + + null !== $apiKey && $self['apiKey'] = $apiKey; + null !== $baseURL && $self['baseURL'] = $baseURL; + null !== $headers && $self['headers'] = $headers; + + return $self; + } + + /** + * Model name string with provider prefix (e.g., 'openai/gpt-5-nano'). + */ + public function withModelName(string $modelName): self + { + $self = clone $this; + $self['modelName'] = $modelName; + + return $self; + } + + /** + * Azure OpenAI model provider. + * + * @param 'azure' $provider + */ + public function withProvider(string $provider): self + { + $self = clone $this; + $self['provider'] = $provider; + + return $self; + } + + /** + * Azure provider-specific model configuration. + * + * @param ProviderOptions|ProviderOptionsShape $providerOptions + */ + public function withProviderOptions( + ProviderOptions|array $providerOptions + ): self { + $self = clone $this; + $self['providerOptions'] = $providerOptions; + + return $self; + } + + /** + * API key for the model provider. + */ + public function withAPIKey(string $apiKey): self + { + $self = clone $this; + $self['apiKey'] = $apiKey; + + return $self; + } + + /** + * Base URL for the model provider. + */ + public function withBaseURL(string $baseURL): self + { + $self = clone $this; + $self['baseURL'] = $baseURL; + + return $self; + } + + /** + * Custom headers sent with every request to the model provider. + * + * @param array $headers + */ + public function withHeaders(array $headers): self + { + $self = clone $this; + $self['headers'] = $headers; + + return $self; + } +} diff --git a/src/Sessions/SessionExtractParams/Options/Model/AzureAPIKeyModelConfigObject/ProviderOptions.php b/src/Sessions/SessionExtractParams/Options/Model/AzureAPIKeyModelConfigObject/ProviderOptions.php new file mode 100644 index 0000000..f182781 --- /dev/null +++ b/src/Sessions/SessionExtractParams/Options/Model/AzureAPIKeyModelConfigObject/ProviderOptions.php @@ -0,0 +1,77 @@ + */ + use SdkModel; + + /** + * Azure OpenAI provider-specific settings. + */ + #[Required] + public Azure $azure; + + /** + * `new ProviderOptions()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * ProviderOptions::with(azure: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new ProviderOptions)->withAzure(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Azure|AzureShape $azure + */ + public static function with(Azure|array $azure): self + { + $self = new self; + + $self['azure'] = $azure; + + return $self; + } + + /** + * Azure OpenAI provider-specific settings. + * + * @param Azure|AzureShape $azure + */ + public function withAzure(Azure|array $azure): self + { + $self = clone $this; + $self['azure'] = $azure; + + return $self; + } +} diff --git a/src/Sessions/SessionExtractParams/Options/Model/AzureAPIKeyModelConfigObject/ProviderOptions/Azure.php b/src/Sessions/SessionExtractParams/Options/Model/AzureAPIKeyModelConfigObject/ProviderOptions/Azure.php new file mode 100644 index 0000000..49c5469 --- /dev/null +++ b/src/Sessions/SessionExtractParams/Options/Model/AzureAPIKeyModelConfigObject/ProviderOptions/Azure.php @@ -0,0 +1,146 @@ +|null, + * resourceName?: string|null, + * useDeploymentBasedURLs?: bool|null, + * } + */ +final class Azure implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Azure OpenAI API version. + */ + #[Optional] + public ?string $apiVersion; + + /** + * Base URL for the Azure OpenAI provider. + */ + #[Optional] + public ?string $baseURL; + + /** + * Custom headers sent with every request to the Azure OpenAI provider. + * + * @var array|null $headers + */ + #[Optional(map: 'string')] + public ?array $headers; + + /** + * Azure OpenAI resource name. + */ + #[Optional] + public ?string $resourceName; + + /** + * Whether to use deployment-based Azure OpenAI URLs. + */ + #[Optional('useDeploymentBasedUrls')] + public ?bool $useDeploymentBasedURLs; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param array|null $headers + */ + public static function with( + ?string $apiVersion = null, + ?string $baseURL = null, + ?array $headers = null, + ?string $resourceName = null, + ?bool $useDeploymentBasedURLs = null, + ): self { + $self = new self; + + null !== $apiVersion && $self['apiVersion'] = $apiVersion; + null !== $baseURL && $self['baseURL'] = $baseURL; + null !== $headers && $self['headers'] = $headers; + null !== $resourceName && $self['resourceName'] = $resourceName; + null !== $useDeploymentBasedURLs && $self['useDeploymentBasedURLs'] = $useDeploymentBasedURLs; + + return $self; + } + + /** + * Azure OpenAI API version. + */ + public function withAPIVersion(string $apiVersion): self + { + $self = clone $this; + $self['apiVersion'] = $apiVersion; + + return $self; + } + + /** + * Base URL for the Azure OpenAI provider. + */ + public function withBaseURL(string $baseURL): self + { + $self = clone $this; + $self['baseURL'] = $baseURL; + + return $self; + } + + /** + * Custom headers sent with every request to the Azure OpenAI provider. + * + * @param array $headers + */ + public function withHeaders(array $headers): self + { + $self = clone $this; + $self['headers'] = $headers; + + return $self; + } + + /** + * Azure OpenAI resource name. + */ + public function withResourceName(string $resourceName): self + { + $self = clone $this; + $self['resourceName'] = $resourceName; + + return $self; + } + + /** + * Whether to use deployment-based Azure OpenAI URLs. + */ + public function withUseDeploymentBasedURLs( + bool $useDeploymentBasedURLs + ): self { + $self = clone $this; + $self['useDeploymentBasedURLs'] = $useDeploymentBasedURLs; + + return $self; + } +} diff --git a/src/Sessions/SessionExtractParams/Options/Model/AzureEntraModelConfigObject.php b/src/Sessions/SessionExtractParams/Options/Model/AzureEntraModelConfigObject.php new file mode 100644 index 0000000..128c2b8 --- /dev/null +++ b/src/Sessions/SessionExtractParams/Options/Model/AzureEntraModelConfigObject.php @@ -0,0 +1,198 @@ +|null, + * } + */ +final class AzureEntraModelConfigObject implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Azure OpenAI model provider. + * + * @var 'azure' $provider + */ + #[Required] + public string $provider = 'azure'; + + /** + * Azure provider authentication configuration. + */ + #[Required] + public Auth $auth; + + /** + * Model name string with provider prefix (e.g., 'openai/gpt-5-nano'). + */ + #[Required] + public string $modelName; + + /** + * Azure provider-specific model configuration. + */ + #[Required] + public ProviderOptions $providerOptions; + + /** + * Base URL for the model provider. + */ + #[Optional] + public ?string $baseURL; + + /** + * Custom headers sent with every request to the model provider. + * + * @var array|null $headers + */ + #[Optional(map: 'string')] + public ?array $headers; + + /** + * `new AzureEntraModelConfigObject()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * AzureEntraModelConfigObject::with( + * auth: ..., modelName: ..., providerOptions: ... + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new AzureEntraModelConfigObject) + * ->withAuth(...) + * ->withModelName(...) + * ->withProviderOptions(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Auth|AuthShape $auth + * @param ProviderOptions|ProviderOptionsShape $providerOptions + * @param array|null $headers + */ + public static function with( + Auth|array $auth, + string $modelName, + ProviderOptions|array $providerOptions, + ?string $baseURL = null, + ?array $headers = null, + ): self { + $self = new self; + + $self['auth'] = $auth; + $self['modelName'] = $modelName; + $self['providerOptions'] = $providerOptions; + + null !== $baseURL && $self['baseURL'] = $baseURL; + null !== $headers && $self['headers'] = $headers; + + return $self; + } + + /** + * Azure provider authentication configuration. + * + * @param Auth|AuthShape $auth + */ + public function withAuth(Auth|array $auth): self + { + $self = clone $this; + $self['auth'] = $auth; + + return $self; + } + + /** + * Model name string with provider prefix (e.g., 'openai/gpt-5-nano'). + */ + public function withModelName(string $modelName): self + { + $self = clone $this; + $self['modelName'] = $modelName; + + return $self; + } + + /** + * Azure OpenAI model provider. + * + * @param 'azure' $provider + */ + public function withProvider(string $provider): self + { + $self = clone $this; + $self['provider'] = $provider; + + return $self; + } + + /** + * Azure provider-specific model configuration. + * + * @param ProviderOptions|ProviderOptionsShape $providerOptions + */ + public function withProviderOptions( + ProviderOptions|array $providerOptions + ): self { + $self = clone $this; + $self['providerOptions'] = $providerOptions; + + return $self; + } + + /** + * Base URL for the model provider. + */ + public function withBaseURL(string $baseURL): self + { + $self = clone $this; + $self['baseURL'] = $baseURL; + + return $self; + } + + /** + * Custom headers sent with every request to the model provider. + * + * @param array $headers + */ + public function withHeaders(array $headers): self + { + $self = clone $this; + $self['headers'] = $headers; + + return $self; + } +} diff --git a/src/Sessions/SessionExtractParams/Options/Model/AzureEntraModelConfigObject/Auth.php b/src/Sessions/SessionExtractParams/Options/Model/AzureEntraModelConfigObject/Auth.php new file mode 100644 index 0000000..977f8e1 --- /dev/null +++ b/src/Sessions/SessionExtractParams/Options/Model/AzureEntraModelConfigObject/Auth.php @@ -0,0 +1,91 @@ + */ + use SdkModel; + + /** + * Use a Microsoft Entra ID bearer token for authentication. + * + * @var 'azureEntraId' $type + */ + #[Required] + public string $type = 'azureEntraId'; + + /** + * Microsoft Entra ID bearer token for Azure OpenAI. + */ + #[Required] + public string $token; + + /** + * `new Auth()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Auth::with(token: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Auth)->withToken(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $token): self + { + $self = new self; + + $self['token'] = $token; + + return $self; + } + + /** + * Microsoft Entra ID bearer token for Azure OpenAI. + */ + public function withToken(string $token): self + { + $self = clone $this; + $self['token'] = $token; + + return $self; + } + + /** + * Use a Microsoft Entra ID bearer token for authentication. + * + * @param 'azureEntraId' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Sessions/SessionExtractParams/Options/Model/AzureEntraModelConfigObject/ProviderOptions.php b/src/Sessions/SessionExtractParams/Options/Model/AzureEntraModelConfigObject/ProviderOptions.php new file mode 100644 index 0000000..c244c01 --- /dev/null +++ b/src/Sessions/SessionExtractParams/Options/Model/AzureEntraModelConfigObject/ProviderOptions.php @@ -0,0 +1,77 @@ + */ + use SdkModel; + + /** + * Azure OpenAI provider-specific settings. + */ + #[Required] + public Azure $azure; + + /** + * `new ProviderOptions()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * ProviderOptions::with(azure: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new ProviderOptions)->withAzure(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Azure|AzureShape $azure + */ + public static function with(Azure|array $azure): self + { + $self = new self; + + $self['azure'] = $azure; + + return $self; + } + + /** + * Azure OpenAI provider-specific settings. + * + * @param Azure|AzureShape $azure + */ + public function withAzure(Azure|array $azure): self + { + $self = clone $this; + $self['azure'] = $azure; + + return $self; + } +} diff --git a/src/Sessions/SessionExtractParams/Options/Model/AzureEntraModelConfigObject/ProviderOptions/Azure.php b/src/Sessions/SessionExtractParams/Options/Model/AzureEntraModelConfigObject/ProviderOptions/Azure.php new file mode 100644 index 0000000..ec659ce --- /dev/null +++ b/src/Sessions/SessionExtractParams/Options/Model/AzureEntraModelConfigObject/ProviderOptions/Azure.php @@ -0,0 +1,146 @@ +|null, + * resourceName?: string|null, + * useDeploymentBasedURLs?: bool|null, + * } + */ +final class Azure implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Azure OpenAI API version. + */ + #[Optional] + public ?string $apiVersion; + + /** + * Base URL for the Azure OpenAI provider. + */ + #[Optional] + public ?string $baseURL; + + /** + * Custom headers sent with every request to the Azure OpenAI provider. + * + * @var array|null $headers + */ + #[Optional(map: 'string')] + public ?array $headers; + + /** + * Azure OpenAI resource name. + */ + #[Optional] + public ?string $resourceName; + + /** + * Whether to use deployment-based Azure OpenAI URLs. + */ + #[Optional('useDeploymentBasedUrls')] + public ?bool $useDeploymentBasedURLs; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param array|null $headers + */ + public static function with( + ?string $apiVersion = null, + ?string $baseURL = null, + ?array $headers = null, + ?string $resourceName = null, + ?bool $useDeploymentBasedURLs = null, + ): self { + $self = new self; + + null !== $apiVersion && $self['apiVersion'] = $apiVersion; + null !== $baseURL && $self['baseURL'] = $baseURL; + null !== $headers && $self['headers'] = $headers; + null !== $resourceName && $self['resourceName'] = $resourceName; + null !== $useDeploymentBasedURLs && $self['useDeploymentBasedURLs'] = $useDeploymentBasedURLs; + + return $self; + } + + /** + * Azure OpenAI API version. + */ + public function withAPIVersion(string $apiVersion): self + { + $self = clone $this; + $self['apiVersion'] = $apiVersion; + + return $self; + } + + /** + * Base URL for the Azure OpenAI provider. + */ + public function withBaseURL(string $baseURL): self + { + $self = clone $this; + $self['baseURL'] = $baseURL; + + return $self; + } + + /** + * Custom headers sent with every request to the Azure OpenAI provider. + * + * @param array $headers + */ + public function withHeaders(array $headers): self + { + $self = clone $this; + $self['headers'] = $headers; + + return $self; + } + + /** + * Azure OpenAI resource name. + */ + public function withResourceName(string $resourceName): self + { + $self = clone $this; + $self['resourceName'] = $resourceName; + + return $self; + } + + /** + * Whether to use deployment-based Azure OpenAI URLs. + */ + public function withUseDeploymentBasedURLs( + bool $useDeploymentBasedURLs + ): self { + $self = clone $this; + $self['useDeploymentBasedURLs'] = $useDeploymentBasedURLs; + + return $self; + } +} diff --git a/src/Sessions/SessionExtractParams/Options/Model/GenericModelConfigObject.php b/src/Sessions/SessionExtractParams/Options/Model/GenericModelConfigObject.php index f880b96..8acd519 100644 --- a/src/Sessions/SessionExtractParams/Options/Model/GenericModelConfigObject.php +++ b/src/Sessions/SessionExtractParams/Options/Model/GenericModelConfigObject.php @@ -8,6 +8,7 @@ use Stagehand\Core\Attributes\Required; use Stagehand\Core\Concerns\SdkModel; use Stagehand\Core\Contracts\BaseModel; +use Stagehand\Sessions\SessionExtractParams\Options\Model\GenericModelConfigObject\OpenAIEndpointFormat; use Stagehand\Sessions\SessionExtractParams\Options\Model\GenericModelConfigObject\Provider; /** @@ -16,6 +17,7 @@ * apiKey?: string|null, * baseURL?: string|null, * headers?: array|null, + * openaiEndpointFormat?: null|OpenAIEndpointFormat|value-of, * provider?: null|Provider|value-of, * } */ @@ -50,6 +52,14 @@ final class GenericModelConfigObject implements BaseModel #[Optional(map: 'string')] public ?array $headers; + /** + * Wire format used by an OpenAI-compatible endpoint. Defaults to the Responses API; use chat for Chat Completions-only endpoints. + * + * @var value-of|null $openaiEndpointFormat + */ + #[Optional(enum: OpenAIEndpointFormat::class)] + public ?string $openaiEndpointFormat; + /** * AI provider for the model (or provide a baseURL endpoint instead). * @@ -83,6 +93,7 @@ public function __construct() * You must use named parameters to construct any parameters with a default value. * * @param array|null $headers + * @param OpenAIEndpointFormat|value-of|null $openaiEndpointFormat * @param Provider|value-of|null $provider */ public static function with( @@ -90,6 +101,7 @@ public static function with( ?string $apiKey = null, ?string $baseURL = null, ?array $headers = null, + OpenAIEndpointFormat|string|null $openaiEndpointFormat = null, Provider|string|null $provider = null, ): self { $self = new self; @@ -99,6 +111,7 @@ public static function with( null !== $apiKey && $self['apiKey'] = $apiKey; null !== $baseURL && $self['baseURL'] = $baseURL; null !== $headers && $self['headers'] = $headers; + null !== $openaiEndpointFormat && $self['openaiEndpointFormat'] = $openaiEndpointFormat; null !== $provider && $self['provider'] = $provider; return $self; @@ -150,6 +163,20 @@ public function withHeaders(array $headers): self return $self; } + /** + * Wire format used by an OpenAI-compatible endpoint. Defaults to the Responses API; use chat for Chat Completions-only endpoints. + * + * @param OpenAIEndpointFormat|value-of $openaiEndpointFormat + */ + public function withOpenAIEndpointFormat( + OpenAIEndpointFormat|string $openaiEndpointFormat + ): self { + $self = clone $this; + $self['openaiEndpointFormat'] = $openaiEndpointFormat; + + return $self; + } + /** * AI provider for the model (or provide a baseURL endpoint instead). * diff --git a/src/Sessions/SessionExtractParams/Options/Model/GenericModelConfigObject/OpenAIEndpointFormat.php b/src/Sessions/SessionExtractParams/Options/Model/GenericModelConfigObject/OpenAIEndpointFormat.php new file mode 100644 index 0000000..19fe585 --- /dev/null +++ b/src/Sessions/SessionExtractParams/Options/Model/GenericModelConfigObject/OpenAIEndpointFormat.php @@ -0,0 +1,15 @@ +|null, + * } + */ +final class AzureAPIKeyModelConfigObject implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Azure OpenAI model provider. + * + * @var 'azure' $provider + */ + #[Required] + public string $provider = 'azure'; + + /** + * Model name string with provider prefix (e.g., 'openai/gpt-5-nano'). + */ + #[Required] + public string $modelName; + + /** + * Azure provider-specific model configuration. + */ + #[Required] + public ProviderOptions $providerOptions; + + /** + * API key for the model provider. + */ + #[Optional] + public ?string $apiKey; + + /** + * Base URL for the model provider. + */ + #[Optional] + public ?string $baseURL; + + /** + * Custom headers sent with every request to the model provider. + * + * @var array|null $headers + */ + #[Optional(map: 'string')] + public ?array $headers; + + /** + * `new AzureAPIKeyModelConfigObject()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * AzureAPIKeyModelConfigObject::with(modelName: ..., providerOptions: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new AzureAPIKeyModelConfigObject)->withModelName(...)->withProviderOptions(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ProviderOptions|ProviderOptionsShape $providerOptions + * @param array|null $headers + */ + public static function with( + string $modelName, + ProviderOptions|array $providerOptions, + ?string $apiKey = null, + ?string $baseURL = null, + ?array $headers = null, + ): self { + $self = new self; + + $self['modelName'] = $modelName; + $self['providerOptions'] = $providerOptions; + + null !== $apiKey && $self['apiKey'] = $apiKey; + null !== $baseURL && $self['baseURL'] = $baseURL; + null !== $headers && $self['headers'] = $headers; + + return $self; + } + + /** + * Model name string with provider prefix (e.g., 'openai/gpt-5-nano'). + */ + public function withModelName(string $modelName): self + { + $self = clone $this; + $self['modelName'] = $modelName; + + return $self; + } + + /** + * Azure OpenAI model provider. + * + * @param 'azure' $provider + */ + public function withProvider(string $provider): self + { + $self = clone $this; + $self['provider'] = $provider; + + return $self; + } + + /** + * Azure provider-specific model configuration. + * + * @param ProviderOptions|ProviderOptionsShape $providerOptions + */ + public function withProviderOptions( + ProviderOptions|array $providerOptions + ): self { + $self = clone $this; + $self['providerOptions'] = $providerOptions; + + return $self; + } + + /** + * API key for the model provider. + */ + public function withAPIKey(string $apiKey): self + { + $self = clone $this; + $self['apiKey'] = $apiKey; + + return $self; + } + + /** + * Base URL for the model provider. + */ + public function withBaseURL(string $baseURL): self + { + $self = clone $this; + $self['baseURL'] = $baseURL; + + return $self; + } + + /** + * Custom headers sent with every request to the model provider. + * + * @param array $headers + */ + public function withHeaders(array $headers): self + { + $self = clone $this; + $self['headers'] = $headers; + + return $self; + } +} diff --git a/src/Sessions/SessionObserveParams/Options/Model/AzureAPIKeyModelConfigObject/ProviderOptions.php b/src/Sessions/SessionObserveParams/Options/Model/AzureAPIKeyModelConfigObject/ProviderOptions.php new file mode 100644 index 0000000..4c746c5 --- /dev/null +++ b/src/Sessions/SessionObserveParams/Options/Model/AzureAPIKeyModelConfigObject/ProviderOptions.php @@ -0,0 +1,77 @@ + */ + use SdkModel; + + /** + * Azure OpenAI provider-specific settings. + */ + #[Required] + public Azure $azure; + + /** + * `new ProviderOptions()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * ProviderOptions::with(azure: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new ProviderOptions)->withAzure(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Azure|AzureShape $azure + */ + public static function with(Azure|array $azure): self + { + $self = new self; + + $self['azure'] = $azure; + + return $self; + } + + /** + * Azure OpenAI provider-specific settings. + * + * @param Azure|AzureShape $azure + */ + public function withAzure(Azure|array $azure): self + { + $self = clone $this; + $self['azure'] = $azure; + + return $self; + } +} diff --git a/src/Sessions/SessionObserveParams/Options/Model/AzureAPIKeyModelConfigObject/ProviderOptions/Azure.php b/src/Sessions/SessionObserveParams/Options/Model/AzureAPIKeyModelConfigObject/ProviderOptions/Azure.php new file mode 100644 index 0000000..fe88cb0 --- /dev/null +++ b/src/Sessions/SessionObserveParams/Options/Model/AzureAPIKeyModelConfigObject/ProviderOptions/Azure.php @@ -0,0 +1,146 @@ +|null, + * resourceName?: string|null, + * useDeploymentBasedURLs?: bool|null, + * } + */ +final class Azure implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Azure OpenAI API version. + */ + #[Optional] + public ?string $apiVersion; + + /** + * Base URL for the Azure OpenAI provider. + */ + #[Optional] + public ?string $baseURL; + + /** + * Custom headers sent with every request to the Azure OpenAI provider. + * + * @var array|null $headers + */ + #[Optional(map: 'string')] + public ?array $headers; + + /** + * Azure OpenAI resource name. + */ + #[Optional] + public ?string $resourceName; + + /** + * Whether to use deployment-based Azure OpenAI URLs. + */ + #[Optional('useDeploymentBasedUrls')] + public ?bool $useDeploymentBasedURLs; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param array|null $headers + */ + public static function with( + ?string $apiVersion = null, + ?string $baseURL = null, + ?array $headers = null, + ?string $resourceName = null, + ?bool $useDeploymentBasedURLs = null, + ): self { + $self = new self; + + null !== $apiVersion && $self['apiVersion'] = $apiVersion; + null !== $baseURL && $self['baseURL'] = $baseURL; + null !== $headers && $self['headers'] = $headers; + null !== $resourceName && $self['resourceName'] = $resourceName; + null !== $useDeploymentBasedURLs && $self['useDeploymentBasedURLs'] = $useDeploymentBasedURLs; + + return $self; + } + + /** + * Azure OpenAI API version. + */ + public function withAPIVersion(string $apiVersion): self + { + $self = clone $this; + $self['apiVersion'] = $apiVersion; + + return $self; + } + + /** + * Base URL for the Azure OpenAI provider. + */ + public function withBaseURL(string $baseURL): self + { + $self = clone $this; + $self['baseURL'] = $baseURL; + + return $self; + } + + /** + * Custom headers sent with every request to the Azure OpenAI provider. + * + * @param array $headers + */ + public function withHeaders(array $headers): self + { + $self = clone $this; + $self['headers'] = $headers; + + return $self; + } + + /** + * Azure OpenAI resource name. + */ + public function withResourceName(string $resourceName): self + { + $self = clone $this; + $self['resourceName'] = $resourceName; + + return $self; + } + + /** + * Whether to use deployment-based Azure OpenAI URLs. + */ + public function withUseDeploymentBasedURLs( + bool $useDeploymentBasedURLs + ): self { + $self = clone $this; + $self['useDeploymentBasedURLs'] = $useDeploymentBasedURLs; + + return $self; + } +} diff --git a/src/Sessions/SessionObserveParams/Options/Model/AzureEntraModelConfigObject.php b/src/Sessions/SessionObserveParams/Options/Model/AzureEntraModelConfigObject.php new file mode 100644 index 0000000..f716a1d --- /dev/null +++ b/src/Sessions/SessionObserveParams/Options/Model/AzureEntraModelConfigObject.php @@ -0,0 +1,198 @@ +|null, + * } + */ +final class AzureEntraModelConfigObject implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Azure OpenAI model provider. + * + * @var 'azure' $provider + */ + #[Required] + public string $provider = 'azure'; + + /** + * Azure provider authentication configuration. + */ + #[Required] + public Auth $auth; + + /** + * Model name string with provider prefix (e.g., 'openai/gpt-5-nano'). + */ + #[Required] + public string $modelName; + + /** + * Azure provider-specific model configuration. + */ + #[Required] + public ProviderOptions $providerOptions; + + /** + * Base URL for the model provider. + */ + #[Optional] + public ?string $baseURL; + + /** + * Custom headers sent with every request to the model provider. + * + * @var array|null $headers + */ + #[Optional(map: 'string')] + public ?array $headers; + + /** + * `new AzureEntraModelConfigObject()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * AzureEntraModelConfigObject::with( + * auth: ..., modelName: ..., providerOptions: ... + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new AzureEntraModelConfigObject) + * ->withAuth(...) + * ->withModelName(...) + * ->withProviderOptions(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Auth|AuthShape $auth + * @param ProviderOptions|ProviderOptionsShape $providerOptions + * @param array|null $headers + */ + public static function with( + Auth|array $auth, + string $modelName, + ProviderOptions|array $providerOptions, + ?string $baseURL = null, + ?array $headers = null, + ): self { + $self = new self; + + $self['auth'] = $auth; + $self['modelName'] = $modelName; + $self['providerOptions'] = $providerOptions; + + null !== $baseURL && $self['baseURL'] = $baseURL; + null !== $headers && $self['headers'] = $headers; + + return $self; + } + + /** + * Azure provider authentication configuration. + * + * @param Auth|AuthShape $auth + */ + public function withAuth(Auth|array $auth): self + { + $self = clone $this; + $self['auth'] = $auth; + + return $self; + } + + /** + * Model name string with provider prefix (e.g., 'openai/gpt-5-nano'). + */ + public function withModelName(string $modelName): self + { + $self = clone $this; + $self['modelName'] = $modelName; + + return $self; + } + + /** + * Azure OpenAI model provider. + * + * @param 'azure' $provider + */ + public function withProvider(string $provider): self + { + $self = clone $this; + $self['provider'] = $provider; + + return $self; + } + + /** + * Azure provider-specific model configuration. + * + * @param ProviderOptions|ProviderOptionsShape $providerOptions + */ + public function withProviderOptions( + ProviderOptions|array $providerOptions + ): self { + $self = clone $this; + $self['providerOptions'] = $providerOptions; + + return $self; + } + + /** + * Base URL for the model provider. + */ + public function withBaseURL(string $baseURL): self + { + $self = clone $this; + $self['baseURL'] = $baseURL; + + return $self; + } + + /** + * Custom headers sent with every request to the model provider. + * + * @param array $headers + */ + public function withHeaders(array $headers): self + { + $self = clone $this; + $self['headers'] = $headers; + + return $self; + } +} diff --git a/src/Sessions/SessionObserveParams/Options/Model/AzureEntraModelConfigObject/Auth.php b/src/Sessions/SessionObserveParams/Options/Model/AzureEntraModelConfigObject/Auth.php new file mode 100644 index 0000000..797484b --- /dev/null +++ b/src/Sessions/SessionObserveParams/Options/Model/AzureEntraModelConfigObject/Auth.php @@ -0,0 +1,91 @@ + */ + use SdkModel; + + /** + * Use a Microsoft Entra ID bearer token for authentication. + * + * @var 'azureEntraId' $type + */ + #[Required] + public string $type = 'azureEntraId'; + + /** + * Microsoft Entra ID bearer token for Azure OpenAI. + */ + #[Required] + public string $token; + + /** + * `new Auth()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Auth::with(token: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Auth)->withToken(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $token): self + { + $self = new self; + + $self['token'] = $token; + + return $self; + } + + /** + * Microsoft Entra ID bearer token for Azure OpenAI. + */ + public function withToken(string $token): self + { + $self = clone $this; + $self['token'] = $token; + + return $self; + } + + /** + * Use a Microsoft Entra ID bearer token for authentication. + * + * @param 'azureEntraId' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Sessions/SessionObserveParams/Options/Model/AzureEntraModelConfigObject/ProviderOptions.php b/src/Sessions/SessionObserveParams/Options/Model/AzureEntraModelConfigObject/ProviderOptions.php new file mode 100644 index 0000000..9e25ab7 --- /dev/null +++ b/src/Sessions/SessionObserveParams/Options/Model/AzureEntraModelConfigObject/ProviderOptions.php @@ -0,0 +1,77 @@ + */ + use SdkModel; + + /** + * Azure OpenAI provider-specific settings. + */ + #[Required] + public Azure $azure; + + /** + * `new ProviderOptions()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * ProviderOptions::with(azure: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new ProviderOptions)->withAzure(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Azure|AzureShape $azure + */ + public static function with(Azure|array $azure): self + { + $self = new self; + + $self['azure'] = $azure; + + return $self; + } + + /** + * Azure OpenAI provider-specific settings. + * + * @param Azure|AzureShape $azure + */ + public function withAzure(Azure|array $azure): self + { + $self = clone $this; + $self['azure'] = $azure; + + return $self; + } +} diff --git a/src/Sessions/SessionObserveParams/Options/Model/AzureEntraModelConfigObject/ProviderOptions/Azure.php b/src/Sessions/SessionObserveParams/Options/Model/AzureEntraModelConfigObject/ProviderOptions/Azure.php new file mode 100644 index 0000000..9491502 --- /dev/null +++ b/src/Sessions/SessionObserveParams/Options/Model/AzureEntraModelConfigObject/ProviderOptions/Azure.php @@ -0,0 +1,146 @@ +|null, + * resourceName?: string|null, + * useDeploymentBasedURLs?: bool|null, + * } + */ +final class Azure implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Azure OpenAI API version. + */ + #[Optional] + public ?string $apiVersion; + + /** + * Base URL for the Azure OpenAI provider. + */ + #[Optional] + public ?string $baseURL; + + /** + * Custom headers sent with every request to the Azure OpenAI provider. + * + * @var array|null $headers + */ + #[Optional(map: 'string')] + public ?array $headers; + + /** + * Azure OpenAI resource name. + */ + #[Optional] + public ?string $resourceName; + + /** + * Whether to use deployment-based Azure OpenAI URLs. + */ + #[Optional('useDeploymentBasedUrls')] + public ?bool $useDeploymentBasedURLs; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param array|null $headers + */ + public static function with( + ?string $apiVersion = null, + ?string $baseURL = null, + ?array $headers = null, + ?string $resourceName = null, + ?bool $useDeploymentBasedURLs = null, + ): self { + $self = new self; + + null !== $apiVersion && $self['apiVersion'] = $apiVersion; + null !== $baseURL && $self['baseURL'] = $baseURL; + null !== $headers && $self['headers'] = $headers; + null !== $resourceName && $self['resourceName'] = $resourceName; + null !== $useDeploymentBasedURLs && $self['useDeploymentBasedURLs'] = $useDeploymentBasedURLs; + + return $self; + } + + /** + * Azure OpenAI API version. + */ + public function withAPIVersion(string $apiVersion): self + { + $self = clone $this; + $self['apiVersion'] = $apiVersion; + + return $self; + } + + /** + * Base URL for the Azure OpenAI provider. + */ + public function withBaseURL(string $baseURL): self + { + $self = clone $this; + $self['baseURL'] = $baseURL; + + return $self; + } + + /** + * Custom headers sent with every request to the Azure OpenAI provider. + * + * @param array $headers + */ + public function withHeaders(array $headers): self + { + $self = clone $this; + $self['headers'] = $headers; + + return $self; + } + + /** + * Azure OpenAI resource name. + */ + public function withResourceName(string $resourceName): self + { + $self = clone $this; + $self['resourceName'] = $resourceName; + + return $self; + } + + /** + * Whether to use deployment-based Azure OpenAI URLs. + */ + public function withUseDeploymentBasedURLs( + bool $useDeploymentBasedURLs + ): self { + $self = clone $this; + $self['useDeploymentBasedURLs'] = $useDeploymentBasedURLs; + + return $self; + } +} diff --git a/src/Sessions/SessionObserveParams/Options/Model/GenericModelConfigObject.php b/src/Sessions/SessionObserveParams/Options/Model/GenericModelConfigObject.php index b9b1a17..8fa5b57 100644 --- a/src/Sessions/SessionObserveParams/Options/Model/GenericModelConfigObject.php +++ b/src/Sessions/SessionObserveParams/Options/Model/GenericModelConfigObject.php @@ -8,6 +8,7 @@ use Stagehand\Core\Attributes\Required; use Stagehand\Core\Concerns\SdkModel; use Stagehand\Core\Contracts\BaseModel; +use Stagehand\Sessions\SessionObserveParams\Options\Model\GenericModelConfigObject\OpenAIEndpointFormat; use Stagehand\Sessions\SessionObserveParams\Options\Model\GenericModelConfigObject\Provider; /** @@ -16,6 +17,7 @@ * apiKey?: string|null, * baseURL?: string|null, * headers?: array|null, + * openaiEndpointFormat?: null|OpenAIEndpointFormat|value-of, * provider?: null|Provider|value-of, * } */ @@ -50,6 +52,14 @@ final class GenericModelConfigObject implements BaseModel #[Optional(map: 'string')] public ?array $headers; + /** + * Wire format used by an OpenAI-compatible endpoint. Defaults to the Responses API; use chat for Chat Completions-only endpoints. + * + * @var value-of|null $openaiEndpointFormat + */ + #[Optional(enum: OpenAIEndpointFormat::class)] + public ?string $openaiEndpointFormat; + /** * AI provider for the model (or provide a baseURL endpoint instead). * @@ -83,6 +93,7 @@ public function __construct() * You must use named parameters to construct any parameters with a default value. * * @param array|null $headers + * @param OpenAIEndpointFormat|value-of|null $openaiEndpointFormat * @param Provider|value-of|null $provider */ public static function with( @@ -90,6 +101,7 @@ public static function with( ?string $apiKey = null, ?string $baseURL = null, ?array $headers = null, + OpenAIEndpointFormat|string|null $openaiEndpointFormat = null, Provider|string|null $provider = null, ): self { $self = new self; @@ -99,6 +111,7 @@ public static function with( null !== $apiKey && $self['apiKey'] = $apiKey; null !== $baseURL && $self['baseURL'] = $baseURL; null !== $headers && $self['headers'] = $headers; + null !== $openaiEndpointFormat && $self['openaiEndpointFormat'] = $openaiEndpointFormat; null !== $provider && $self['provider'] = $provider; return $self; @@ -150,6 +163,20 @@ public function withHeaders(array $headers): self return $self; } + /** + * Wire format used by an OpenAI-compatible endpoint. Defaults to the Responses API; use chat for Chat Completions-only endpoints. + * + * @param OpenAIEndpointFormat|value-of $openaiEndpointFormat + */ + public function withOpenAIEndpointFormat( + OpenAIEndpointFormat|string $openaiEndpointFormat + ): self { + $self = clone $this; + $self['openaiEndpointFormat'] = $openaiEndpointFormat; + + return $self; + } + /** * AI provider for the model (or provide a baseURL endpoint instead). * diff --git a/src/Sessions/SessionObserveParams/Options/Model/GenericModelConfigObject/OpenAIEndpointFormat.php b/src/Sessions/SessionObserveParams/Options/Model/GenericModelConfigObject/OpenAIEndpointFormat.php new file mode 100644 index 0000000..7c8e3c1 --- /dev/null +++ b/src/Sessions/SessionObserveParams/Options/Model/GenericModelConfigObject/OpenAIEndpointFormat.php @@ -0,0 +1,15 @@ +