Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.22.1"
".": "0.23.0"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-c4e3d32c831ceda41c21a08b227addc6969457f9b2824f5afb4297d81ce6b379.yml
openapi_spec_hash: 8e825842065c24f11fd3f51fdd705337
config_hash: 70354330f92ce169beabc98696ebb9a3
configured_endpoints: 23
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-24aa0941b29bf383cfb7dfb8cafd75999346bffb07b33738a89c3c9bbeb798a9.yml
openapi_spec_hash: 5530a1589a20c8c337e7f6ebaaa0aecb
config_hash: f481fca4de4b1657023180d4fc47ef22
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 0.23.0 (2026-05-16)

Full Changelog: [v0.22.1...v0.23.0](https://github.com/context-dot-dev/context-python-sdk/compare/v0.22.1...v0.23.0)

### Features

* **api:** manual updates ([bce4c91](https://github.com/context-dot-dev/context-python-sdk/commit/bce4c91688d28054c361ee403be2333229a33f41))

## 0.22.1 (2026-05-13)

Full Changelog: [v0.22.0...v0.22.1](https://github.com/context-dot-dev/context-python-sdk/compare/v0.22.0...v0.22.1)
Expand Down
2 changes: 2 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ from context.dev.types import (
WebExtractFontsResponse,
WebExtractStyleguideResponse,
WebScreenshotResponse,
WebSearchResponse,
WebWebCrawlMdResponse,
WebWebScrapeHTMLResponse,
WebWebScrapeImagesResponse,
Expand All @@ -20,6 +21,7 @@ Methods:
- <code title="get /web/fonts">client.web.<a href="./src/context/dev/resources/web.py">extract_fonts</a>(\*\*<a href="src/context/dev/types/web_extract_fonts_params.py">params</a>) -> <a href="./src/context/dev/types/web_extract_fonts_response.py">WebExtractFontsResponse</a></code>
- <code title="get /web/styleguide">client.web.<a href="./src/context/dev/resources/web.py">extract_styleguide</a>(\*\*<a href="src/context/dev/types/web_extract_styleguide_params.py">params</a>) -> <a href="./src/context/dev/types/web_extract_styleguide_response.py">WebExtractStyleguideResponse</a></code>
- <code title="get /web/screenshot">client.web.<a href="./src/context/dev/resources/web.py">screenshot</a>(\*\*<a href="src/context/dev/types/web_screenshot_params.py">params</a>) -> <a href="./src/context/dev/types/web_screenshot_response.py">WebScreenshotResponse</a></code>
- <code title="post /web/search">client.web.<a href="./src/context/dev/resources/web.py">search</a>(\*\*<a href="src/context/dev/types/web_search_params.py">params</a>) -> <a href="./src/context/dev/types/web_search_response.py">WebSearchResponse</a></code>
- <code title="post /web/crawl">client.web.<a href="./src/context/dev/resources/web.py">web_crawl_md</a>(\*\*<a href="src/context/dev/types/web_web_crawl_md_params.py">params</a>) -> <a href="./src/context/dev/types/web_web_crawl_md_response.py">WebWebCrawlMdResponse</a></code>
- <code title="get /web/scrape/html">client.web.<a href="./src/context/dev/resources/web.py">web_scrape_html</a>(\*\*<a href="src/context/dev/types/web_web_scrape_html_params.py">params</a>) -> <a href="./src/context/dev/types/web_web_scrape_html_response.py">WebWebScrapeHTMLResponse</a></code>
- <code title="get /web/scrape/images">client.web.<a href="./src/context/dev/resources/web.py">web_scrape_images</a>(\*\*<a href="src/context/dev/types/web_web_scrape_images_params.py">params</a>) -> <a href="./src/context/dev/types/web_web_scrape_images_response.py">WebWebScrapeImagesResponse</a></code>
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "context.dev"
version = "0.22.1"
version = "0.23.0"
description = "The official Python library for the context.dev API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion src/context/dev/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "context.dev"
__version__ = "0.22.1" # x-release-please-version
__version__ = "0.23.0" # x-release-please-version
150 changes: 149 additions & 1 deletion src/context/dev/resources/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import httpx

from ..types import (
web_search_params,
web_screenshot_params,
web_web_crawl_md_params,
web_extract_fonts_params,
Expand All @@ -16,7 +17,7 @@
web_extract_styleguide_params,
web_web_scrape_sitemap_params,
)
from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
from .._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
from .._utils import maybe_transform, async_maybe_transform
from .._compat import cached_property
from .._resource import SyncAPIResource, AsyncAPIResource
Expand All @@ -27,6 +28,7 @@
async_to_streamed_response_wrapper,
)
from .._base_client import make_request_options
from ..types.web_search_response import WebSearchResponse
from ..types.web_screenshot_response import WebScreenshotResponse
from ..types.web_web_crawl_md_response import WebWebCrawlMdResponse
from ..types.web_extract_fonts_response import WebExtractFontsResponse
Expand Down Expand Up @@ -266,6 +268,73 @@ def screenshot(
cast_to=WebScreenshotResponse,
)

def search(
self,
*,
query: str,
exclude_domains: SequenceNotStr[str] | Omit = omit,
freshness: Literal["last_24_hours", "last_week", "last_month", "last_year"] | Omit = omit,
include_domains: SequenceNotStr[str] | Omit = omit,
markdown_options: web_search_params.MarkdownOptions | Omit = omit,
query_fanout: bool | Omit = omit,
timeout_ms: int | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> WebSearchResponse:
"""
Search the web and optionally scrape each result to Markdown in one round-trip.

Args:
query: Natural-language search query.

exclude_domains: Blocklist — drop results from these domains. Example: ["pinterest.com",
"reddit.com"].

freshness: Restrict results to content published within this window.

include_domains: Allowlist — only return results from these domains. Example: ["arxiv.org",
"github.com"].

markdown_options: Inline Markdown scraping for each result. Set `enabled: true` to activate.

query_fanout: Expand the query into multiple parallel variants for broader recall.

timeout_ms: Optional timeout in milliseconds for the request. If the request takes longer
than this value, it will be aborted with a 408 status code. Maximum allowed
value is 300000ms (5 minutes).

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
return self._post(
"/web/search",
body=maybe_transform(
{
"query": query,
"exclude_domains": exclude_domains,
"freshness": freshness,
"include_domains": include_domains,
"markdown_options": markdown_options,
"query_fanout": query_fanout,
"timeout_ms": timeout_ms,
},
web_search_params.WebSearchParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=WebSearchResponse,
)

def web_crawl_md(
self,
*,
Expand Down Expand Up @@ -882,6 +951,73 @@ async def screenshot(
cast_to=WebScreenshotResponse,
)

async def search(
self,
*,
query: str,
exclude_domains: SequenceNotStr[str] | Omit = omit,
freshness: Literal["last_24_hours", "last_week", "last_month", "last_year"] | Omit = omit,
include_domains: SequenceNotStr[str] | Omit = omit,
markdown_options: web_search_params.MarkdownOptions | Omit = omit,
query_fanout: bool | Omit = omit,
timeout_ms: int | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> WebSearchResponse:
"""
Search the web and optionally scrape each result to Markdown in one round-trip.

Args:
query: Natural-language search query.

exclude_domains: Blocklist — drop results from these domains. Example: ["pinterest.com",
"reddit.com"].

freshness: Restrict results to content published within this window.

include_domains: Allowlist — only return results from these domains. Example: ["arxiv.org",
"github.com"].

markdown_options: Inline Markdown scraping for each result. Set `enabled: true` to activate.

query_fanout: Expand the query into multiple parallel variants for broader recall.

timeout_ms: Optional timeout in milliseconds for the request. If the request takes longer
than this value, it will be aborted with a 408 status code. Maximum allowed
value is 300000ms (5 minutes).

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
return await self._post(
"/web/search",
body=await async_maybe_transform(
{
"query": query,
"exclude_domains": exclude_domains,
"freshness": freshness,
"include_domains": include_domains,
"markdown_options": markdown_options,
"query_fanout": query_fanout,
"timeout_ms": timeout_ms,
},
web_search_params.WebSearchParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=WebSearchResponse,
)

async def web_crawl_md(
self,
*,
Expand Down Expand Up @@ -1284,6 +1420,9 @@ def __init__(self, web: WebResource) -> None:
self.screenshot = to_raw_response_wrapper(
web.screenshot,
)
self.search = to_raw_response_wrapper(
web.search,
)
self.web_crawl_md = to_raw_response_wrapper(
web.web_crawl_md,
)
Expand Down Expand Up @@ -1314,6 +1453,9 @@ def __init__(self, web: AsyncWebResource) -> None:
self.screenshot = async_to_raw_response_wrapper(
web.screenshot,
)
self.search = async_to_raw_response_wrapper(
web.search,
)
self.web_crawl_md = async_to_raw_response_wrapper(
web.web_crawl_md,
)
Expand Down Expand Up @@ -1344,6 +1486,9 @@ def __init__(self, web: WebResource) -> None:
self.screenshot = to_streamed_response_wrapper(
web.screenshot,
)
self.search = to_streamed_response_wrapper(
web.search,
)
self.web_crawl_md = to_streamed_response_wrapper(
web.web_crawl_md,
)
Expand Down Expand Up @@ -1374,6 +1519,9 @@ def __init__(self, web: AsyncWebResource) -> None:
self.screenshot = async_to_streamed_response_wrapper(
web.screenshot,
)
self.search = async_to_streamed_response_wrapper(
web.search,
)
self.web_crawl_md = async_to_streamed_response_wrapper(
web.web_crawl_md,
)
Expand Down
2 changes: 2 additions & 0 deletions src/context/dev/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

from __future__ import annotations

from .web_search_params import WebSearchParams as WebSearchParams
from .ai_ai_query_params import AIAIQueryParams as AIAIQueryParams
from .web_search_response import WebSearchResponse as WebSearchResponse
from .ai_ai_query_response import AIAIQueryResponse as AIAIQueryResponse
from .brand_retrieve_params import BrandRetrieveParams as BrandRetrieveParams
from .web_screenshot_params import WebScreenshotParams as WebScreenshotParams
Expand Down
103 changes: 103 additions & 0 deletions src/context/dev/types/web_search_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing_extensions import Literal, Required, Annotated, TypedDict

from .._types import SequenceNotStr
from .._utils import PropertyInfo

__all__ = ["WebSearchParams", "MarkdownOptions", "MarkdownOptionsPdf"]


class WebSearchParams(TypedDict, total=False):
query: Required[str]
"""Natural-language search query."""

exclude_domains: Annotated[SequenceNotStr[str], PropertyInfo(alias="excludeDomains")]
"""Blocklist — drop results from these domains.

Example: ["pinterest.com", "reddit.com"].
"""

freshness: Literal["last_24_hours", "last_week", "last_month", "last_year"]
"""Restrict results to content published within this window."""

include_domains: Annotated[SequenceNotStr[str], PropertyInfo(alias="includeDomains")]
"""Allowlist — only return results from these domains.

Example: ["arxiv.org", "github.com"].
"""

markdown_options: Annotated[MarkdownOptions, PropertyInfo(alias="markdownOptions")]
"""Inline Markdown scraping for each result. Set `enabled: true` to activate."""

query_fanout: Annotated[bool, PropertyInfo(alias="queryFanout")]
"""Expand the query into multiple parallel variants for broader recall."""

timeout_ms: Annotated[int, PropertyInfo(alias="timeoutMS")]
"""Optional timeout in milliseconds for the request.

If the request takes longer than this value, it will be aborted with a 408
status code. Maximum allowed value is 300000ms (5 minutes).
"""


class MarkdownOptionsPdf(TypedDict, total=False):
"""PDF handling. Use start/end to bound text extraction and OCR to a page range."""

end: int
"""Last PDF page to parse (1-based, inclusive).

Defaults to the final page. Must be >= start.
"""

should_parse: Annotated[bool, PropertyInfo(alias="shouldParse")]
"""Parse PDF URLs. When false, PDF results are skipped with WEBSITE_ACCESS_ERROR."""

start: int
"""First PDF page to parse (1-based, inclusive). Defaults to page 1."""


class MarkdownOptions(TypedDict, total=False):
"""Inline Markdown scraping for each result. Set `enabled: true` to activate."""

enabled: bool
"""Scrape each result to Markdown. Off by default to keep search cheap and fast."""

include_frames: Annotated[bool, PropertyInfo(alias="includeFrames")]
"""Render iframe contents into the Markdown."""

include_images: Annotated[bool, PropertyInfo(alias="includeImages")]
"""Emit image references in the Markdown."""

include_links: Annotated[bool, PropertyInfo(alias="includeLinks")]
"""Keep hyperlinks in the Markdown."""

max_age_ms: Annotated[int, PropertyInfo(alias="maxAgeMs")]
"""Cache TTL in ms for scraped Markdown keyed by URL + options.

Default 1 day, max 30 days. Set to 0 to force a fresh scrape.
"""

pdf: MarkdownOptionsPdf
"""PDF handling. Use start/end to bound text extraction and OCR to a page range."""

shorten_base64_images: Annotated[bool, PropertyInfo(alias="shortenBase64Images")]
"""Truncate inline base64 image payloads to keep responses small."""

timeout_ms: Annotated[int, PropertyInfo(alias="timeoutMS")]
"""Optional timeout in milliseconds for the request.

If the request takes longer than this value, it will be aborted with a 408
status code. Maximum allowed value is 300000ms (5 minutes).
"""

use_main_content_only: Annotated[bool, PropertyInfo(alias="useMainContentOnly")]
"""Strip nav, header, footer, and sidebar — keep only the primary article content."""

wait_for_ms: Annotated[int, PropertyInfo(alias="waitForMs")]
"""Extra wait after page load before rendering, in ms (0–30000).

Useful for JS-heavy pages.
"""
Loading
Loading