Skip to content

Commit 2a68e19

Browse files
author
stlc-bot
committed
fix(api): document search domain limits and clarify scrape parameter errors (#1388)
Stainless-Generated-From: f9386f8
1 parent ade0fa2 commit 2a68e19

3 files changed

Lines changed: 27 additions & 23 deletions

File tree

‎src/context/dev/resources/web.py‎

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -373,18 +373,18 @@ def scrape(
373373
374374
url: Public HTTP or HTTPS URL to scrape.
375375
376-
highlights_params: Required when `formats.highlights` is `true`.
376+
highlights_params: Requires `formats.highlights: true`; required when it is set.
377377
378378
image_params: Image options. Requires formats.images: true.
379379
380-
json_params: Required when formats.json is true.
380+
json_params: Requires `formats.json: true`; required when it is set.
381381
382382
markdown_params: Markdown options. Requires `formats.markdown`.
383383
384384
max_age_ms: Maximum age of a cached output, in milliseconds. `0` fetches fresh. Defaults to
385385
3 days (259200000 ms). Maximum: 1 year (31536000000 ms).
386386
387-
parse_params: Required when formats.parse is true.
387+
parse_params: Requires `formats.parse: true`; required when it is set.
388388
389389
product_params: Product options. Requires formats.product: true.
390390
@@ -1051,16 +1051,18 @@ def search(
10511051
country: Two-letter ISO 3166-1 alpha-2 country code to localize results to a specific
10521052
country (maps to Google's `gl` parameter). Example: "us", "gb", "de".
10531053
1054-
exclude_domains: Blocklist — drop results from these domains. Example: ["pinterest.com",
1055-
"reddit.com"].
1054+
exclude_domains:
1055+
Blocklist — drop results from these domains. Up to 100 domains. Example:
1056+
["pinterest.com", "reddit.com"].
10561057
10571058
freshness: Restrict results to content published within this window.
10581059
10591060
highlights_options: Passages from each result page that are relevant to the query. Pages are read
10601061
with the `markdownOptions` settings.
10611062
1062-
include_domains: Allowlist — only return results from these domains. Example: ["arxiv.org",
1063-
"github.com"].
1063+
include_domains:
1064+
Allowlist — only return results from these domains. Up to 100 domains. Example:
1065+
["arxiv.org", "github.com"].
10641066
10651067
markdown_options: Inline Markdown scraping for each result. Set `enabled: true` to activate.
10661068
@@ -1779,18 +1781,18 @@ async def scrape(
17791781
17801782
url: Public HTTP or HTTPS URL to scrape.
17811783
1782-
highlights_params: Required when `formats.highlights` is `true`.
1784+
highlights_params: Requires `formats.highlights: true`; required when it is set.
17831785
17841786
image_params: Image options. Requires formats.images: true.
17851787
1786-
json_params: Required when formats.json is true.
1788+
json_params: Requires `formats.json: true`; required when it is set.
17871789
17881790
markdown_params: Markdown options. Requires `formats.markdown`.
17891791
17901792
max_age_ms: Maximum age of a cached output, in milliseconds. `0` fetches fresh. Defaults to
17911793
3 days (259200000 ms). Maximum: 1 year (31536000000 ms).
17921794
1793-
parse_params: Required when formats.parse is true.
1795+
parse_params: Requires `formats.parse: true`; required when it is set.
17941796
17951797
product_params: Product options. Requires formats.product: true.
17961798
@@ -2457,16 +2459,18 @@ async def search(
24572459
country: Two-letter ISO 3166-1 alpha-2 country code to localize results to a specific
24582460
country (maps to Google's `gl` parameter). Example: "us", "gb", "de".
24592461
2460-
exclude_domains: Blocklist — drop results from these domains. Example: ["pinterest.com",
2461-
"reddit.com"].
2462+
exclude_domains:
2463+
Blocklist — drop results from these domains. Up to 100 domains. Example:
2464+
["pinterest.com", "reddit.com"].
24622465
24632466
freshness: Restrict results to content published within this window.
24642467
24652468
highlights_options: Passages from each result page that are relevant to the query. Pages are read
24662469
with the `markdownOptions` settings.
24672470
2468-
include_domains: Allowlist — only return results from these domains. Example: ["arxiv.org",
2469-
"github.com"].
2471+
include_domains:
2472+
Allowlist — only return results from these domains. Up to 100 domains. Example:
2473+
["arxiv.org", "github.com"].
24702474
24712475
markdown_options: Inline Markdown scraping for each result. Set `enabled: true` to activate.
24722476

‎src/context/dev/types/web_scrape_params.py‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ class WebScrapeParams(TypedDict, total=False):
4444
"""Public HTTP or HTTPS URL to scrape."""
4545

4646
highlights_params: Annotated[HighlightsParams, PropertyInfo(alias="highlightsParams")]
47-
"""Required when `formats.highlights` is `true`."""
47+
"""Requires `formats.highlights: true`; required when it is set."""
4848

4949
image_params: Annotated[ImageParams, PropertyInfo(alias="imageParams")]
5050
"""Image options. Requires formats.images: true."""
5151

5252
json_params: Annotated[JsonParams, PropertyInfo(alias="jsonParams")]
53-
"""Required when formats.json is true."""
53+
"""Requires `formats.json: true`; required when it is set."""
5454

5555
markdown_params: Annotated[MarkdownParams, PropertyInfo(alias="markdownParams")]
5656
"""Markdown options. Requires `formats.markdown`."""
@@ -63,7 +63,7 @@ class WebScrapeParams(TypedDict, total=False):
6363
"""
6464

6565
parse_params: Annotated[ParseParams, PropertyInfo(alias="parseParams")]
66-
"""Required when formats.parse is true."""
66+
"""Requires `formats.parse: true`; required when it is set."""
6767

6868
product_params: Annotated[ProductParams, PropertyInfo(alias="productParams")]
6969
"""Product options. Requires formats.product: true."""
@@ -122,7 +122,7 @@ class Formats(TypedDict, total=False):
122122

123123

124124
class HighlightsParams(TypedDict, total=False):
125-
"""Required when `formats.highlights` is `true`."""
125+
"""Requires `formats.highlights: true`; required when it is set."""
126126

127127
query: Required[str]
128128
"""The question or topic to find passages for."""
@@ -142,10 +142,10 @@ class ImageParams(TypedDict, total=False):
142142

143143

144144
class JsonParams(TypedDict, total=False):
145-
"""Required when formats.json is true."""
145+
"""Requires `formats.json: true`; required when it is set."""
146146

147147
schema: Required[Dict[str, object]]
148-
"""JSON Schema for a top-level object, up to 50 KB.
148+
"""JSON Schema (not an example object) for a top-level object, up to 50 KB.
149149
150150
Use optional or nullable fields for missing facts.
151151
"""
@@ -188,7 +188,7 @@ class ParseParamsRulesUnionMember1(TypedDict, total=False):
188188

189189

190190
class ParseParams(TypedDict, total=False):
191-
"""Required when formats.parse is true."""
191+
"""Requires `formats.parse: true`; required when it is set."""
192192

193193
rules: Required[Dict[str, ParseParamsRules]]
194194
"""Field names mapped to CSS selectors (`h1`, `a@href`) or rule objects.

‎src/context/dev/types/web_search_params.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ class WebSearchParams(TypedDict, total=False):
274274
exclude_domains: Annotated[SequenceNotStr[str], PropertyInfo(alias="excludeDomains")]
275275
"""Blocklist — drop results from these domains.
276276
277-
Example: ["pinterest.com", "reddit.com"].
277+
Up to 100 domains. Example: ["pinterest.com", "reddit.com"].
278278
"""
279279

280280
freshness: Literal["last_24_hours", "last_week", "last_month", "last_year"]
@@ -289,7 +289,7 @@ class WebSearchParams(TypedDict, total=False):
289289
include_domains: Annotated[SequenceNotStr[str], PropertyInfo(alias="includeDomains")]
290290
"""Allowlist — only return results from these domains.
291291
292-
Example: ["arxiv.org", "github.com"].
292+
Up to 100 domains. Example: ["arxiv.org", "github.com"].
293293
"""
294294

295295
markdown_options: Annotated[MarkdownOptions, PropertyInfo(alias="markdownOptions")]

0 commit comments

Comments
 (0)