Skip to content

Commit e3419e4

Browse files
feat(api): api update
1 parent 93da641 commit e3419e4

7 files changed

Lines changed: 155 additions & 57 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: 22
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-fbe2d24f3b2c3f46adc35ff5fe7f2585dcababa7d9b649bd6c48fcfdd6d700de.yml
3-
openapi_spec_hash: 865bd1e346267d1e33f8ca63963c6aa3
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-c4963b57c26ac1a89f0ce8e04a280ee3d68e82d3fb02205623db6a53787112bc.yml
3+
openapi_spec_hash: e277a9c81fa4a02f838be17487555ead
44
config_hash: ff13935d1231ad44cd3822ffe39904b4

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

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ def web_crawl_md(
271271
max_age_ms: int | Omit = omit,
272272
max_depth: int | Omit = omit,
273273
max_pages: int | Omit = omit,
274-
parse_pdf: bool | Omit = omit,
274+
pdf: web_web_crawl_md_params.Pdf | Omit = omit,
275275
shorten_base64_images: bool | Omit = omit,
276276
timeout_ms: int | Omit = omit,
277277
url_regex: str | Omit = omit,
@@ -310,9 +310,8 @@ def web_crawl_md(
310310
311311
max_pages: Maximum number of pages to crawl. Hard cap: 500.
312312
313-
parse_pdf: When true (default), PDF pages are fetched and their text layer is extracted and
314-
converted to Markdown alongside HTML pages. When false, PDF pages are skipped
315-
entirely (not included in results and not counted as failures).
313+
pdf: PDF parsing controls. Use start/end to limit text extraction and OCR to an
314+
inclusive 1-based page range.
316315
317316
shorten_base64_images: Truncate base64-encoded image data in the Markdown output
318317
@@ -348,7 +347,7 @@ def web_crawl_md(
348347
"max_age_ms": max_age_ms,
349348
"max_depth": max_depth,
350349
"max_pages": max_pages,
351-
"parse_pdf": parse_pdf,
350+
"pdf": pdf,
352351
"shorten_base64_images": shorten_base64_images,
353352
"timeout_ms": timeout_ms,
354353
"url_regex": url_regex,
@@ -369,7 +368,7 @@ def web_scrape_html(
369368
url: str,
370369
include_frames: bool | Omit = omit,
371370
max_age_ms: int | Omit = omit,
372-
parse_pdf: bool | Omit = omit,
371+
pdf: web_web_scrape_html_params.Pdf | Omit = omit,
373372
timeout_ms: int | Omit = omit,
374373
wait_for_ms: int | Omit = omit,
375374
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -391,9 +390,8 @@ def web_scrape_html(
391390
younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
392391
omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
393392
394-
parse_pdf: When true (default), PDF URLs are fetched and their text layer is extracted and
395-
returned wrapped in <html><pdf>…</pdf></html>. When false, PDF URLs are skipped
396-
and a 400 WEBSITE_ACCESS_ERROR is returned.
393+
pdf: PDF parsing controls. Use start/end to limit text extraction and OCR to an
394+
inclusive 1-based page range.
397395
398396
timeout_ms: Optional timeout in milliseconds for the request. If the request takes longer
399397
than this value, it will be aborted with a 408 status code. Maximum allowed
@@ -423,7 +421,7 @@ def web_scrape_html(
423421
"url": url,
424422
"include_frames": include_frames,
425423
"max_age_ms": max_age_ms,
426-
"parse_pdf": parse_pdf,
424+
"pdf": pdf,
427425
"timeout_ms": timeout_ms,
428426
"wait_for_ms": wait_for_ms,
429427
},
@@ -507,7 +505,7 @@ def web_scrape_md(
507505
include_images: bool | Omit = omit,
508506
include_links: bool | Omit = omit,
509507
max_age_ms: int | Omit = omit,
510-
parse_pdf: bool | Omit = omit,
508+
pdf: web_web_scrape_md_params.Pdf | Omit = omit,
511509
shorten_base64_images: bool | Omit = omit,
512510
timeout_ms: int | Omit = omit,
513511
use_main_content_only: bool | Omit = omit,
@@ -536,9 +534,8 @@ def web_scrape_md(
536534
younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
537535
omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
538536
539-
parse_pdf: When true (default), PDF URLs are fetched and their text layer is extracted and
540-
converted to Markdown. When false, PDF URLs are skipped and a 400
541-
WEBSITE_ACCESS_ERROR is returned.
537+
pdf: PDF parsing controls. Use start/end to limit text extraction and OCR to an
538+
inclusive 1-based page range.
542539
543540
shorten_base64_images: Shorten base64-encoded image data in the Markdown output
544541
@@ -574,7 +571,7 @@ def web_scrape_md(
574571
"include_images": include_images,
575572
"include_links": include_links,
576573
"max_age_ms": max_age_ms,
577-
"parse_pdf": parse_pdf,
574+
"pdf": pdf,
578575
"shorten_base64_images": shorten_base64_images,
579576
"timeout_ms": timeout_ms,
580577
"use_main_content_only": use_main_content_only,
@@ -877,7 +874,7 @@ async def web_crawl_md(
877874
max_age_ms: int | Omit = omit,
878875
max_depth: int | Omit = omit,
879876
max_pages: int | Omit = omit,
880-
parse_pdf: bool | Omit = omit,
877+
pdf: web_web_crawl_md_params.Pdf | Omit = omit,
881878
shorten_base64_images: bool | Omit = omit,
882879
timeout_ms: int | Omit = omit,
883880
url_regex: str | Omit = omit,
@@ -916,9 +913,8 @@ async def web_crawl_md(
916913
917914
max_pages: Maximum number of pages to crawl. Hard cap: 500.
918915
919-
parse_pdf: When true (default), PDF pages are fetched and their text layer is extracted and
920-
converted to Markdown alongside HTML pages. When false, PDF pages are skipped
921-
entirely (not included in results and not counted as failures).
916+
pdf: PDF parsing controls. Use start/end to limit text extraction and OCR to an
917+
inclusive 1-based page range.
922918
923919
shorten_base64_images: Truncate base64-encoded image data in the Markdown output
924920
@@ -954,7 +950,7 @@ async def web_crawl_md(
954950
"max_age_ms": max_age_ms,
955951
"max_depth": max_depth,
956952
"max_pages": max_pages,
957-
"parse_pdf": parse_pdf,
953+
"pdf": pdf,
958954
"shorten_base64_images": shorten_base64_images,
959955
"timeout_ms": timeout_ms,
960956
"url_regex": url_regex,
@@ -975,7 +971,7 @@ async def web_scrape_html(
975971
url: str,
976972
include_frames: bool | Omit = omit,
977973
max_age_ms: int | Omit = omit,
978-
parse_pdf: bool | Omit = omit,
974+
pdf: web_web_scrape_html_params.Pdf | Omit = omit,
979975
timeout_ms: int | Omit = omit,
980976
wait_for_ms: int | Omit = omit,
981977
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -997,9 +993,8 @@ async def web_scrape_html(
997993
younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
998994
omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
999995
1000-
parse_pdf: When true (default), PDF URLs are fetched and their text layer is extracted and
1001-
returned wrapped in <html><pdf>…</pdf></html>. When false, PDF URLs are skipped
1002-
and a 400 WEBSITE_ACCESS_ERROR is returned.
996+
pdf: PDF parsing controls. Use start/end to limit text extraction and OCR to an
997+
inclusive 1-based page range.
1003998
1004999
timeout_ms: Optional timeout in milliseconds for the request. If the request takes longer
10051000
than this value, it will be aborted with a 408 status code. Maximum allowed
@@ -1029,7 +1024,7 @@ async def web_scrape_html(
10291024
"url": url,
10301025
"include_frames": include_frames,
10311026
"max_age_ms": max_age_ms,
1032-
"parse_pdf": parse_pdf,
1027+
"pdf": pdf,
10331028
"timeout_ms": timeout_ms,
10341029
"wait_for_ms": wait_for_ms,
10351030
},
@@ -1113,7 +1108,7 @@ async def web_scrape_md(
11131108
include_images: bool | Omit = omit,
11141109
include_links: bool | Omit = omit,
11151110
max_age_ms: int | Omit = omit,
1116-
parse_pdf: bool | Omit = omit,
1111+
pdf: web_web_scrape_md_params.Pdf | Omit = omit,
11171112
shorten_base64_images: bool | Omit = omit,
11181113
timeout_ms: int | Omit = omit,
11191114
use_main_content_only: bool | Omit = omit,
@@ -1142,9 +1137,8 @@ async def web_scrape_md(
11421137
younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
11431138
omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
11441139
1145-
parse_pdf: When true (default), PDF URLs are fetched and their text layer is extracted and
1146-
converted to Markdown. When false, PDF URLs are skipped and a 400
1147-
WEBSITE_ACCESS_ERROR is returned.
1140+
pdf: PDF parsing controls. Use start/end to limit text extraction and OCR to an
1141+
inclusive 1-based page range.
11481142
11491143
shorten_base64_images: Shorten base64-encoded image data in the Markdown output
11501144
@@ -1180,7 +1174,7 @@ async def web_scrape_md(
11801174
"include_images": include_images,
11811175
"include_links": include_links,
11821176
"max_age_ms": max_age_ms,
1183-
"parse_pdf": parse_pdf,
1177+
"pdf": pdf,
11841178
"shorten_base64_images": shorten_base64_images,
11851179
"timeout_ms": timeout_ms,
11861180
"use_main_content_only": use_main_content_only,

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

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from .._utils import PropertyInfo
88

9-
__all__ = ["WebWebCrawlMdParams"]
9+
__all__ = ["WebWebCrawlMdParams", "Pdf"]
1010

1111

1212
class WebWebCrawlMdParams(TypedDict, total=False):
@@ -45,11 +45,11 @@ class WebWebCrawlMdParams(TypedDict, total=False):
4545
max_pages: Annotated[int, PropertyInfo(alias="maxPages")]
4646
"""Maximum number of pages to crawl. Hard cap: 500."""
4747

48-
parse_pdf: Annotated[bool, PropertyInfo(alias="parsePDF")]
49-
"""
50-
When true (default), PDF pages are fetched and their text layer is extracted and
51-
converted to Markdown alongside HTML pages. When false, PDF pages are skipped
52-
entirely (not included in results and not counted as failures).
48+
pdf: Pdf
49+
"""PDF parsing controls.
50+
51+
Use start/end to limit text extraction and OCR to an inclusive 1-based page
52+
range.
5353
"""
5454

5555
shorten_base64_images: Annotated[bool, PropertyInfo(alias="shortenBase64Images")]
@@ -76,3 +76,30 @@ class WebWebCrawlMdParams(TypedDict, total=False):
7676
Optional browser wait time in milliseconds after initial page load for each
7777
crawled page. Min: 0. Max: 30000 (30 seconds).
7878
"""
79+
80+
81+
class Pdf(TypedDict, total=False):
82+
"""PDF parsing controls.
83+
84+
Use start/end to limit text extraction and OCR to an inclusive 1-based page range.
85+
"""
86+
87+
end: int
88+
"""Last 1-based PDF page to parse.
89+
90+
When omitted, parsing ends at the last page. Must be greater than or equal to
91+
start when both are provided.
92+
"""
93+
94+
should_parse: Annotated[bool, PropertyInfo(alias="shouldParse")]
95+
"""When true, PDF pages are fetched and parsed.
96+
97+
When false, PDF pages are skipped entirely (not included in results and not
98+
counted as failures).
99+
"""
100+
101+
start: int
102+
"""First 1-based PDF page to parse.
103+
104+
When omitted, parsing starts at the first page.
105+
"""

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ class Metadata(BaseModel):
1818

1919
num_skipped: int = FieldInfo(alias="numSkipped")
2020
"""
21-
Number of URLs skipped (PDFs when parsePDF=false, or URLs not matching urlRegex)
21+
Number of URLs skipped (PDFs when pdf.shouldParse=false, or URLs not matching
22+
urlRegex)
2223
"""
2324

2425
num_succeeded: int = FieldInfo(alias="numSucceeded")

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

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from .._utils import PropertyInfo
88

9-
__all__ = ["WebWebScrapeHTMLParams"]
9+
__all__ = ["WebWebScrapeHTMLParams", "Pdf"]
1010

1111

1212
class WebWebScrapeHTMLParams(TypedDict, total=False):
@@ -23,11 +23,11 @@ class WebWebScrapeHTMLParams(TypedDict, total=False):
2323
omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
2424
"""
2525

26-
parse_pdf: Annotated[bool, PropertyInfo(alias="parsePDF")]
27-
"""
28-
When true (default), PDF URLs are fetched and their text layer is extracted and
29-
returned wrapped in <html><pdf>…</pdf></html>. When false, PDF URLs are skipped
30-
and a 400 WEBSITE_ACCESS_ERROR is returned.
26+
pdf: Pdf
27+
"""PDF parsing controls.
28+
29+
Use start/end to limit text extraction and OCR to an inclusive 1-based page
30+
range.
3131
"""
3232

3333
timeout_ms: Annotated[int, PropertyInfo(alias="timeoutMS")]
@@ -42,3 +42,29 @@ class WebWebScrapeHTMLParams(TypedDict, total=False):
4242
4343
Min: 0. Max: 30000 (30 seconds).
4444
"""
45+
46+
47+
class Pdf(TypedDict, total=False):
48+
"""PDF parsing controls.
49+
50+
Use start/end to limit text extraction and OCR to an inclusive 1-based page range.
51+
"""
52+
53+
end: int
54+
"""Last 1-based PDF page to parse.
55+
56+
When omitted, parsing ends at the last page. Must be greater than or equal to
57+
start when both are provided.
58+
"""
59+
60+
should_parse: Annotated[bool, PropertyInfo(alias="shouldParse")]
61+
"""When true, PDF URLs are fetched and parsed.
62+
63+
When false, PDF URLs are skipped and a 400 WEBSITE_ACCESS_ERROR is returned.
64+
"""
65+
66+
start: int
67+
"""First 1-based PDF page to parse.
68+
69+
When omitted, parsing starts at the first page.
70+
"""

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

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from .._utils import PropertyInfo
88

9-
__all__ = ["WebWebScrapeMdParams"]
9+
__all__ = ["WebWebScrapeMdParams", "Pdf"]
1010

1111

1212
class WebWebScrapeMdParams(TypedDict, total=False):
@@ -32,11 +32,11 @@ class WebWebScrapeMdParams(TypedDict, total=False):
3232
omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
3333
"""
3434

35-
parse_pdf: Annotated[bool, PropertyInfo(alias="parsePDF")]
36-
"""
37-
When true (default), PDF URLs are fetched and their text layer is extracted and
38-
converted to Markdown. When false, PDF URLs are skipped and a 400
39-
WEBSITE_ACCESS_ERROR is returned.
35+
pdf: Pdf
36+
"""PDF parsing controls.
37+
38+
Use start/end to limit text extraction and OCR to an inclusive 1-based page
39+
range.
4040
"""
4141

4242
shorten_base64_images: Annotated[bool, PropertyInfo(alias="shortenBase64Images")]
@@ -60,3 +60,29 @@ class WebWebScrapeMdParams(TypedDict, total=False):
6060
Optional browser wait time in milliseconds after initial page load before
6161
converting the page to Markdown. Min: 0. Max: 30000 (30 seconds).
6262
"""
63+
64+
65+
class Pdf(TypedDict, total=False):
66+
"""PDF parsing controls.
67+
68+
Use start/end to limit text extraction and OCR to an inclusive 1-based page range.
69+
"""
70+
71+
end: int
72+
"""Last 1-based PDF page to parse.
73+
74+
When omitted, parsing ends at the last page. Must be greater than or equal to
75+
start when both are provided.
76+
"""
77+
78+
should_parse: Annotated[bool, PropertyInfo(alias="shouldParse")]
79+
"""When true, PDF URLs are fetched and parsed.
80+
81+
When false, PDF URLs are skipped and a 400 WEBSITE_ACCESS_ERROR is returned.
82+
"""
83+
84+
start: int
85+
"""First 1-based PDF page to parse.
86+
87+
When omitted, parsing starts at the first page.
88+
"""

0 commit comments

Comments
 (0)