Skip to content

Commit 713964b

Browse files
feat(api): api update
1 parent d2e4746 commit 713964b

4 files changed

Lines changed: 33 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: 25
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-5a8e1f6e16ecdbab4b2ff14701779818fe0328b06a1c7fa44a32da4f4bc87a49.yml
3-
openapi_spec_hash: 4b5407859d1154232189ef440b783b17
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-7002d4e40fb0a8dc4454b7f72f86d6068245cb367ddf7c784f00e35f6f75de1f.yml
3+
openapi_spec_hash: da6f7b8ab297306b97ed9fe8df9ad1a0
44
config_hash: f86a4e06ae5ed725aa79d58d7a8dc27c

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ def extract(
7676
include_frames: bool | Omit = omit,
7777
instructions: str | Omit = omit,
7878
max_age_ms: int | Omit = omit,
79+
max_depth: int | Omit = omit,
80+
max_pages: int | Omit = omit,
7981
pdf: web_extract_params.Pdf | Omit = omit,
8082
stop_after_ms: int | Omit = omit,
8183
timeout_ms: int | Omit = omit,
@@ -116,6 +118,11 @@ def extract(
116118
max_age_ms: Return cached scrape results if a prior scrape for the same parameters is
117119
younger than this many milliseconds. Defaults to 7 days (604800000 ms).
118120
121+
max_depth: Optional maximum link depth from the starting URL (0 = only the starting page).
122+
If omitted, there is no crawl depth limit.
123+
124+
max_pages: Maximum number of pages to analyze for extraction. Hard cap: 50. Defaults to 5.
125+
119126
stop_after_ms: Soft time budget for the crawl in milliseconds. Min: 10000 (10s). Max: 110000
120127
(110s). Default: 80000 (80s).
121128
@@ -145,6 +152,8 @@ def extract(
145152
"include_frames": include_frames,
146153
"instructions": instructions,
147154
"max_age_ms": max_age_ms,
155+
"max_depth": max_depth,
156+
"max_pages": max_pages,
148157
"pdf": pdf,
149158
"stop_after_ms": stop_after_ms,
150159
"timeout_ms": timeout_ms,
@@ -985,6 +994,8 @@ async def extract(
985994
include_frames: bool | Omit = omit,
986995
instructions: str | Omit = omit,
987996
max_age_ms: int | Omit = omit,
997+
max_depth: int | Omit = omit,
998+
max_pages: int | Omit = omit,
988999
pdf: web_extract_params.Pdf | Omit = omit,
9891000
stop_after_ms: int | Omit = omit,
9901001
timeout_ms: int | Omit = omit,
@@ -1025,6 +1036,11 @@ async def extract(
10251036
max_age_ms: Return cached scrape results if a prior scrape for the same parameters is
10261037
younger than this many milliseconds. Defaults to 7 days (604800000 ms).
10271038
1039+
max_depth: Optional maximum link depth from the starting URL (0 = only the starting page).
1040+
If omitted, there is no crawl depth limit.
1041+
1042+
max_pages: Maximum number of pages to analyze for extraction. Hard cap: 50. Defaults to 5.
1043+
10281044
stop_after_ms: Soft time budget for the crawl in milliseconds. Min: 10000 (10s). Max: 110000
10291045
(110s). Default: 80000 (80s).
10301046
@@ -1054,6 +1070,8 @@ async def extract(
10541070
"include_frames": include_frames,
10551071
"instructions": instructions,
10561072
"max_age_ms": max_age_ms,
1073+
"max_depth": max_depth,
1074+
"max_pages": max_pages,
10571075
"pdf": pdf,
10581076
"stop_after_ms": stop_after_ms,
10591077
"timeout_ms": timeout_ms,

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@ class WebExtractParams(TypedDict, total=False):
5252
younger than this many milliseconds. Defaults to 7 days (604800000 ms).
5353
"""
5454

55+
max_depth: Annotated[int, PropertyInfo(alias="maxDepth")]
56+
"""Optional maximum link depth from the starting URL (0 = only the starting page).
57+
58+
If omitted, there is no crawl depth limit.
59+
"""
60+
61+
max_pages: Annotated[int, PropertyInfo(alias="maxPages")]
62+
"""Maximum number of pages to analyze for extraction. Hard cap: 50. Defaults to 5."""
63+
5564
pdf: Pdf
5665

5766
stop_after_ms: Annotated[int, PropertyInfo(alias="stopAfterMs")]

‎tests/api_resources/test_web.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ def test_method_extract_with_all_params(self, client: ContextDev) -> None:
5959
include_frames=True,
6060
instructions="instructions",
6161
max_age_ms=0,
62+
max_depth=0,
63+
max_pages=1,
6264
pdf={
6365
"end": 1,
6466
"should_parse": True,
@@ -649,6 +651,8 @@ async def test_method_extract_with_all_params(self, async_client: AsyncContextDe
649651
include_frames=True,
650652
instructions="instructions",
651653
max_age_ms=0,
654+
max_depth=0,
655+
max_pages=1,
652656
pdf={
653657
"end": 1,
654658
"should_parse": True,

0 commit comments

Comments
 (0)