Skip to content

Commit 83063fc

Browse files
feat(api): api update
1 parent c0a50fe commit 83063fc

4 files changed

Lines changed: 23 additions & 2 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: 21
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev%2Fcontext.dev-3020cfc216e9d0b8f59d6ec1c186c857531dc20a6536746e2a28d00261c70ad2.yml
3-
openapi_spec_hash: 6bb12c5f849e2523bb813e9f56804832
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev%2Fcontext.dev-ca8e38b0f28a9967dab631b8868f1d59bc035fd994a717e0125c77ca592bd105.yml
3+
openapi_spec_hash: ef0a5df01201a032dcc41f9a25b733e6
44
config_hash: 7d13dca2b2c6f71fc463cb6062efa5ea

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ def web_crawl_md(
251251
follow_subdomains: bool | Omit = omit,
252252
include_images: bool | Omit = omit,
253253
include_links: bool | Omit = omit,
254+
max_age_ms: int | Omit = omit,
254255
max_depth: int | Omit = omit,
255256
max_pages: int | Omit = omit,
256257
shorten_base64_images: bool | Omit = omit,
@@ -278,6 +279,10 @@ def web_crawl_md(
278279
279280
include_links: Preserve hyperlinks in the Markdown output
280281
282+
max_age_ms: Return a cached result if a prior scrape for the same parameters exists and is
283+
younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
284+
omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
285+
281286
max_depth: Maximum link depth from the starting URL (0 = only the starting page)
282287
283288
max_pages: Maximum number of pages to crawl. Hard cap: 500.
@@ -305,6 +310,7 @@ def web_crawl_md(
305310
"follow_subdomains": follow_subdomains,
306311
"include_images": include_images,
307312
"include_links": include_links,
313+
"max_age_ms": max_age_ms,
308314
"max_depth": max_depth,
309315
"max_pages": max_pages,
310316
"shorten_base64_images": shorten_base64_images,
@@ -738,6 +744,7 @@ async def web_crawl_md(
738744
follow_subdomains: bool | Omit = omit,
739745
include_images: bool | Omit = omit,
740746
include_links: bool | Omit = omit,
747+
max_age_ms: int | Omit = omit,
741748
max_depth: int | Omit = omit,
742749
max_pages: int | Omit = omit,
743750
shorten_base64_images: bool | Omit = omit,
@@ -765,6 +772,10 @@ async def web_crawl_md(
765772
766773
include_links: Preserve hyperlinks in the Markdown output
767774
775+
max_age_ms: Return a cached result if a prior scrape for the same parameters exists and is
776+
younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
777+
omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
778+
768779
max_depth: Maximum link depth from the starting URL (0 = only the starting page)
769780
770781
max_pages: Maximum number of pages to crawl. Hard cap: 500.
@@ -792,6 +803,7 @@ async def web_crawl_md(
792803
"follow_subdomains": follow_subdomains,
793804
"include_images": include_images,
794805
"include_links": include_links,
806+
"max_age_ms": max_age_ms,
795807
"max_depth": max_depth,
796808
"max_pages": max_pages,
797809
"shorten_base64_images": shorten_base64_images,

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ class WebWebCrawlMdParams(TypedDict, total=False):
2626
include_links: Annotated[bool, PropertyInfo(alias="includeLinks")]
2727
"""Preserve hyperlinks in the Markdown output"""
2828

29+
max_age_ms: Annotated[int, PropertyInfo(alias="maxAgeMs")]
30+
"""
31+
Return a cached result if a prior scrape for the same parameters exists and is
32+
younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
33+
omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
34+
"""
35+
2936
max_depth: Annotated[int, PropertyInfo(alias="maxDepth")]
3037
"""Maximum link depth from the starting URL (0 = only the starting page)"""
3138

‎tests/api_resources/test_web.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ def test_method_web_crawl_md_with_all_params(self, client: ContextDev) -> None:
158158
follow_subdomains=True,
159159
include_images=True,
160160
include_links=True,
161+
max_age_ms=0,
161162
max_depth=0,
162163
max_pages=1,
163164
shorten_base64_images=True,
@@ -498,6 +499,7 @@ async def test_method_web_crawl_md_with_all_params(self, async_client: AsyncCont
498499
follow_subdomains=True,
499500
include_images=True,
500501
include_links=True,
502+
max_age_ms=0,
501503
max_depth=0,
502504
max_pages=1,
503505
shorten_base64_images=True,

0 commit comments

Comments
 (0)