Skip to content

Commit 389a4db

Browse files
feat(server-v3): expose OpenAI endpoint format
1 parent 0f76548 commit 389a4db

13 files changed

Lines changed: 254 additions & 2 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 8
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase/stagehand-4d0d50b4f18fd74f58aca0b84d6968d1228499f2fa4e5714516f13ff6f820c9d.yml
3-
openapi_spec_hash: f7b1a869f3e412aea4d4bd42467791bb
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase/stagehand-64b47a6dd07208d708130e739a272f7d37d4e42494a7c8e566ef66007f8ff25f.yml
3+
openapi_spec_hash: 4cdfcfed592c8631fbab9117bf45bb67
44
config_hash: 1fb12ae9b478488bc1e56bfbdc210b01

src/Sessions/ModelConfig/GenericModelConfigObject.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Stagehand\Core\Attributes\Required;
99
use Stagehand\Core\Concerns\SdkModel;
1010
use Stagehand\Core\Contracts\BaseModel;
11+
use Stagehand\Sessions\ModelConfig\GenericModelConfigObject\OpenAIEndpointFormat;
1112
use Stagehand\Sessions\ModelConfig\GenericModelConfigObject\Provider;
1213

1314
/**
@@ -16,6 +17,7 @@
1617
* apiKey?: string|null,
1718
* baseURL?: string|null,
1819
* headers?: array<string,string>|null,
20+
* openaiEndpointFormat?: null|OpenAIEndpointFormat|value-of<OpenAIEndpointFormat>,
1921
* provider?: null|Provider|value-of<Provider>,
2022
* }
2123
*/
@@ -50,6 +52,14 @@ final class GenericModelConfigObject implements BaseModel
5052
#[Optional(map: 'string')]
5153
public ?array $headers;
5254

