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