Skip to content

Commit 921eaa8

Browse files
feat(api): api update
1 parent 4af8634 commit 921eaa8

6 files changed

Lines changed: 50 additions & 23 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: 29
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-21b399a0388f04e48b9d8d95f51f622088c5b15b1e17d2988c38583902b9f685.yml
3-
openapi_spec_hash: 6952c95545d272388a655652fc8e7662
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-48b7ece3103b7778fbb3fc822ac3e28f8758a220f16a9a74383a0e15f2a381e2.yml
3+
openapi_spec_hash: b1dcb462be67fc1ad751463f01d21d21
44
config_hash: ff35e224e809656528c44163aa41bebd

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,8 +1264,8 @@ def web_crawl_md(
12641264
12651265
max_pages: Maximum number of pages to crawl. Hard cap: 500.
12661266
1267-
pdf: PDF parsing controls. Use start/end to limit text extraction and OCR to an
1268-
inclusive 1-based page range.
1267+
pdf: PDF parsing controls. Use start/end to limit text extraction and embedded-image
1268+
detection/OCR to an inclusive 1-based page range.
12691269
12701270
settle_animations: When true, waits briefly for CSS and transition animations to settle before
12711271
extracting each crawled page. Defaults to false. This adds a bit of latency in
@@ -1585,8 +1585,8 @@ def web_scrape_html(
15851585
younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
15861586
omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
15871587
1588-
pdf: PDF parsing controls. Use start/end to limit text extraction and OCR to an
1589-
inclusive 1-based page range.
1588+
pdf: PDF parsing controls. Use start/end to limit text extraction and embedded-image
1589+
detection/OCR to an inclusive 1-based page range.
15901590
15911591
settle_animations: When true, waits briefly for CSS and transition animations to settle before
15921592
extracting HTML. Defaults to false. This adds a bit of latency in exchange for
@@ -1997,8 +1997,8 @@ def web_scrape_md(
19971997
younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
19981998
omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
19991999
2000-
pdf: PDF parsing controls. Use start/end to limit text extraction and OCR to an
2001-
inclusive 1-based page range.
2000+
pdf: PDF parsing controls. Use start/end to limit text extraction and embedded-image
2001+
detection/OCR to an inclusive 1-based page range.
20022002
20032003
settle_animations: When true, waits briefly for CSS and transition animations to settle before
20042004
converting to Markdown. Defaults to false. This adds a bit of latency in
@@ -3338,8 +3338,8 @@ async def web_crawl_md(
33383338
33393339
max_pages: Maximum number of pages to crawl. Hard cap: 500.
33403340
3341-
pdf: PDF parsing controls. Use start/end to limit text extraction and OCR to an
3342-
inclusive 1-based page range.
3341+
pdf: PDF parsing controls. Use start/end to limit text extraction and embedded-image
3342+
detection/OCR to an inclusive 1-based page range.
33433343
33443344
settle_animations: When true, waits briefly for CSS and transition animations to settle before
33453345
extracting each crawled page. Defaults to false. This adds a bit of latency in
@@ -3659,8 +3659,8 @@ async def web_scrape_html(
36593659
younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
36603660
omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
36613661
3662-
pdf: PDF parsing controls. Use start/end to limit text extraction and OCR to an
3663-
inclusive 1-based page range.
3662+
pdf: PDF parsing controls. Use start/end to limit text extraction and embedded-image
3663+
detection/OCR to an inclusive 1-based page range.
36643664
36653665
settle_animations: When true, waits briefly for CSS and transition animations to settle before
36663666
extracting HTML. Defaults to false. This adds a bit of latency in exchange for
@@ -4071,8 +4071,8 @@ async def web_scrape_md(
40714071
younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
40724072
omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
40734073
4074-
pdf: PDF parsing controls. Use start/end to limit text extraction and OCR to an
4075-
inclusive 1-based page range.
4074+
pdf: PDF parsing controls. Use start/end to limit text extraction and embedded-image
4075+
detection/OCR to an inclusive 1-based page range.
40764076
40774077
settle_animations: When true, waits briefly for CSS and transition animations to settle before
40784078
converting to Markdown. Defaults to false. This adds a bit of latency in

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,8 @@ class WebWebCrawlMdParams(TypedDict, total=False):
276276
pdf: Pdf
277277
"""PDF parsing controls.
278278
279-
Use start/end to limit text extraction and OCR to an inclusive 1-based page
280-
range.
279+
Use start/end to limit text extraction and embedded-image detection/OCR to an
280+
inclusive 1-based page range.
281281
"""
282282

283283
settle_animations: Annotated[bool, PropertyInfo(alias="settleAnimations")]
@@ -324,7 +324,7 @@ class WebWebCrawlMdParams(TypedDict, total=False):
324324
class Pdf(TypedDict, total=False):
325325
"""PDF parsing controls.
326326
327-
Use start/end to limit text extraction and OCR to an inclusive 1-based page range.
327+
Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range.
328328
"""
329329

330330
end: int
@@ -334,6 +334,13 @@ class Pdf(TypedDict, total=False):
334334
start when both are provided.
335335
"""
336336

337+
ocr: bool
338+
"""
339+
When true, detect and OCR images embedded in the selected PDF pages, inserting
340+
recognized text at each image's position in page reading order while preserving
341+
the PDF text layer. This is separate from automatic scanned-PDF OCR fallback.
342+
"""
343+
337344
should_parse: Annotated[bool, PropertyInfo(alias="shouldParse")]
338345
"""When true, PDF pages are fetched and parsed.
339346

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,8 @@ class WebWebScrapeHTMLParams(TypedDict, total=False):
261261
pdf: Pdf
262262
"""PDF parsing controls.
263263
264-
Use start/end to limit text extraction and OCR to an inclusive 1-based page
265-
range.
264+
Use start/end to limit text extraction and embedded-image detection/OCR to an
265+
inclusive 1-based page range.
266266
"""
267267

268268
settle_animations: Annotated[bool, PropertyInfo(alias="settleAnimations")]
@@ -295,7 +295,7 @@ class WebWebScrapeHTMLParams(TypedDict, total=False):
295295
class Pdf(TypedDict, total=False):
296296
"""PDF parsing controls.
297297
298-
Use start/end to limit text extraction and OCR to an inclusive 1-based page range.
298+
Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range.
299299
"""
300300

301301
end: int
@@ -305,6 +305,13 @@ class Pdf(TypedDict, total=False):
305305
start when both are provided.
306306
"""
307307

308+
ocr: bool
309+
"""
310+
When true, detect and OCR images embedded in the selected PDF pages, inserting
311+
recognized text at each image's position in page reading order while preserving
312+
the PDF text layer. This is separate from automatic scanned-PDF OCR fallback.
313+
"""
314+
308315
should_parse: Annotated[bool, PropertyInfo(alias="shouldParse")]
309316
"""When true, PDF URLs are fetched and parsed.
310317

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,8 @@ class WebWebScrapeMdParams(TypedDict, total=False):
270270
pdf: Pdf
271271
"""PDF parsing controls.
272272
273-
Use start/end to limit text extraction and OCR to an inclusive 1-based page
274-
range.
273+
Use start/end to limit text extraction and embedded-image detection/OCR to an
274+
inclusive 1-based page range.
275275
"""
276276

277277
settle_animations: Annotated[bool, PropertyInfo(alias="settleAnimations")]
@@ -307,7 +307,7 @@ class WebWebScrapeMdParams(TypedDict, total=False):
307307
class Pdf(TypedDict, total=False):
308308
"""PDF parsing controls.
309309
310-
Use start/end to limit text extraction and OCR to an inclusive 1-based page range.
310+
Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range.
311311
"""
312312

313313
end: int
@@ -317,6 +317,13 @@ class Pdf(TypedDict, total=False):
317317
start when both are provided.
318318
"""
319319

320+
ocr: bool
321+
"""
322+
When true, detect and OCR images embedded in the selected PDF pages, inserting
323+
recognized text at each image's position in page reading order while preserving
324+
the PDF text layer. This is separate from automatic scanned-PDF OCR fallback.
325+
"""
326+
320327
should_parse: Annotated[bool, PropertyInfo(alias="shouldParse")]
321328
"""When true, PDF URLs are fetched and parsed.
322329

‎tests/api_resources/test_web.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ def test_method_web_crawl_md_with_all_params(self, client: ContextDev) -> None:
373373
max_pages=1,
374374
pdf={
375375
"end": 1,
376+
"ocr": True,
376377
"should_parse": True,
377378
"start": 1,
378379
},
@@ -433,6 +434,7 @@ def test_method_web_scrape_html_with_all_params(self, client: ContextDev) -> Non
433434
max_age_ms=0,
434435
pdf={
435436
"end": 1,
437+
"ocr": True,
436438
"should_parse": True,
437439
"start": 1,
438440
},
@@ -545,6 +547,7 @@ def test_method_web_scrape_md_with_all_params(self, client: ContextDev) -> None:
545547
max_age_ms=0,
546548
pdf={
547549
"end": 1,
550+
"ocr": True,
548551
"should_parse": True,
549552
"start": 1,
550553
},
@@ -978,6 +981,7 @@ async def test_method_web_crawl_md_with_all_params(self, async_client: AsyncCont
978981
max_pages=1,
979982
pdf={
980983
"end": 1,
984+
"ocr": True,
981985
"should_parse": True,
982986
"start": 1,
983987
},
@@ -1038,6 +1042,7 @@ async def test_method_web_scrape_html_with_all_params(self, async_client: AsyncC
10381042
max_age_ms=0,
10391043
pdf={
10401044
"end": 1,
1045+
"ocr": True,
10411046
"should_parse": True,
10421047
"start": 1,
10431048
},
@@ -1150,6 +1155,7 @@ async def test_method_web_scrape_md_with_all_params(self, async_client: AsyncCon
11501155
max_age_ms=0,
11511156
pdf={
11521157
"end": 1,
1158+
"ocr": True,
11531159
"should_parse": True,
11541160
"start": 1,
11551161
},

0 commit comments

Comments
 (0)