Skip to content

Commit 902c4b8

Browse files
author
stlc-bot
committed
fix(api): document search domain limits and clarify scrape parameter errors (#1388)
Stainless-Generated-From: 0166374
1 parent 88cf8ce commit 902c4b8

7 files changed

Lines changed: 25 additions & 25 deletions

File tree

‎src/ServiceContracts/WebContract.php‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,12 @@ public function mapUrls(
167167
*
168168
* @param Formats|FormatsShape $formats Outputs to return. Set at least one to `true`.
169169
* @param string $url public HTTP or HTTPS URL to scrape
170-
* @param HighlightsParams|HighlightsParamsShape $highlightsParams Required when `formats.highlights` is `true`.
170+
* @param HighlightsParams|HighlightsParamsShape $highlightsParams Requires `formats.highlights: true`; required when it is set.
171171
* @param ImageParams|ImageParamsShape $imageParams Image options. Requires formats.images: true.
172-
* @param JsonParams|JsonParamsShape $jsonParams Required when formats.json is true.
172+
* @param JsonParams|JsonParamsShape $jsonParams Requires `formats.json: true`; required when it is set.
173173
* @param MarkdownParams|MarkdownParamsShape $markdownParams Markdown options. Requires `formats.markdown`.
174174
* @param int $maxAgeMs Maximum age of a cached output, in milliseconds. `0` fetches fresh. Defaults to 3 days (259200000 ms). Maximum: 1 year (31536000000 ms).
175-
* @param ParseParams|ParseParamsShape $parseParams Required when formats.parse is true.
175+
* @param ParseParams|ParseParamsShape $parseParams Requires `formats.parse: true`; required when it is set.
176176
* @param ProductParams|ProductParamsShape $productParams Product options. Requires formats.product: true.
177177
* @param ScreenshotParams|ScreenshotParamsShape $screenshotParams Screenshot options. Requires formats.screenshot: true.
178178
* @param SharedParams|SharedParamsShape $sharedParams browser and content settings shared by all outputs
@@ -251,10 +251,10 @@ public function screenshot(
251251
*
252252
* @param string $query Search query. Accepts natural language as well as Google-style search operators such as `site:`, `-site:`, `inurl:`, `intitle:`, quoted phrases, and `OR`.
253253
* @param \ContextDev\Web\WebSearchParams\Country|value-of<\ContextDev\Web\WebSearchParams\Country> $country Two-letter ISO 3166-1 alpha-2 country code to localize results to a specific country (maps to Google's `gl` parameter). Example: "us", "gb", "de".
254-
* @param list<string> $excludeDomains Blocklist — drop results from these domains. Example: ["pinterest.com", "reddit.com"].
254+
* @param list<string> $excludeDomains Blocklist — drop results from these domains. Up to 100 domains. Example: ["pinterest.com", "reddit.com"].
255255
* @param Freshness|value-of<Freshness> $freshness restrict results to content published within this window
256256
* @param HighlightsOptions|HighlightsOptionsShape $highlightsOptions Passages from each result page that are relevant to the query. Pages are read with the `markdownOptions` settings.
257-
* @param list<string> $includeDomains Allowlist — only return results from these domains. Example: ["arxiv.org", "github.com"].
257+
* @param list<string> $includeDomains Allowlist — only return results from these domains. Up to 100 domains. Example: ["arxiv.org", "github.com"].
258258
* @param MarkdownOptions|MarkdownOptionsShape $markdownOptions Inline Markdown scraping for each result. Set `enabled: true` to activate.
259259
* @param int $numResults Number of results to request and return (10–100). Defaults to 10.
260260
* @param bool $queryFanout currently has no effect

‎src/Services/WebService.php‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -261,12 +261,12 @@ public function mapUrls(
261261
*
262262
* @param Formats|FormatsShape $formats Outputs to return. Set at least one to `true`.
263263
* @param string $url public HTTP or HTTPS URL to scrape
264-
* @param HighlightsParams|HighlightsParamsShape $highlightsParams Required when `formats.highlights` is `true`.
264+
* @param HighlightsParams|HighlightsParamsShape $highlightsParams Requires `formats.highlights: true`; required when it is set.
265265
* @param ImageParams|ImageParamsShape $imageParams Image options. Requires formats.images: true.
266-
* @param JsonParams|JsonParamsShape $jsonParams Required when formats.json is true.
266+
* @param JsonParams|JsonParamsShape $jsonParams Requires `formats.json: true`; required when it is set.
267267
* @param MarkdownParams|MarkdownParamsShape $markdownParams Markdown options. Requires `formats.markdown`.
268268
* @param int $maxAgeMs Maximum age of a cached output, in milliseconds. `0` fetches fresh. Defaults to 3 days (259200000 ms). Maximum: 1 year (31536000000 ms).
269-
* @param ParseParams|ParseParamsShape $parseParams Required when formats.parse is true.
269+
* @param ParseParams|ParseParamsShape $parseParams Requires `formats.parse: true`; required when it is set.
270270
* @param ProductParams|ProductParamsShape $productParams Product options. Requires formats.product: true.
271271
* @param ScreenshotParams|ScreenshotParamsShape $screenshotParams Screenshot options. Requires formats.screenshot: true.
272272
* @param SharedParams|SharedParamsShape $sharedParams browser and content settings shared by all outputs
@@ -399,10 +399,10 @@ public function screenshot(
399399
*
400400
* @param string $query Search query. Accepts natural language as well as Google-style search operators such as `site:`, `-site:`, `inurl:`, `intitle:`, quoted phrases, and `OR`.
401401
* @param \ContextDev\Web\WebSearchParams\Country|value-of<\ContextDev\Web\WebSearchParams\Country> $country Two-letter ISO 3166-1 alpha-2 country code to localize results to a specific country (maps to Google's `gl` parameter). Example: "us", "gb", "de".
402-
* @param list<string> $excludeDomains Blocklist — drop results from these domains. Example: ["pinterest.com", "reddit.com"].
402+
* @param list<string> $excludeDomains Blocklist — drop results from these domains. Up to 100 domains. Example: ["pinterest.com", "reddit.com"].
403403
* @param Freshness|value-of<Freshness> $freshness restrict results to content published within this window
404404
* @param HighlightsOptions|HighlightsOptionsShape $highlightsOptions Passages from each result page that are relevant to the query. Pages are read with the `markdownOptions` settings.
405-
* @param list<string> $includeDomains Allowlist — only return results from these domains. Example: ["arxiv.org", "github.com"].
405+
* @param list<string> $includeDomains Allowlist — only return results from these domains. Up to 100 domains. Example: ["arxiv.org", "github.com"].
406406
* @param MarkdownOptions|MarkdownOptionsShape $markdownOptions Inline Markdown scraping for each result. Set `enabled: true` to activate.
407407
* @param int $numResults Number of results to request and return (10–100). Defaults to 10.
408408
* @param bool $queryFanout currently has no effect

‎src/Web/WebScrapeParams.php‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ final class WebScrapeParams implements BaseModel
7373
public string $url;
7474

7575
/**
76-
* Required when `formats.highlights` is `true`.
76+
* Requires `formats.highlights: true`; required when it is set.
7777
*/
7878
#[Optional]
7979
public ?HighlightsParams $highlightsParams;
@@ -85,7 +85,7 @@ final class WebScrapeParams implements BaseModel
8585
public ?ImageParams $imageParams;
8686

8787
/**
88-
* Required when formats.json is true.
88+
* Requires `formats.json: true`; required when it is set.
8989
*/
9090
#[Optional]
9191
public ?JsonParams $jsonParams;
@@ -103,7 +103,7 @@ final class WebScrapeParams implements BaseModel
103103
public ?int $maxAgeMs;
104104

105105
/**
106-
* Required when formats.parse is true.
106+
* Requires `formats.parse: true`; required when it is set.
107107
*/
108108
#[Optional]
109109
public ?ParseParams $parseParams;
@@ -247,7 +247,7 @@ public function withURL(string $url): self
247247
}
248248

249249
/**
250-
* Required when `formats.highlights` is `true`.
250+
* Requires `formats.highlights: true`; required when it is set.
251251
*
252252
* @param HighlightsParams|HighlightsParamsShape $highlightsParams
253253
*/
@@ -274,7 +274,7 @@ public function withImageParams(ImageParams|array $imageParams): self
274274
}
275275

276276
/**
277-
* Required when formats.json is true.
277+
* Requires `formats.json: true`; required when it is set.
278278
*
279279
* @param JsonParams|JsonParamsShape $jsonParams
280280
*/
@@ -312,7 +312,7 @@ public function withMaxAgeMs(int $maxAgeMs): self
312312
}
313313

314314
/**
315-
* Required when formats.parse is true.
315+
* Requires `formats.parse: true`; required when it is set.
316316
*
317317
* @param ParseParams|ParseParamsShape $parseParams
318318
*/

‎src/Web/WebScrapeParams/HighlightsParams.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use ContextDev\Core\Contracts\BaseModel;
1111

1212
/**
13-
* Required when `formats.highlights` is `true`.
13+
* Requires `formats.highlights: true`; required when it is set.
1414
*
1515
* @phpstan-type HighlightsParamsShape = array{
1616
* query: string, maxCharacters?: int|null

‎src/Web/WebScrapeParams/JsonParams.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use ContextDev\Core\Contracts\BaseModel;
1111

1212
/**
13-
* Required when formats.json is true.
13+
* Requires `formats.json: true`; required when it is set.
1414
*
1515
* @phpstan-type JsonParamsShape = array{
1616
* schema: array<string,mixed>, instructions?: string|null
@@ -22,7 +22,7 @@ final class JsonParams implements BaseModel
2222
use SdkModel;
2323

2424
/**
25-
* JSON Schema for a top-level object, up to 50 KB. Use optional or nullable fields for missing facts.
25+
* JSON Schema (not an example object) for a top-level object, up to 50 KB. Use optional or nullable fields for missing facts.
2626
*
2727
* @var array<string,mixed> $schema
2828
*/
@@ -75,7 +75,7 @@ public static function with(
7575
}
7676

7777
/**
78-
* JSON Schema for a top-level object, up to 50 KB. Use optional or nullable fields for missing facts.
78+
* JSON Schema (not an example object) for a top-level object, up to 50 KB. Use optional or nullable fields for missing facts.
7979
*
8080
* @param array<string,mixed> $schema
8181
*/

‎src/Web/WebScrapeParams/ParseParams.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use ContextDev\Web\WebScrapeParams\ParseParams\Rule;
1111

1212
/**
13-
* Required when formats.parse is true.
13+
* Requires `formats.parse: true`; required when it is set.
1414
*
1515
* @phpstan-import-type RuleVariants from \ContextDev\Web\WebScrapeParams\ParseParams\Rule
1616
* @phpstan-import-type RuleShape from \ContextDev\Web\WebScrapeParams\ParseParams\Rule

‎src/Web/WebSearchParams.php‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ final class WebSearchParams implements BaseModel
6161
public ?string $country;
6262

6363
/**
64-
* Blocklist — drop results from these domains. Example: ["pinterest.com", "reddit.com"].
64+
* Blocklist — drop results from these domains. Up to 100 domains. Example: ["pinterest.com", "reddit.com"].
6565
*
6666
* @var list<string>|null $excludeDomains
6767
*/
@@ -83,7 +83,7 @@ final class WebSearchParams implements BaseModel
8383
public ?HighlightsOptions $highlightsOptions;
8484

8585
/**
86-
* Allowlist — only return results from these domains. Example: ["arxiv.org", "github.com"].
86+
* Allowlist — only return results from these domains. Up to 100 domains. Example: ["arxiv.org", "github.com"].
8787
*
8888
* @var list<string>|null $includeDomains
8989
*/
@@ -222,7 +222,7 @@ public function withCountry(Country|string $country): self
222222
}
223223

224224
/**
225-
* Blocklist — drop results from these domains. Example: ["pinterest.com", "reddit.com"].
225+
* Blocklist — drop results from these domains. Up to 100 domains. Example: ["pinterest.com", "reddit.com"].
226226
*
227227
* @param list<string> $excludeDomains
228228
*/
@@ -262,7 +262,7 @@ public function withHighlightsOptions(
262262
}
263263

264264
/**
265-
* Allowlist — only return results from these domains. Example: ["arxiv.org", "github.com"].
265+
* Allowlist — only return results from these domains. Up to 100 domains. Example: ["arxiv.org", "github.com"].
266266
*
267267
* @param list<string> $includeDomains
268268
*/

0 commit comments

Comments
 (0)