Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "3.21.0"
".": "3.22.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 8
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase/stagehand-c7910965e66e73ad8b65b6cc391d431094b2a6c6577c3e9d82feaa8138e74cff.yml
openapi_spec_hash: 37748bb69c22a9ce721d9b5a5861f964
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase/stagehand-4d0d50b4f18fd74f58aca0b84d6968d1228499f2fa4e5714516f13ff6f820c9d.yml
openapi_spec_hash: f7b1a869f3e412aea4d4bd42467791bb
config_hash: 1fb12ae9b478488bc1e56bfbdc210b01
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 3.22.0 (2026-06-09)

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))

## 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)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ The REST API documentation can be found on [docs.stagehand.dev](https://docs.sta
<!-- x-release-please-start-version -->

```
composer require "browserbase/stagehand 3.21.0"
composer require "browserbase/stagehand 3.22.0"
```

<!-- x-release-please-end -->
Expand Down
15 changes: 12 additions & 3 deletions src/Sessions/ModelConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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,
];
}
}
188 changes: 188 additions & 0 deletions src/Sessions/ModelConfig/AzureAPIKeyModelConfigObject.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
<?php

declare(strict_types=1);

namespace Stagehand\Sessions\ModelConfig;

use Stagehand\Core\Attributes\Optional;
use Stagehand\Core\Attributes\Required;
use Stagehand\Core\Concerns\SdkModel;
use Stagehand\Core\Contracts\BaseModel;
use Stagehand\Sessions\ModelConfig\AzureAPIKeyModelConfigObject\ProviderOptions;

/**
* @phpstan-import-type ProviderOptionsShape from \Stagehand\Sessions\ModelConfig\AzureAPIKeyModelConfigObject\ProviderOptions
*
* @phpstan-type AzureAPIKeyModelConfigObjectShape = array{
* modelName: string,
* provider: 'azure',
* providerOptions: ProviderOptions|ProviderOptionsShape,
* apiKey?: string|null,
* baseURL?: string|null,
* headers?: array<string,string>|null,
* }
*/
final class AzureAPIKeyModelConfigObject implements BaseModel
{
/** @use SdkModel<AzureAPIKeyModelConfigObjectShape> */
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<string,string>|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<string,string>|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<string,string> $headers
*/
public function withHeaders(array $headers): self
{
$self = clone $this;
$self['headers'] = $headers;

return $self;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?php

declare(strict_types=1);

namespace Stagehand\Sessions\ModelConfig\AzureAPIKeyModelConfigObject;

use Stagehand\Core\Attributes\Required;
use Stagehand\Core\Concerns\SdkModel;
use Stagehand\Core\Contracts\BaseModel;
use Stagehand\Sessions\ModelConfig\AzureAPIKeyModelConfigObject\ProviderOptions\Azure;

/**
* Azure provider-specific model configuration.
*
* @phpstan-import-type AzureShape from \Stagehand\Sessions\ModelConfig\AzureAPIKeyModelConfigObject\ProviderOptions\Azure
*
* @phpstan-type ProviderOptionsShape = array{azure: Azure|AzureShape}
*/
final class ProviderOptions implements BaseModel
{
/** @use SdkModel<ProviderOptionsShape> */
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;
}
}
Loading