Skip to content

Commit 1a159d4

Browse files
author
stlc-bot
committed
feat(api): explain failed scrape outputs and fix agent-reported bugs (#1360)
Stainless-Generated-From: ced3f67
1 parent d4d0af6 commit 1a159d4

1 file changed

Lines changed: 50 additions & 2 deletions

File tree

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

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ class Bytes(BaseModel):
4848
success: Optional[bool] = None
4949
"""`true` if returned, `false` if it failed, `null` if not requested."""
5050

51+
error_code: Optional[str] = None
52+
"""Why the output failed. Present only when `success` is `false`."""
53+
54+
message: Optional[str] = None
55+
"""Explanation of the failure and possible next steps."""
56+
5157

5258
class CacheMetadata(BaseModel):
5359
"""Whether this response came from cache."""
@@ -75,6 +81,12 @@ class Highlights(BaseModel):
7581
success: Optional[bool] = None
7682
"""`true` if returned, `false` if it failed, `null` if not requested."""
7783

84+
error_code: Optional[str] = None
85+
"""Why the output failed. Present only when `success` is `false`."""
86+
87+
message: Optional[str] = None
88+
"""Explanation of the failure and possible next steps."""
89+
7890

7991
class HTML(BaseModel):
8092
"""Rendered HTML after content filters."""
@@ -86,6 +98,12 @@ class HTML(BaseModel):
8698
success: Optional[bool] = None
8799
"""`true` if returned, `false` if it failed, `null` if not requested."""
88100

101+
error_code: Optional[str] = None
102+
"""Why the output failed. Present only when `success` is `false`."""
103+
104+
message: Optional[str] = None
105+
"""Explanation of the failure and possible next steps."""
106+
89107

90108
class ImagesData(BaseModel):
91109
alt: Optional[str] = None
@@ -119,6 +137,12 @@ class Images(BaseModel):
119137
success: Optional[bool] = None
120138
"""`true` if returned, `false` if it failed, `null` if not requested."""
121139

140+
error_code: Optional[str] = None
141+
"""Why the output failed. Present only when `success` is `false`."""
142+
143+
message: Optional[str] = None
144+
"""Explanation of the failure and possible next steps."""
145+
122146

123147
class Json(BaseModel):
124148
"""Object matching `jsonParams.schema`."""
@@ -131,10 +155,10 @@ class Json(BaseModel):
131155
"""`true` if returned, `false` if it failed, `null` if not requested."""
132156

133157
error_code: Optional[str] = None
134-
"""Cause of a failed JSON extraction, when available."""
158+
"""Why the output failed. Present only when `success` is `false`."""
135159

136160
message: Optional[str] = None
137-
"""Explanation of the JSON extraction failure and possible next steps."""
161+
"""Explanation of the failure and possible next steps."""
138162

139163

140164
class Markdown(BaseModel):
@@ -147,6 +171,12 @@ class Markdown(BaseModel):
147171
success: Optional[bool] = None
148172
"""`true` if returned, `false` if it failed, `null` if not requested."""
149173

174+
error_code: Optional[str] = None
175+
"""Why the output failed. Present only when `success` is `false`."""
176+
177+
message: Optional[str] = None
178+
"""Explanation of the failure and possible next steps."""
179+
150180

151181
class MetadataAlternate(BaseModel):
152182
href: str
@@ -241,6 +271,12 @@ class Parsed(BaseModel):
241271
success: Optional[bool] = None
242272
"""`true` if returned, `false` if it failed, `null` if not requested."""
243273

274+
error_code: Optional[str] = None
275+
"""Why the output failed. Present only when `success` is `false`."""
276+
277+
message: Optional[str] = None
278+
"""Explanation of the failure and possible next steps."""
279+
244280

245281
class ProductDataProductVariant(BaseModel):
246282
attributes: Dict[str, str]
@@ -336,6 +372,12 @@ class Product(BaseModel):
336372
success: Optional[bool] = None
337373
"""`true` if returned, `false` if it failed, `null` if not requested."""
338374

375+
error_code: Optional[str] = None
376+
"""Why the output failed. Present only when `success` is `false`."""
377+
378+
message: Optional[str] = None
379+
"""Explanation of the failure and possible next steps."""
380+
339381

340382
class Screenshot(BaseModel):
341383
"""Screenshot as a base64 image data URL."""
@@ -347,6 +389,12 @@ class Screenshot(BaseModel):
347389
success: Optional[bool] = None
348390
"""`true` if returned, `false` if it failed, `null` if not requested."""
349391

392+
error_code: Optional[str] = None
393+
"""Why the output failed. Present only when `success` is `false`."""
394+
395+
message: Optional[str] = None
396+
"""Explanation of the failure and possible next steps."""
397+
350398

351399
class KeyMetadata(BaseModel):
352400
"""Credits this request used and your remaining balance."""

0 commit comments

Comments
 (0)