Skip to content

Commit 0459b42

Browse files
author
stlc-bot
committed
feat(scrape): enable highlights with zero data retention (#1246)
Stainless-Generated-From: ccb4e99
1 parent ae23efd commit 0459b42

4 files changed

Lines changed: 13 additions & 39 deletions

File tree

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -465,8 +465,7 @@ def scrape(
465465
when using return-partial.
466466
467467
zdr: Zero data retention. Bypasses caches and uploads; excludes request/response
468-
content and tags from logs. Must be enabled for your organization. Not available
469-
with the highlights output.
468+
content and tags from logs. Must be enabled for your organization.
470469
471470
extra_headers: Send extra headers
472471
@@ -1961,8 +1960,7 @@ async def scrape(
19611960
when using return-partial.
19621961
19631962
zdr: Zero data retention. Bypasses caches and uploads; excludes request/response
1964-
content and tags from logs. Must be enabled for your organization. Not available
1965-
with the highlights output.
1963+
content and tags from logs. Must be enabled for your organization.
19661964
19671965
extra_headers: Send extra headers
19681966

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

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ class WebScrapeParams(TypedDict, total=False):
9696
"""Zero data retention.
9797
9898
Bypasses caches and uploads; excludes request/response content and tags from
99-
logs. Must be enabled for your organization. Not available with the highlights
100-
output.
99+
logs. Must be enabled for your organization.
101100
"""
102101

103102

@@ -108,11 +107,7 @@ class Formats(TypedDict, total=False):
108107
"""The original HTTP response body."""
109108

110109
highlights: bool
111-
"""
112-
Plain-text passages from the page that are most relevant to
113-
highlightsParams.query, each prefixed with its section heading. Adds 3 credits.
114-
Not available with zdr enabled.
115-
"""
110+
"""Relevant passages for your question or topic. Adds 3 credits."""
116111

117112
html: bool
118113
"""Rendered HTML."""
@@ -121,12 +116,7 @@ class Formats(TypedDict, total=False):
121116
"""Images found on the page."""
122117

123118
json: bool
124-
"""
125-
Page data extracted by an LLM from the page Markdown into jsonParams.schema;
126-
values carried only in attributes or CSS classes need formats.parse instead.
127-
Adds four credits when the page has text to extract; when shared content filters
128-
leave no text the result is an empty object and only the base price applies.
129-
"""
119+
"""Page data extracted using your schema. Adds 4 credits."""
130120

131121
markdown: bool
132122
"""Page content as Markdown."""
@@ -135,7 +125,7 @@ class Formats(TypedDict, total=False):
135125
"""Fields selected by parseParams.rules."""
136126

137127
product: bool
138-
"""Structured product data for product detail pages. Adds one credit."""
128+
"""Product details such as name, price, and availability. Adds 1 credit."""
139129

140130
screenshot: bool
141131
"""An inline image of the page."""

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

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ class CacheMetadata(BaseModel):
6969

7070

7171
class Highlights(BaseModel):
72-
"""
73-
Plain-text passages relevant to highlightsParams.query, in page order, each prefixed with its section heading in square brackets. Empty when the page has no text.
74-
"""
72+
"""Relevant passages for your question or topic."""
7573

7674
data: Optional[List[str]] = None
7775

@@ -117,10 +115,7 @@ class Images(BaseModel):
117115

118116

119117
class Json(BaseModel):
120-
"""Page data extracted into jsonParams.schema, after shared content filters.
121-
122-
Values are grounded in the page; optional fields the page does not state are omitted, or null when their type allows null. An empty object when the filters leave no text.
123-
"""
118+
"""Page data extracted using your schema."""
124119

125120
data: Optional[Dict[str, object]] = None
126121

@@ -311,7 +306,7 @@ class ProductData(BaseModel):
311306

312307

313308
class Product(BaseModel):
314-
"""Product detail page classification and the extracted product."""
309+
"""Product details found on the page."""
315310

316311
data: Optional[ProductData] = None
317312

@@ -351,11 +346,7 @@ class WebScrapeResponse(BaseModel):
351346
"""
352347

353348
highlights: Highlights
354-
"""
355-
Plain-text passages relevant to highlightsParams.query, in page order, each
356-
prefixed with its section heading in square brackets. Empty when the page has no
357-
text.
358-
"""
349+
"""Relevant passages for your question or topic."""
359350

360351
html: HTML
361352
"""Rendered HTML after content filters."""
@@ -364,12 +355,7 @@ class WebScrapeResponse(BaseModel):
364355
"""Images after content filters. Empty when none are found."""
365356

366357
json_: Json = FieldInfo(alias="json")
367-
"""Page data extracted into jsonParams.schema, after shared content filters.
368-
369-
Values are grounded in the page; optional fields the page does not state are
370-
omitted, or null when their type allows null. An empty object when the filters
371-
leave no text.
372-
"""
358+
"""Page data extracted using your schema."""
373359

374360
markdown: Markdown
375361
"""Markdown after content filters."""
@@ -381,7 +367,7 @@ class WebScrapeResponse(BaseModel):
381367
"""Fields produced by parseParams.rules, after shared content filters."""
382368

383369
product: Product
384-
"""Product detail page classification and the extracted product."""
370+
"""Product details found on the page."""
385371

386372
request_id: str
387373
"""Unique id of this API call, also sent in the X-Request-Id response header.

‎uv.lock‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)