Skip to content

Commit 31bdcb6

Browse files
author
stlc-bot
committed
docs(openapi): unify regex wording and shorten sourcePreference descriptions (#2051)
Stainless-Generated-From: bf62369f078eaf1f89353aeea1847af0bd4c0474
1 parent 8b3f7e8 commit 31bdcb6

7 files changed

Lines changed: 60 additions & 148 deletions

File tree

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

Lines changed: 25 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,8 @@ def map_urls(
285285
Args:
286286
domain: Domain to map, e.g. `stripe.com`.
287287
288-
exclude_url_regex: Optional RE2-compatible regex pattern. URLs matching this pattern are not
289-
returned, even when they match urlRegex.
288+
exclude_url_regex: Regex pattern. URLs matching this pattern are not returned, even when they match
289+
urlRegex.
290290
291291
headers: HTTP headers for the target origin. Non-empty headers bypass caching.
292292
@@ -303,8 +303,8 @@ def map_urls(
303303
304304
timeout_opts: Request deadline and what to return when it passes.
305305
306-
url_regex: Optional RE2-compatible regex pattern. Only URLs matching this pattern are
307-
returned and counted against maxLinks.
306+
url_regex: Regex pattern. Only URLs matching this pattern are returned and counted against
307+
maxLinks.
308308
309309
zdr: `enabled` turns on zero data retention. Returns 403 `ZDR_NOT_ENABLED` unless
310310
your organization has ZDR.
@@ -1456,8 +1456,8 @@ def web_crawl_md(
14561456
14571457
exclude_selectors: Remove matching elements after inclusions. Exclusions take precedence.
14581458
1459-
exclude_url_regex: RE2 regex pattern. URLs matching this pattern are never followed or scraped,
1460-
even when they match urlRegex. The starting URL is always scraped.
1459+
exclude_url_regex: Regex pattern. URLs matching this pattern are never followed or scraped, even
1460+
when they match urlRegex. The starting URL is always scraped.
14611461
14621462
follow_subdomains: When true, follow links on subdomains of the starting URL's domain (e.g.
14631463
docs.example.com when starting from example.com). www and apex are always
@@ -1466,11 +1466,9 @@ def web_crawl_md(
14661466
include_frames: When true, the contents of iframes are rendered to Markdown for each crawled
14671467
page.
14681468
1469-
include_images: Include image references in the Markdown output Only applies to
1470-
`html-conversion` extractions.
1469+
include_images: Include image references in the Markdown output (`html-conversion` only).
14711470
1472-
include_links: Preserve hyperlinks in the Markdown output Only applies to `html-conversion`
1473-
extractions.
1471+
include_links: Preserve hyperlinks in the Markdown output (`html-conversion` only).
14741472
14751473
include_selectors: Keep matching HTML subtrees before converting each page to Markdown.
14761474
@@ -1485,18 +1483,11 @@ def web_crawl_md(
14851483
settle_animations: Wait briefly for CSS animations and transitions to settle before reading each
14861484
page.
14871485
1488-
shorten_base64_images: Truncate base64-encoded image data in the Markdown output Only applies to
1489-
`html-conversion` extractions.
1486+
shorten_base64_images: Truncate base64-encoded image data in the Markdown output (`html-conversion`
1487+
only).
14901488
1491-
source_preference: Where the Markdown should come from, in order of preference; the first usable
1492-
source wins. `html-conversion` converts the page HTML, and counts as unusable
1493-
when the conversion has almost no content (under 200 characters).
1494-
`markdown-direct` uses the official Markdown version the page publishes through,
1495-
returned as the site serves it. Defaults to
1496-
`["html-conversion", "markdown-direct"]`. With only `markdown-direct`, a page
1497-
that publishes no Markdown fails with `NO_PUBLISHED_MARKDOWN` and is not billed.
1498-
Requests with include or exclude selectors never use `markdown-direct`, so they
1499-
must include `html-conversion`.
1489+
source_preference: Markdown sources in order of preference: `html-conversion` converts the page
1490+
HTML, `markdown-direct` uses Markdown the site publishes.
15001491
15011492
stop_after_ms: Soft crawl deadline in milliseconds. Returns pages collected before the next
15021493
deadline check.
@@ -1808,8 +1799,8 @@ async def map_urls(
18081799
Args:
18091800
domain: Domain to map, e.g. `stripe.com`.
18101801
1811-
exclude_url_regex: Optional RE2-compatible regex pattern. URLs matching this pattern are not
1812-
returned, even when they match urlRegex.
1802+
exclude_url_regex: Regex pattern. URLs matching this pattern are not returned, even when they match
1803+
urlRegex.
18131804
18141805
headers: HTTP headers for the target origin. Non-empty headers bypass caching.
18151806
@@ -1826,8 +1817,8 @@ async def map_urls(
18261817
18271818
timeout_opts: Request deadline and what to return when it passes.
18281819
1829-
url_regex: Optional RE2-compatible regex pattern. Only URLs matching this pattern are
1830-
returned and counted against maxLinks.
1820+
url_regex: Regex pattern. Only URLs matching this pattern are returned and counted against
1821+
maxLinks.
18311822
18321823
zdr: `enabled` turns on zero data retention. Returns 403 `ZDR_NOT_ENABLED` unless
18331824
your organization has ZDR.
@@ -2979,8 +2970,8 @@ async def web_crawl_md(
29792970
29802971
exclude_selectors: Remove matching elements after inclusions. Exclusions take precedence.
29812972
2982-
exclude_url_regex: RE2 regex pattern. URLs matching this pattern are never followed or scraped,
2983-
even when they match urlRegex. The starting URL is always scraped.
2973+
exclude_url_regex: Regex pattern. URLs matching this pattern are never followed or scraped, even
2974+
when they match urlRegex. The starting URL is always scraped.
29842975
29852976
follow_subdomains: When true, follow links on subdomains of the starting URL's domain (e.g.
29862977
docs.example.com when starting from example.com). www and apex are always
@@ -2989,11 +2980,9 @@ async def web_crawl_md(
29892980
include_frames: When true, the contents of iframes are rendered to Markdown for each crawled
29902981
page.
29912982
2992-
include_images: Include image references in the Markdown output Only applies to
2993-
`html-conversion` extractions.
2983+
include_images: Include image references in the Markdown output (`html-conversion` only).
29942984
2995-
include_links: Preserve hyperlinks in the Markdown output Only applies to `html-conversion`
2996-
extractions.
2985+
include_links: Preserve hyperlinks in the Markdown output (`html-conversion` only).
29972986
29982987
include_selectors: Keep matching HTML subtrees before converting each page to Markdown.
29992988
@@ -3008,18 +2997,11 @@ async def web_crawl_md(
30082997
settle_animations: Wait briefly for CSS animations and transitions to settle before reading each
30092998
page.
30102999
3011-
shorten_base64_images: Truncate base64-encoded image data in the Markdown output Only applies to
3012-
`html-conversion` extractions.
3013-
3014-
source_preference: Where the Markdown should come from, in order of preference; the first usable
3015-
source wins. `html-conversion` converts the page HTML, and counts as unusable
3016-
when the conversion has almost no content (under 200 characters).
3017-
`markdown-direct` uses the official Markdown version the page publishes through,
3018-
returned as the site serves it. Defaults to
3019-
`["html-conversion", "markdown-direct"]`. With only `markdown-direct`, a page
3020-
that publishes no Markdown fails with `NO_PUBLISHED_MARKDOWN` and is not billed.
3021-
Requests with include or exclude selectors never use `markdown-direct`, so they
3022-
must include `html-conversion`.
3000+
shorten_base64_images: Truncate base64-encoded image data in the Markdown output (`html-conversion`
3001+
only).
3002+
3003+
source_preference: Markdown sources in order of preference: `html-conversion` converts the page
3004+
HTML, `markdown-direct` uses Markdown the site publishes.
30233005
30243006
stop_after_ms: Soft crawl deadline in milliseconds. Returns pages collected before the next
30253007
deadline check.

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

Lines changed: 17 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -193,37 +193,20 @@ class InputScrapeDataMarkdownParams(TypedDict, total=False):
193193
"""Markdown options. Requires `formats.markdown`."""
194194

195195
include_images: Annotated[bool, PropertyInfo(alias="includeImages")]
196-
"""Include images in the Markdown using image syntax with URLs and alt text.
197-
198-
Only applies to `html-conversion` extractions.
199-
"""
196+
"""Include images in the Markdown (`html-conversion` only)."""
200197

201198
include_links: Annotated[bool, PropertyInfo(alias="includeLinks")]
202-
"""Keep link URLs in the Markdown.
203-
204-
Set false to return link text without URLs. Only applies to `html-conversion`
205-
extractions.
206-
"""
199+
"""Keep link URLs in the Markdown (`html-conversion` only)."""
207200

208201
inline_images: Annotated[Literal["placeholder", "preserve"], PropertyInfo(alias="inlineImages")]
209-
"""How base64 images appear: `placeholder` (default) or `preserve`.
210-
211-
Requires `includeImages`. Only applies to `html-conversion` extractions.
212-
"""
202+
"""How base64 images appear when `includeImages` is set (`html-conversion` only)."""
213203

214204
source_preference: Annotated[
215205
List[Literal["html-conversion", "markdown-direct"]], PropertyInfo(alias="sourcePreference")
216206
]
217207
"""
218-
Where the Markdown should come from, in order of preference; the first usable
219-
source wins. `html-conversion` converts the page HTML, and counts as unusable
220-
when the conversion has almost no content (under 200 characters).
221-
`markdown-direct` uses the official Markdown version the page publishes through,
222-
returned as the site serves it. Defaults to
223-
`["html-conversion", "markdown-direct"]`. With only `markdown-direct`, a page
224-
that publishes no Markdown fails with `NO_PUBLISHED_MARKDOWN` and is not billed.
225-
Requests with include or exclude selectors never use `markdown-direct`, so they
226-
must include `html-conversion`.
208+
Markdown sources in order of preference: `html-conversion` converts the page
209+
HTML, `markdown-direct` uses Markdown the site publishes.
227210
"""
228211

229212

@@ -725,7 +708,7 @@ class InputCrawlDataSourceStartURLControls(TypedDict, total=False):
725708
"""Limits and filters for page discovery."""
726709

727710
exclude_regex: Annotated[str, PropertyInfo(alias="excludeRegex")]
728-
"""RE2 pattern for URLs to exclude, even when they match `regex`.
711+
"""Regex pattern for URLs to exclude, even when they match `regex`.
729712
730713
The `start_url` itself is always included.
731714
"""
@@ -814,11 +797,9 @@ class InputCrawlDataSourceStartURLControls(TypedDict, total=False):
814797
]
815798
],
816799
]
817-
"""Languages whose pages are followed.
818-
819-
`same_as_start_url` follows only the start page's language; a list of language
820-
codes such as `["en"]` follows those languages. Links whose language cannot be
821-
determined are followed. When omitted all urls are crawled.
800+
"""
801+
Only follow pages in these languages, or `same_as_start_url`; all languages when
802+
omitted.
822803
"""
823804

824805
max_depth: Annotated[int, PropertyInfo(alias="maxDepth")]
@@ -828,7 +809,7 @@ class InputCrawlDataSourceStartURLControls(TypedDict, total=False):
828809
"""Maximum pages to fetch. Unused reserved credits are refunded. Maximum 100000."""
829810

830811
regex: str
831-
"""RE2 pattern for URLs to include. The `start_url` itself is always included."""
812+
"""Regex pattern for URLs to include. The `start_url` itself is always included."""
832813

833814

834815
class InputCrawlDataSourceStartURL(TypedDict, total=False):
@@ -852,15 +833,15 @@ class InputCrawlDataSourceSitemapControls(TypedDict, total=False):
852833

853834
exclude_regex: Annotated[str, PropertyInfo(alias="excludeRegex")]
854835
"""
855-
RE2 pattern; sitemap URLs matching it are not scraped, even when they match
836+
Regex pattern; sitemap URLs matching it are not scraped, even when they match
856837
`regex`.
857838
"""
858839

859840
max_urls: Annotated[int, PropertyInfo(alias="maxUrls")]
860841
"""Maximum pages to fetch. Unused reserved credits are refunded. Maximum 100000."""
861842

862843
regex: str
863-
"""RE2 pattern; only sitemap URLs matching it are scraped."""
844+
"""Regex pattern; only sitemap URLs matching it are scraped."""
864845

865846

866847
class InputCrawlDataSourceSitemap(TypedDict, total=False):
@@ -926,37 +907,20 @@ class InputCrawlDataMarkdownParams(TypedDict, total=False):
926907
"""Markdown options. Requires `formats.markdown`."""
927908

928909
include_images: Annotated[bool, PropertyInfo(alias="includeImages")]
929-
"""Include images in the Markdown using image syntax with URLs and alt text.
930-
931-
Only applies to `html-conversion` extractions.
932-
"""
910+
"""Include images in the Markdown (`html-conversion` only)."""
933911

934912
include_links: Annotated[bool, PropertyInfo(alias="includeLinks")]
935-
"""Keep link URLs in the Markdown.
936-
937-
Set false to return link text without URLs. Only applies to `html-conversion`
938-
extractions.
939-
"""
913+
"""Keep link URLs in the Markdown (`html-conversion` only)."""
940914

941915
inline_images: Annotated[Literal["placeholder", "preserve"], PropertyInfo(alias="inlineImages")]
942-
"""How base64 images appear: `placeholder` (default) or `preserve`.
943-
944-
Requires `includeImages`. Only applies to `html-conversion` extractions.
945-
"""
916+
"""How base64 images appear when `includeImages` is set (`html-conversion` only)."""
946917

947918
source_preference: Annotated[
948919
List[Literal["html-conversion", "markdown-direct"]], PropertyInfo(alias="sourcePreference")
949920
]
950921
"""
951-
Where the Markdown should come from, in order of preference; the first usable
952-
source wins. `html-conversion` converts the page HTML, and counts as unusable
953-
when the conversion has almost no content (under 200 characters).
954-
`markdown-direct` uses the official Markdown version the page publishes through,
955-
returned as the site serves it. Defaults to
956-
`["html-conversion", "markdown-direct"]`. With only `markdown-direct`, a page
957-
that publishes no Markdown fails with `NO_PUBLISHED_MARKDOWN` and is not billed.
958-
Requests with include or exclude selectors never use `markdown-direct`, so they
959-
must include `html-conversion`.
922+
Markdown sources in order of preference: `html-conversion` converts the page
923+
HTML, `markdown-direct` uses Markdown the site publishes.
960924
"""
961925

962926

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class CrawlControls(BaseModel):
3333
"""Crawl settings as submitted."""
3434

3535
exclude_url_pattern: Optional[str] = None
36-
"""RE2 pattern URLs must not match to be crawled. Null when the crawl set none."""
36+
"""Regex pattern URLs must not match to be crawled. Null when the crawl set none."""
3737

3838
follow_subdomains: bool
3939
"""Whether links to subdomains were followed. Always false for a sitemap crawl."""
@@ -120,11 +120,7 @@ class CrawlControls(BaseModel):
120120
],
121121
None,
122122
] = None
123-
"""
124-
Languages whose pages were followed: `same_as_start_url` or a list of language
125-
codes. Null when every language was followed, which is always the case for a
126-
sitemap crawl.
127-
"""
123+
"""Languages whose pages were followed; null when all languages were."""
128124

129125
max_depth: Optional[int] = None
130126
"""Link depth limit.
@@ -144,4 +140,4 @@ class CrawlControls(BaseModel):
144140
"""Where the crawl started."""
145141

146142
url_pattern: Optional[str] = None
147-
"""RE2 pattern URLs had to match to be crawled. Null when the crawl set none."""
143+
"""Regex pattern URLs had to match to be crawled. Null when the crawl set none."""

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class WebMapURLsParams(TypedDict, total=False):
1616
"""Domain to map, e.g. `stripe.com`."""
1717

1818
exclude_url_regex: Annotated[str, PropertyInfo(alias="excludeUrlRegex")]
19-
"""Optional RE2-compatible regex pattern.
19+
"""Regex pattern.
2020
2121
URLs matching this pattern are not returned, even when they match urlRegex.
2222
"""
@@ -46,7 +46,7 @@ class WebMapURLsParams(TypedDict, total=False):
4646
"""Request deadline and what to return when it passes."""
4747

4848
url_regex: Annotated[str, PropertyInfo(alias="urlRegex")]
49-
"""Optional RE2-compatible regex pattern.
49+
"""Regex pattern.
5050
5151
Only URLs matching this pattern are returned and counted against maxLinks.
5252
"""

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

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -163,37 +163,20 @@ class MarkdownParams(TypedDict, total=False):
163163
"""Markdown options. Requires `formats.markdown`."""
164164

165165
include_images: Annotated[bool, PropertyInfo(alias="includeImages")]
166-
"""Include images in the Markdown using image syntax with URLs and alt text.
167-
168-
Only applies to `html-conversion` extractions.
169-
"""
166+
"""Include images in the Markdown (`html-conversion` only)."""
170167

171168
include_links: Annotated[bool, PropertyInfo(alias="includeLinks")]
172-
"""Keep link URLs in the Markdown.
173-
174-
Set false to return link text without URLs. Only applies to `html-conversion`
175-
extractions.
176-
"""
169+
"""Keep link URLs in the Markdown (`html-conversion` only)."""
177170

178171
inline_images: Annotated[Literal["placeholder", "preserve"], PropertyInfo(alias="inlineImages")]
179-
"""How base64 images appear: `placeholder` (default) or `preserve`.
180-
181-
Requires `includeImages`. Only applies to `html-conversion` extractions.
182-
"""
172+
"""How base64 images appear when `includeImages` is set (`html-conversion` only)."""
183173

184174
source_preference: Annotated[
185175
List[Literal["html-conversion", "markdown-direct"]], PropertyInfo(alias="sourcePreference")
186176
]
187177
"""
188-
Where the Markdown should come from, in order of preference; the first usable
189-
source wins. `html-conversion` converts the page HTML, and counts as unusable
190-
when the conversion has almost no content (under 200 characters).
191-
`markdown-direct` uses the official Markdown version the page publishes through,
192-
returned as the site serves it. Defaults to
193-
`["html-conversion", "markdown-direct"]`. With only `markdown-direct`, a page
194-
that publishes no Markdown fails with `NO_PUBLISHED_MARKDOWN` and is not billed.
195-
Requests with include or exclude selectors never use `markdown-direct`, so they
196-
must include `html-conversion`.
178+
Markdown sources in order of preference: `html-conversion` converts the page
179+
HTML, `markdown-direct` uses Markdown the site publishes.
197180
"""
198181

199182

0 commit comments

Comments
 (0)