Skip to content

Commit 7d9457b

Browse files
author
stlc-bot
committed
feat(search): /web/search - for news results extend description with matching passages from article.
Stainless-Generated-From: c8eb4fe
1 parent 7efb4e2 commit 7d9457b

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,6 +1023,7 @@ def search(
10231023
"zw",
10241024
]
10251025
| Omit = omit,
1026+
description_max_characters: Optional[int] | Omit = omit,
10261027
exclude_domains: SequenceNotStr[str] | Omit = omit,
10271028
freshness: Literal["last_24_hours", "last_week", "last_month", "last_year"] | Omit = omit,
10281029
highlights_options: Optional[web_search_params.HighlightsOptions] | Omit = omit,
@@ -1051,6 +1052,8 @@ def search(
10511052
country: Two-letter ISO 3166-1 alpha-2 country code to localize results to a specific
10521053
country (maps to Google's `gl` parameter). Example: "us", "gb", "de".
10531054
1055+
description_max_characters: Maximum length of each result's `description`, in characters.
1056+
10541057
exclude_domains:
10551058
Blocklist — drop results from these domains. Up to 100 domains. Example:
10561059
["pinterest.com", "reddit.com"].
@@ -1091,6 +1094,7 @@ def search(
10911094
{
10921095
"query": query,
10931096
"country": country,
1097+
"description_max_characters": description_max_characters,
10941098
"exclude_domains": exclude_domains,
10951099
"freshness": freshness,
10961100
"highlights_options": highlights_options,
@@ -2431,6 +2435,7 @@ async def search(
24312435
"zw",
24322436
]
24332437
| Omit = omit,
2438+
description_max_characters: Optional[int] | Omit = omit,
24342439
exclude_domains: SequenceNotStr[str] | Omit = omit,
24352440
freshness: Literal["last_24_hours", "last_week", "last_month", "last_year"] | Omit = omit,
24362441
highlights_options: Optional[web_search_params.HighlightsOptions] | Omit = omit,
@@ -2459,6 +2464,8 @@ async def search(
24592464
country: Two-letter ISO 3166-1 alpha-2 country code to localize results to a specific
24602465
country (maps to Google's `gl` parameter). Example: "us", "gb", "de".
24612466
2467+
description_max_characters: Maximum length of each result's `description`, in characters.
2468+
24622469
exclude_domains:
24632470
Blocklist — drop results from these domains. Up to 100 domains. Example:
24642471
["pinterest.com", "reddit.com"].
@@ -2499,6 +2506,7 @@ async def search(
24992506
{
25002507
"query": query,
25012508
"country": country,
2509+
"description_max_characters": description_max_characters,
25022510
"exclude_domains": exclude_domains,
25032511
"freshness": freshness,
25042512
"highlights_options": highlights_options,

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,9 @@ class WebSearchParams(TypedDict, total=False):
272272
country (maps to Google's `gl` parameter). Example: "us", "gb", "de".
273273
"""
274274

275+
description_max_characters: Annotated[Optional[int], PropertyInfo(alias="descriptionMaxCharacters")]
276+
"""Maximum length of each result's `description`, in characters."""
277+
275278
exclude_domains: Annotated[SequenceNotStr[str], PropertyInfo(alias="excludeDomains")]
276279
"""Blocklist — drop results from these domains.
277280

‎tests/api_resources/test_web.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@ def test_method_search_with_all_params(self, client: ContextDev) -> None:
428428
web = client.web.search(
429429
query="Stripe API authentication",
430430
country="af",
431+
description_max_characters=0,
431432
exclude_domains=["xxx"],
432433
freshness="last_24_hours",
433434
highlights_options={
@@ -969,6 +970,7 @@ async def test_method_search_with_all_params(self, async_client: AsyncContextDev
969970
web = await async_client.web.search(
970971
query="Stripe API authentication",
971972
country="af",
973+
description_max_characters=0,
972974
exclude_domains=["xxx"],
973975
freshness="last_24_hours",
974976
highlights_options={

0 commit comments

Comments
 (0)