55+
/**
56+
* Wire format used by an OpenAI-compatible endpoint. Defaults to the Responses API; use chat for Chat Completions-only endpoints.
57+
*
58+
* @var value-of<OpenAIEndpointFormat>|null $openaiEndpointFormat
59+
*/
60+
#[Optional(enum: OpenAIEndpointFormat::class)]
61+
public ?string $openaiEndpointFormat;
62+
5363
/**
5464
* AI provider for the model (or provide a baseURL endpoint instead).
5565
*
@@ -83,13 +93,15 @@ public function __construct()
8393
* You must use named parameters to construct any parameters with a default value.
8494
*
8595
* @param array<string,string>|null $headers
96+
* @param OpenAIEndpointFormat|value-of<OpenAIEndpointFormat>|null $openaiEndpointFormat
8697
* @param Provider|value-of<Provider>|null $provider
8798
*/
8899
public static function with(
89100
string $modelName,
90101
?string $apiKey = null,
91102
?string $baseURL = null,
92103
?array $headers = null,
104+
OpenAIEndpointFormat|string|null $openaiEndpointFormat = null,
93105
Provider|string|null $provider = null,
94106
): self {
95107
$self = new self;
@@ -99,6 +111,7 @@ public static function with(
99111
null !== $apiKey && $self['apiKey'] = $apiKey;
100112
null !== $baseURL && $self['baseURL'] = $baseURL;
101113
null !== $headers && $self['headers'] = $headers;
114+
null !== $openaiEndpointFormat && $self['openaiEndpointFormat'] = $openaiEndpointFormat;
102115
null !== $provider && $self['provider'] = $provider;
103116

104117
return $self;
@@ -150,6 +163,20 @@ public function withHeaders(array $headers): self
150163
return $self;
151164
}
152165

166+
/**
167+
* Wire format used by an OpenAI-compatible endpoint. Defaults to the Responses API; use chat for Chat Completions-only endpoints.
168+
*
169+
* @param OpenAIEndpointFormat|value-of<OpenAIEndpointFormat> $openaiEndpointFormat
170+
*/
171+
public function withOpenAIEndpointFormat(
172+
OpenAIEndpointFormat|string $openaiEndpointFormat
173+
): self {
174+
$self = clone $this;
175+
$self['openaiEndpointFormat'] = $openaiEndpointFormat;
176+
177+
return $self;
178+
}
179+
153180
/**
154181
* AI provider for the model (or provide a baseURL endpoint instead).
155182
*
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Stagehand\Sessions\ModelConfig\GenericModelConfigObject;
6+
7+
/**
8+
* Wire format used by an OpenAI-compatible endpoint. Defaults to the Responses API; use chat for Chat Completions-only endpoints.
9+
*/
10+
enum OpenAIEndpointFormat: string
11+
{
12+
case RESPONSES = 'responses';
13+
14+
case CHAT = 'chat';
15+
}

src/Sessions/SessionActParams/Options/Model/GenericModelConfigObject.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Stagehand\Core\Attributes\Required;
99
use Stagehand\Core\Concerns\SdkModel;
1010
use Stagehand\Core\Contracts\BaseModel;
11+
use Stagehand\Sessions\SessionActParams\Options\Model\GenericModelConfigObject\OpenAIEndpointFormat;
1112
use Stagehand\Sessions\SessionActParams\Options\Model\GenericModelConfigObject\Provider;
1213

1314
/**
@@ -16,6 +17,7 @@
1617
* apiKey?: string|null,
1718
* baseURL?: string|null,
1819
* headers?: array<string,string>|null,
20+
* openaiEndpointFormat?: null|OpenAIEndpointFormat|value-of<OpenAIEndpointFormat>,
1921
* provider?: null|Provider|value-of<Provider>,
2022
* }
2123
*/
@@ -50,6 +52,14 @@ final class GenericModelConfigObject implements BaseModel
5052
#[Optional(map: 'string')]
5153
public ?array $headers;
5254

55+
/**
56+
* Wire format used by an OpenAI-compatible endpoint. Defaults to the Responses API; use chat for Chat Completions-only endpoints.
57+
*
58+
* @var value-of<OpenAIEndpointFormat>|null $openaiEndpointFormat
59+
*/
60+
#[Optional(enum: OpenAIEndpointFormat::class)]
61+
public ?string $openaiEndpointFormat;
62+
5363
/**
5464
* AI provider for the model (or provide a baseURL endpoint instead).
5565
*
@@ -83,13 +93,15 @@ public function __construct()
8393
* You must use named parameters to construct any parameters with a default value.
8494
*
8595
* @param array<string,string>|null $headers
96+
* @param OpenAIEndpointFormat|value-of<OpenAIEndpointFormat>|null $openaiEndpointFormat
8697
* @param Provider|value-of<Provider>|null $provider
8798
*/
8899
public static function with(
89100
string $modelName,
90101
?string $apiKey = null,
91102
?string $baseURL = null,
92103
?array $headers = null,
104+
OpenAIEndpointFormat|string|null $openaiEndpointFormat = null,
93105
Provider|string|null $provider = null,
94106
): self {
95107
$self = new self;
@@ -99,6 +111,7 @@ public static function with(
99111
null !== $apiKey && $self['apiKey'] = $apiKey;
100112
null !== $baseURL && $self['baseURL'] = $baseURL;
101113
null !== $headers && $self['headers'] = $headers;
114+
null !== $openaiEndpointFormat && $self['openaiEndpointFormat'] = $openaiEndpointFormat;
102115
null !== $provider && $self['provider'] = $provider;
103116

104117
return $self;
@@ -150,6 +163,20 @@ public function withHeaders(array $headers): self
150163
return $self;
151164
}
152165

166+
/**
167+
* Wire format used by an OpenAI-compatible endpoint. Defaults to the Responses API; use chat for Chat Completions-only endpoints.
168+
*
169+
* @param OpenAIEndpointFormat|value-of<OpenAIEndpointFormat> $openaiEndpointFormat
170+
*/
171+
public function withOpenAIEndpointFormat(
172+
OpenAIEndpointFormat|string $openaiEndpointFormat
173+
): self {
174+
$self = clone $this;
175+
$self['openaiEndpointFormat'] = $openaiEndpointFormat;
176+
177+
return $self;
178+
}
179+
153180
/**
154181
* AI provider for the model (or provide a baseURL endpoint instead).
155182
*
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Stagehand\Sessions\SessionActParams\Options\Model\GenericModelConfigObject;
6+
7+
/**
8+
* Wire format used by an OpenAI-compatible endpoint. Defaults to the Responses API; use chat for Chat Completions-only endpoints.
9+
*/
10+
enum OpenAIEndpointFormat: string
11+
{
12+
case RESPONSES = 'responses';
13+
14+
case CHAT = 'chat';
15+
}

src/Sessions/SessionExecuteParams/AgentConfig/ExecutionModel/GenericModelConfigObject.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Stagehand\Core\Attributes\Required;
99
use Stagehand\Core\Concerns\SdkModel;
1010
use Stagehand\Core\Contracts\BaseModel;
11+
use Stagehand\Sessions\SessionExecuteParams\AgentConfig\ExecutionModel\GenericModelConfigObject\OpenAIEndpointFormat;
1112
use Stagehand\Sessions\SessionExecuteParams\AgentConfig\ExecutionModel\GenericModelConfigObject\Provider;
1213

1314
/**
@@ -16,6 +17,7 @@
1617
* apiKey?: string|null,
1718
* baseURL?: string|null,
1819
* headers?: array<string,string>|null,
20+
* openaiEndpointFormat?: null|OpenAIEndpointFormat|value-of<OpenAIEndpointFormat>,
1921
* provider?: null|Provider|value-of<Provider>,
2022
* }
2123
*/
@@ -50,6 +52,14 @@ final class GenericModelConfigObject implements BaseModel
5052
#[Optional(map: 'string')]
5153
public ?array $headers;
5254

55+
/**
56+
* Wire format used by an OpenAI-compatible endpoint. Defaults to the Responses API; use chat for Chat Completions-only endpoints.
57+
*
58+
* @var value-of<OpenAIEndpointFormat>|null $openaiEndpointFormat
59+
*/
60+
#[Optional(enum: OpenAIEndpointFormat::class)]
61+
public ?string $openaiEndpointFormat;
62+
5363
/**
5464
* AI provider for the model (or provide a baseURL endpoint instead).
5565
*
@@ -83,13 +93,15 @@ public function __construct()
8393
* You must use named parameters to construct any parameters with a default value.
8494
*
8595
* @param array<string,string>|null $headers
96+
* @param OpenAIEndpointFormat|value-of<OpenAIEndpointFormat>|null $openaiEndpointFormat
8697
* @param Provider|value-of<Provider>|null $provider
8798
*/
8899
public static function with(
89100
string $modelName,
90101
?string $apiKey = null,
91102
?string $baseURL = null,
92103
?array $headers = null,
104+
OpenAIEndpointFormat|string|null $openaiEndpointFormat = null,
93105
Provider|string|null $provider = null,
94106
): self {
95107
$self = new self;
@@ -99,6 +111,7 @@ public static function with(
99111
null !== $apiKey && $self['apiKey'] = $apiKey;
100112
null !== $baseURL && $self['baseURL'] = $baseURL;
101113
null !== $headers && $self['headers'] = $headers;
114+
null !== $openaiEndpointFormat && $self['openaiEndpointFormat'] = $openaiEndpointFormat;
102115
null !== $provider && $self['provider'] = $provider;
103116

104117
return $self;
@@ -150,6 +163,20 @@ public function withHeaders(array $headers): self
150163
return $self;
151164
}
152165

166+
/**
167+
* Wire format used by an OpenAI-compatible endpoint. Defaults to the Responses API; use chat for Chat Completions-only endpoints.
168+
*
169+
* @param OpenAIEndpointFormat|value-of<OpenAIEndpointFormat> $openaiEndpointFormat
170+
*/
171+
public function withOpenAIEndpointFormat(
172+
OpenAIEndpointFormat|string $openaiEndpointFormat
173+
): self {
174+
$self = clone $this;
175+
$self['openaiEndpointFormat'] = $openaiEndpointFormat;
176+
177+
return $self;
178+
}
179+
153180
/**
154181
* AI provider for the model (or provide a baseURL endpoint instead).
155182
*
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Stagehand\Sessions\SessionExecuteParams\AgentConfig\ExecutionModel\GenericModelConfigObject;
6+
7+
/**
8+
* Wire format used by an OpenAI-compatible endpoint. Defaults to the Responses API; use chat for Chat Completions-only endpoints.
9+
*/
10+
enum OpenAIEndpointFormat: string
11+
{
12+
case RESPONSES = 'responses';
13+
14+
case CHAT = 'chat';
15+
}

src/Sessions/SessionExecuteParams/AgentConfig/Model/GenericModelConfigObject.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Stagehand\Core\Attributes\Required;
99
use Stagehand\Core\Concerns\SdkModel;
1010
use Stagehand\Core\Contracts\BaseModel;
11+
use Stagehand\Sessions\SessionExecuteParams\AgentConfig\Model\GenericModelConfigObject\OpenAIEndpointFormat;
1112
use Stagehand\Sessions\SessionExecuteParams\AgentConfig\Model\GenericModelConfigObject\Provider;
1213

1314
/**
@@ -16,6 +17,7 @@
1617
* apiKey?: string|null,
1718
* baseURL?: string|null,
1819
* headers?: array<string,string>|null,
20+
* openaiEndpointFormat?: null|OpenAIEndpointFormat|value-of<OpenAIEndpointFormat>,
1921
* provider?: null|Provider|value-of<Provider>,
2022
* }
2123
*/
@@ -50,6 +52,14 @@ final class GenericModelConfigObject implements BaseModel
5052
#[Optional(map: 'string')]
5153
public ?array $headers;
5254

55+
/**
56+
* Wire format used by an OpenAI-compatible endpoint. Defaults to the Responses API; use chat for Chat Completions-only endpoints.
57+
*
58+
* @var value-of<OpenAIEndpointFormat>|null $openaiEndpointFormat
59+
*/
60+
#[Optional(enum: OpenAIEndpointFormat::class)]
61+
public ?string $openaiEndpointFormat;
62+
5363
/**
5464
* AI provider for the model (or provide a baseURL endpoint instead).
5565
*
@@ -83,13 +93,15 @@ public function __construct()
8393
* You must use named parameters to construct any parameters with a default value.
8494
*
8595
* @param array<string,string>|null $headers
96+
* @param OpenAIEndpointFormat|value-of<OpenAIEndpointFormat>|null $openaiEndpointFormat
8697
* @param Provider|value-of<Provider>|null $provider
8798
*/
8899
public static function with(
89100
string $modelName,
90101
?string $apiKey = null,
91102
?string $baseURL = null,
92103
?array $headers = null,
104+
OpenAIEndpointFormat|string|null $openaiEndpointFormat = null,
93105
Provider|string|null $provider = null,
94106
): self {
95107
$self = new self;
@@ -99,6 +111,7 @@ public static function with(
99111
null !== $apiKey && $self['apiKey'] = $apiKey;
100112
null !== $baseURL && $self['baseURL'] = $baseURL;
101113
null !== $headers && $self['headers'] = $headers;
114+
null !== $openaiEndpointFormat && $self['openaiEndpointFormat'] = $openaiEndpointFormat;
102115
null !== $provider && $self['provider'] = $provider;
103116

104117
return $self;
@@ -150,6 +163,20 @@ public function withHeaders(array $headers): self
150163
return $self;
151164
}
152165

166+
/**
167+
* Wire format used by an OpenAI-compatible endpoint. Defaults to the Responses API; use chat for Chat Completions-only endpoints.
168+
*
169+
* @param OpenAIEndpointFormat|value-of<OpenAIEndpointFormat> $openaiEndpointFormat
170+
*/
171+
public function withOpenAIEndpointFormat(
172+
OpenAIEndpointFormat|string $openaiEndpointFormat
173+
): self {
174+
$self = clone $this;
175+
$self['openaiEndpointFormat'] = $openaiEndpointFormat;
176+
177+
return $self;
178+
}
179+
153180
/**
154181
* AI provider for the model (or provide a baseURL endpoint instead).
155182
*
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Stagehand\Sessions\SessionExecuteParams\AgentConfig\Model\GenericModelConfigObject;
6+
7+
/**
8+
* Wire format used by an OpenAI-compatible endpoint. Defaults to the Responses API; use chat for Chat Completions-only endpoints.
9+
*/
10+
enum OpenAIEndpointFormat: string
11+
{
12+
case RESPONSES = 'responses';
13+
14+
case CHAT = 'chat';
15+
}

0 commit comments

Comments
 (0)