Skip to content

Commit 944e2e3

Browse files
feat: Add screenshot option to Extract
1 parent 786c9fd commit 944e2e3

2 files changed

Lines changed: 22 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-e77d6b15f0a94b16a54ef87a84d2cabe49eb11cff5ceba76f00dd788ff483eab.yml
3-
openapi_spec_hash: a1dab7fe72a772d188a15305124ebd73
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase/stagehand-80502d74c1be605e77d45ff2b54297fe34ce85dbad1e8f2dfa30ba6d09601219.yml
3+
openapi_spec_hash: fd62f768756a400c3ecd695bfcf3845a
44
config_hash: 1fb12ae9b478488bc1e56bfbdc210b01

src/Sessions/SessionExtractParams/Options.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* @phpstan-type OptionsShape = array{
1717
* ignoreSelectors?: list<string>|null,
1818
* model?: ModelShape|null,
19+
* screenshot?: bool|null,
1920
* selector?: string|null,
2021
* timeout?: float|null,
2122
* }
@@ -41,6 +42,12 @@ final class Options implements BaseModel
4142
#[Optional]
4243
public string|ModelConfig|null $model;
4344

45+
/**
46+
* When true, include a screenshot of the current viewport in the extraction LLM call. Defaults to false.
47+
*/
48+
#[Optional]
49+
public ?bool $screenshot;
50+
4451
/**
4552
* CSS selector to scope extraction to a specific element.
4653
*/
@@ -69,13 +76,15 @@ public function __construct()
6976
public static function with(
7077
?array $ignoreSelectors = null,
7178
string|ModelConfig|array|null $model = null,
79+
?bool $screenshot = null,
7280
?string $selector = null,
7381
?float $timeout = null,
7482
): self {
7583
$self = new self;
7684

7785
null !== $ignoreSelectors && $self['ignoreSelectors'] = $ignoreSelectors;
7886
null !== $model && $self['model'] = $model;
87+
null !== $screenshot && $self['screenshot'] = $screenshot;
7988
null !== $selector && $self['selector'] = $selector;
8089
null !== $timeout && $self['timeout'] = $timeout;
8190

@@ -108,6 +117,17 @@ public function withModel(string|ModelConfig|array $model): self
108117
return $self;
109118
}
110119

120+
/**
121+
* When true, include a screenshot of the current viewport in the extraction LLM call. Defaults to false.
122+
*/
123+
public function withScreenshot(bool $screenshot): self
124+
{
125+
$self = clone $this;
126+
$self['screenshot'] = $screenshot;
127+
128+
return $self;
129+
}
130+
111131
/**
112132
* CSS selector to scope extraction to a specific element.
113133
*/

0 commit comments

Comments
 (0)