diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 0746cbe..e6eadb4 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.12.0" + ".": "2.13.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index ad6cd80..9aabd7d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 41 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-2c3f4e4b357ca78c019a3aacd006e2bb8b332d4172a300ee6c46c076a216ed3f.yml -openapi_spec_hash: b89be415cf6ee594b521885a9deb25ac +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-dc61df29e1b6282f9df685fadd65f3683afe352deccae94d0c080092e0eae4b3.yml +openapi_spec_hash: 258caa98cd0de5f7149f6937d071c912 config_hash: 0fb0ceca5946298c416cec0cca5260c7 diff --git a/CHANGELOG.md b/CHANGELOG.md index ffa6a2e..334ee14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 2.13.0 (2026-08-27) + +Full Changelog: [v2.12.0...v2.13.0](https://github.com/context-dot-dev/context-python-sdk/compare/v2.12.0...v2.13.0) + +### Features + +* **api:** api update ([7d3e630](https://github.com/context-dot-dev/context-python-sdk/commit/7d3e630c9a18cc3508700a7706860f9d12ae4a84)) +* **api:** api update ([8a39a9f](https://github.com/context-dot-dev/context-python-sdk/commit/8a39a9f2b311acbd83fea47ac812f8d9c65eb6c5)) + ## 2.12.0 (2026-08-23) Full Changelog: [v2.11.0...v2.12.0](https://github.com/context-dot-dev/context-python-sdk/compare/v2.11.0...v2.12.0) diff --git a/README.md b/README.md index 04149d0..24a3e92 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ brand = client.brand.retrieve( domain="REPLACE_ME", type="by_domain", ) -print(brand.brand) +print(brand.cache_metadata) ``` While you can provide an `api_key` keyword argument, @@ -72,7 +72,7 @@ async def main() -> None: domain="REPLACE_ME", type="by_domain", ) - print(brand.brand) + print(brand.cache_metadata) asyncio.run(main()) @@ -109,7 +109,7 @@ async def main() -> None: domain="REPLACE_ME", type="by_domain", ) - print(brand.brand) + print(brand.cache_metadata) asyncio.run(main()) @@ -279,7 +279,7 @@ response = client.brand.with_raw_response.retrieve( print(response.headers.get('X-My-Header')) brand = response.parse() # get the object that `brand.retrieve()` would have returned -print(brand.brand) +print(brand.cache_metadata) ``` These methods return an [`APIResponse`](https://github.com/context-dot-dev/context-python-sdk/tree/main/src/context/dev/_response.py) object. diff --git a/pyproject.toml b/pyproject.toml index 46d9234..c52a7d9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "context.dev" -version = "2.12.0" +version = "2.13.0" description = "The official Python library for the context.dev API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/context/dev/_version.py b/src/context/dev/_version.py index aaa4b1d..0392824 100644 --- a/src/context/dev/_version.py +++ b/src/context/dev/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "context.dev" -__version__ = "2.12.0" # x-release-please-version +__version__ = "2.13.0" # x-release-please-version diff --git a/src/context/dev/types/ai_extract_product_response.py b/src/context/dev/types/ai_extract_product_response.py index 24c2ce1..8470b4f 100644 --- a/src/context/dev/types/ai_extract_product_response.py +++ b/src/context/dev/types/ai_extract_product_response.py @@ -5,7 +5,23 @@ from .._models import BaseModel -__all__ = ["AIExtractProductResponse", "KeyMetadata", "Product"] +__all__ = ["AIExtractProductResponse", "CacheMetadata", "KeyMetadata", "Product"] + + +class CacheMetadata(BaseModel): + """Cache outcome for this response. + + Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + """ + + age_ms: int + """Age of the cached data in milliseconds. Zero for miss and zdr responses.""" + + status: Literal["hit", "miss", "zdr"] + """ + Whether the response was served from cache, required fresh work, or honored + zero-data-retention cache bypass. + """ class KeyMetadata(BaseModel): @@ -83,6 +99,13 @@ class Product(BaseModel): class AIExtractProductResponse(BaseModel): + cache_metadata: CacheMetadata + """Cache outcome for this response. + + Composite responses are hits only when every cache-controlled fetch contributing + to the output was a hit; age_ms is the oldest contributing hit. + """ + is_product_page: Optional[bool] = None """Whether the given URL is a product detail page""" diff --git a/src/context/dev/types/ai_extract_products_response.py b/src/context/dev/types/ai_extract_products_response.py index 89d78f2..c09a742 100644 --- a/src/context/dev/types/ai_extract_products_response.py +++ b/src/context/dev/types/ai_extract_products_response.py @@ -5,7 +5,23 @@ from .._models import BaseModel -__all__ = ["AIExtractProductsResponse", "KeyMetadata", "Product"] +__all__ = ["AIExtractProductsResponse", "CacheMetadata", "KeyMetadata", "Product"] + + +class CacheMetadata(BaseModel): + """Cache outcome for this response. + + Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + """ + + age_ms: int + """Age of the cached data in milliseconds. Zero for miss and zdr responses.""" + + status: Literal["hit", "miss", "zdr"] + """ + Whether the response was served from cache, required fresh work, or honored + zero-data-retention cache bypass. + """ class KeyMetadata(BaseModel): @@ -81,6 +97,13 @@ class Product(BaseModel): class AIExtractProductsResponse(BaseModel): + cache_metadata: CacheMetadata + """Cache outcome for this response. + + Composite responses are hits only when every cache-controlled fetch contributing + to the output was a hit; age_ms is the oldest contributing hit. + """ + key_metadata: Optional[KeyMetadata] = None """Metadata about the API key used for the request. diff --git a/src/context/dev/types/batch_get_results_response.py b/src/context/dev/types/batch_get_results_response.py index b8e6905..4b82e1d 100644 --- a/src/context/dev/types/batch_get_results_response.py +++ b/src/context/dev/types/batch_get_results_response.py @@ -12,6 +12,7 @@ "BatchGetResultsResponse", "Data", "DataOk", + "DataOkCacheMetadata", "DataOkMetadata", "DataOkMetadataAlternate", "DataOkMetadataHeading", @@ -20,6 +21,22 @@ ] +class DataOkCacheMetadata(BaseModel): + """Cache outcome for this response. + + Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + """ + + age_ms: int + """Age of the cached data in milliseconds. Zero for miss and zdr responses.""" + + status: Literal["hit", "miss", "zdr"] + """ + Whether the response was served from cache, required fresh work, or honored + zero-data-retention cache bypass. + """ + + class DataOkMetadataAlternate(BaseModel): href: str """Resolved alternate URL.""" @@ -115,6 +132,13 @@ class DataOkMetadata(BaseModel): class DataOk(BaseModel): """A page the batch fetched successfully.""" + cache_metadata: DataOkCacheMetadata + """Cache outcome for this response. + + Composite responses are hits only when every cache-controlled fetch contributing + to the output was a hit; age_ms is the oldest contributing hit. + """ + final_url: str """URL the content was read from, after redirects.""" diff --git a/src/context/dev/types/batch_submit_response.py b/src/context/dev/types/batch_submit_response.py index 89be81d..624cdce 100644 --- a/src/context/dev/types/batch_submit_response.py +++ b/src/context/dev/types/batch_submit_response.py @@ -7,7 +7,23 @@ from .._models import BaseModel from .crawl_controls import CrawlControls -__all__ = ["BatchSubmitResponse", "Credits", "InvalidURL", "KeyMetadata"] +__all__ = ["BatchSubmitResponse", "CacheMetadata", "Credits", "InvalidURL", "KeyMetadata"] + + +class CacheMetadata(BaseModel): + """Cache outcome for this response. + + Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + """ + + age_ms: int + """Age of the cached data in milliseconds. Zero for miss and zdr responses.""" + + status: Literal["hit", "miss", "zdr"] + """ + Whether the response was served from cache, required fresh work, or honored + zero-data-retention cache bypass. + """ class Credits(BaseModel): @@ -42,6 +58,13 @@ class BatchSubmitResponse(BaseModel): id: str """Batch ID. Poll GET /batch/{batch_id} with it.""" + cache_metadata: CacheMetadata + """Cache outcome for this response. + + Composite responses are hits only when every cache-controlled fetch contributing + to the output was a hit; age_ms is the oldest contributing hit. + """ + crawl: Optional[CrawlControls] = None """ The crawl controls as submitted, so the limits requested can be compared against diff --git a/src/context/dev/types/brand_retrieve_response.py b/src/context/dev/types/brand_retrieve_response.py index ef726c1..649c580 100644 --- a/src/context/dev/types/brand_retrieve_response.py +++ b/src/context/dev/types/brand_retrieve_response.py @@ -7,6 +7,7 @@ __all__ = [ "BrandRetrieveResponse", + "CacheMetadata", "Brand", "BrandAddress", "BrandBackdrop", @@ -26,6 +27,22 @@ ] +class CacheMetadata(BaseModel): + """Cache outcome for this response. + + Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + """ + + age_ms: int + """Age of the cached data in milliseconds. Zero for miss and zdr responses.""" + + status: Literal["hit", "miss", "zdr"] + """ + Whether the response was served from cache, required fresh work, or honored + zero-data-retention cache bypass. + """ + + class BrandAddress(BaseModel): """Physical address of the brand""" @@ -525,7 +542,11 @@ class Brand(BaseModel): """Important website links for the brand""" logos: Optional[List[BrandLogo]] = None - """An array of logos associated with the brand""" + """An array of logos associated with the brand. + + When a similarly shaped SVG variant exists, it is returned ahead of its raster + equivalent; otherwise relevance order is preserved + """ phone: Optional[str] = None """Company phone number""" @@ -686,6 +707,13 @@ class KeyMetadata(BaseModel): class BrandRetrieveResponse(BaseModel): + cache_metadata: CacheMetadata + """Cache outcome for this response. + + Composite responses are hits only when every cache-controlled fetch contributing + to the output was a hit; age_ms is the oldest contributing hit. + """ + brand: Optional[Brand] = None """Detailed brand information""" diff --git a/src/context/dev/types/brand_retrieve_simplified_response.py b/src/context/dev/types/brand_retrieve_simplified_response.py index ab750a4..ad4216d 100644 --- a/src/context/dev/types/brand_retrieve_simplified_response.py +++ b/src/context/dev/types/brand_retrieve_simplified_response.py @@ -7,6 +7,7 @@ __all__ = [ "BrandRetrieveSimplifiedResponse", + "CacheMetadata", "Brand", "BrandBackdrop", "BrandBackdropColor", @@ -19,6 +20,22 @@ ] +class CacheMetadata(BaseModel): + """Cache outcome for this response. + + Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + """ + + age_ms: int + """Age of the cached data in milliseconds. Zero for miss and zdr responses.""" + + status: Literal["hit", "miss", "zdr"] + """ + Whether the response was served from cache, required fresh work, or honored + zero-data-retention cache bypass. + """ + + class BrandBackdropColor(BaseModel): hex: Optional[str] = None """Color in hexadecimal format""" @@ -141,6 +158,13 @@ class KeyMetadata(BaseModel): class BrandRetrieveSimplifiedResponse(BaseModel): + cache_metadata: CacheMetadata + """Cache outcome for this response. + + Composite responses are hits only when every cache-controlled fetch contributing + to the output was a hit; age_ms is the oldest contributing hit. + """ + brand: Optional[Brand] = None """Simplified brand information""" diff --git a/src/context/dev/types/web_extract_fonts_response.py b/src/context/dev/types/web_extract_fonts_response.py index 4a1ec98..9cbfdbf 100644 --- a/src/context/dev/types/web_extract_fonts_response.py +++ b/src/context/dev/types/web_extract_fonts_response.py @@ -7,7 +7,23 @@ from .._models import BaseModel -__all__ = ["WebExtractFontsResponse", "Font", "FontLinks", "KeyMetadata"] +__all__ = ["WebExtractFontsResponse", "CacheMetadata", "Font", "FontLinks", "KeyMetadata"] + + +class CacheMetadata(BaseModel): + """Cache outcome for this response. + + Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + """ + + age_ms: int + """Age of the cached data in milliseconds. Zero for miss and zdr responses.""" + + status: Literal["hit", "miss", "zdr"] + """ + Whether the response was served from cache, required fresh work, or honored + zero-data-retention cache bypass. + """ class Font(BaseModel): @@ -71,6 +87,13 @@ class KeyMetadata(BaseModel): class WebExtractFontsResponse(BaseModel): + cache_metadata: CacheMetadata + """Cache outcome for this response. + + Composite responses are hits only when every cache-controlled fetch contributing + to the output was a hit; age_ms is the oldest contributing hit. + """ + code: int """HTTP status code, e.g., 200""" diff --git a/src/context/dev/types/web_extract_response.py b/src/context/dev/types/web_extract_response.py index ddae93a..8a7848c 100644 --- a/src/context/dev/types/web_extract_response.py +++ b/src/context/dev/types/web_extract_response.py @@ -7,7 +7,23 @@ from .._models import BaseModel -__all__ = ["WebExtractResponse", "Metadata", "MetadataActionsApplied", "KeyMetadata"] +__all__ = ["WebExtractResponse", "CacheMetadata", "Metadata", "MetadataActionsApplied", "KeyMetadata"] + + +class CacheMetadata(BaseModel): + """Cache outcome for this response. + + Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + """ + + age_ms: int + """Age of the cached data in milliseconds. Zero for miss and zdr responses.""" + + status: Literal["hit", "miss", "zdr"] + """ + Whether the response was served from cache, required fresh work, or honored + zero-data-retention cache bypass. + """ class MetadataActionsApplied(BaseModel): @@ -66,6 +82,13 @@ class KeyMetadata(BaseModel): class WebExtractResponse(BaseModel): + cache_metadata: CacheMetadata + """Cache outcome for this response. + + Composite responses are hits only when every cache-controlled fetch contributing + to the output was a hit; age_ms is the oldest contributing hit. + """ + data: Dict[str, object] """Extracted data matching the request schema""" diff --git a/src/context/dev/types/web_extract_styleguide_response.py b/src/context/dev/types/web_extract_styleguide_response.py index 4592dd9..e7e6104 100644 --- a/src/context/dev/types/web_extract_styleguide_response.py +++ b/src/context/dev/types/web_extract_styleguide_response.py @@ -9,6 +9,7 @@ __all__ = [ "WebExtractStyleguideResponse", + "CacheMetadata", "KeyMetadata", "Styleguide", "StyleguideColors", @@ -31,6 +32,22 @@ ] +class CacheMetadata(BaseModel): + """Cache outcome for this response. + + Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + """ + + age_ms: int + """Age of the cached data in milliseconds. Zero for miss and zdr responses.""" + + status: Literal["hit", "miss", "zdr"] + """ + Whether the response was served from cache, required fresh work, or honored + zero-data-retention cache bypass. + """ + + class KeyMetadata(BaseModel): """Metadata about the API key used for the request. @@ -428,6 +445,13 @@ class Styleguide(BaseModel): class WebExtractStyleguideResponse(BaseModel): + cache_metadata: CacheMetadata + """Cache outcome for this response. + + Composite responses are hits only when every cache-controlled fetch contributing + to the output was a hit; age_ms is the oldest contributing hit. + """ + code: Optional[int] = None """HTTP status code""" diff --git a/src/context/dev/types/web_screenshot_response.py b/src/context/dev/types/web_screenshot_response.py index b1f8504..7915153 100644 --- a/src/context/dev/types/web_screenshot_response.py +++ b/src/context/dev/types/web_screenshot_response.py @@ -7,7 +7,23 @@ from .._models import BaseModel -__all__ = ["WebScreenshotResponse", "KeyMetadata"] +__all__ = ["WebScreenshotResponse", "CacheMetadata", "KeyMetadata"] + + +class CacheMetadata(BaseModel): + """Cache outcome for this response. + + Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + """ + + age_ms: int + """Age of the cached data in milliseconds. Zero for miss and zdr responses.""" + + status: Literal["hit", "miss", "zdr"] + """ + Whether the response was served from cache, required fresh work, or honored + zero-data-retention cache bypass. + """ class KeyMetadata(BaseModel): @@ -24,6 +40,13 @@ class KeyMetadata(BaseModel): class WebScreenshotResponse(BaseModel): + cache_metadata: CacheMetadata + """Cache outcome for this response. + + Composite responses are hits only when every cache-controlled fetch contributing + to the output was a hit; age_ms is the oldest contributing hit. + """ + code: Optional[int] = None """HTTP status code""" diff --git a/src/context/dev/types/web_search_response.py b/src/context/dev/types/web_search_response.py index 3636c95..9e515dd 100644 --- a/src/context/dev/types/web_search_response.py +++ b/src/context/dev/types/web_search_response.py @@ -5,7 +5,23 @@ from .._models import BaseModel -__all__ = ["WebSearchResponse", "Result", "ResultMarkdown", "KeyMetadata"] +__all__ = ["WebSearchResponse", "CacheMetadata", "Result", "ResultMarkdown", "KeyMetadata"] + + +class CacheMetadata(BaseModel): + """Cache outcome for this response. + + Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + """ + + age_ms: int + """Age of the cached data in milliseconds. Zero for miss and zdr responses.""" + + status: Literal["hit", "miss", "zdr"] + """ + Whether the response was served from cache, required fresh work, or honored + zero-data-retention cache bypass. + """ class ResultMarkdown(BaseModel): @@ -52,6 +68,13 @@ class KeyMetadata(BaseModel): class WebSearchResponse(BaseModel): + cache_metadata: CacheMetadata + """Cache outcome for this response. + + Composite responses are hits only when every cache-controlled fetch contributing + to the output was a hit; age_ms is the oldest contributing hit. + """ + query: str """Echo of the original query (useful when fanout was enabled).""" diff --git a/src/context/dev/types/web_web_crawl_md_response.py b/src/context/dev/types/web_web_crawl_md_response.py index 6218a6c..5692a44 100644 --- a/src/context/dev/types/web_web_crawl_md_response.py +++ b/src/context/dev/types/web_web_crawl_md_response.py @@ -1,6 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Dict, List, Union, Optional +from typing_extensions import Literal from pydantic import Field as FieldInfo @@ -8,6 +9,7 @@ __all__ = [ "WebWebCrawlMdResponse", + "CacheMetadata", "Metadata", "Result", "ResultMetadata", @@ -17,6 +19,22 @@ ] +class CacheMetadata(BaseModel): + """Cache outcome for this response. + + Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + """ + + age_ms: int + """Age of the cached data in milliseconds. Zero for miss and zdr responses.""" + + status: Literal["hit", "miss", "zdr"] + """ + Whether the response was served from cache, required fresh work, or honored + zero-data-retention cache bypass. + """ + + class Metadata(BaseModel): max_crawl_depth: int = FieldInfo(alias="maxCrawlDepth") """Maximum crawl depth reached during the crawl""" @@ -160,6 +178,13 @@ class KeyMetadata(BaseModel): class WebWebCrawlMdResponse(BaseModel): + cache_metadata: CacheMetadata + """Cache outcome for this response. + + Composite responses are hits only when every cache-controlled fetch contributing + to the output was a hit; age_ms is the oldest contributing hit. + """ + metadata: Metadata results: List[Result] diff --git a/src/context/dev/types/web_web_scrape_html_response.py b/src/context/dev/types/web_web_scrape_html_response.py index 2d92bc7..c46463b 100644 --- a/src/context/dev/types/web_web_scrape_html_response.py +++ b/src/context/dev/types/web_web_scrape_html_response.py @@ -9,6 +9,7 @@ __all__ = [ "WebWebScrapeHTMLResponse", + "CacheMetadata", "Metadata", "MetadataAlternate", "MetadataHeading", @@ -17,6 +18,22 @@ ] +class CacheMetadata(BaseModel): + """Cache outcome for this response. + + Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + """ + + age_ms: int + """Age of the cached data in milliseconds. Zero for miss and zdr responses.""" + + status: Literal["hit", "miss", "zdr"] + """ + Whether the response was served from cache, required fresh work, or honored + zero-data-retention cache bypass. + """ + + class MetadataAlternate(BaseModel): href: str """Resolved alternate URL.""" @@ -144,6 +161,13 @@ class KeyMetadata(BaseModel): class WebWebScrapeHTMLResponse(BaseModel): + cache_metadata: CacheMetadata + """Cache outcome for this response. + + Composite responses are hits only when every cache-controlled fetch contributing + to the output was a hit; age_ms is the oldest contributing hit. + """ + html: str """The scraped content of the page. diff --git a/src/context/dev/types/web_web_scrape_images_response.py b/src/context/dev/types/web_web_scrape_images_response.py index 3e432cf..fb3ced9 100644 --- a/src/context/dev/types/web_web_scrape_images_response.py +++ b/src/context/dev/types/web_web_scrape_images_response.py @@ -7,7 +7,23 @@ from .._models import BaseModel -__all__ = ["WebWebScrapeImagesResponse", "Image", "ImageEnrichment", "ActionsApplied", "KeyMetadata"] +__all__ = ["WebWebScrapeImagesResponse", "CacheMetadata", "Image", "ImageEnrichment", "ActionsApplied", "KeyMetadata"] + + +class CacheMetadata(BaseModel): + """Cache outcome for this response. + + Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + """ + + age_ms: int + """Age of the cached data in milliseconds. Zero for miss and zdr responses.""" + + status: Literal["hit", "miss", "zdr"] + """ + Whether the response was served from cache, required fresh work, or honored + zero-data-retention cache bypass. + """ class ImageEnrichment(BaseModel): @@ -83,6 +99,13 @@ class KeyMetadata(BaseModel): class WebWebScrapeImagesResponse(BaseModel): + cache_metadata: CacheMetadata + """Cache outcome for this response. + + Composite responses are hits only when every cache-controlled fetch contributing + to the output was a hit; age_ms is the oldest contributing hit. + """ + images: List[Image] """Images found on the page.""" diff --git a/src/context/dev/types/web_web_scrape_md_response.py b/src/context/dev/types/web_web_scrape_md_response.py index 2ea9747..0d2bc5d 100644 --- a/src/context/dev/types/web_web_scrape_md_response.py +++ b/src/context/dev/types/web_web_scrape_md_response.py @@ -9,6 +9,7 @@ __all__ = [ "WebWebScrapeMdResponse", + "CacheMetadata", "Metadata", "MetadataAlternate", "MetadataHeading", @@ -17,6 +18,22 @@ ] +class CacheMetadata(BaseModel): + """Cache outcome for this response. + + Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + """ + + age_ms: int + """Age of the cached data in milliseconds. Zero for miss and zdr responses.""" + + status: Literal["hit", "miss", "zdr"] + """ + Whether the response was served from cache, required fresh work, or honored + zero-data-retention cache bypass. + """ + + class MetadataAlternate(BaseModel): href: str """Resolved alternate URL.""" @@ -144,6 +161,13 @@ class KeyMetadata(BaseModel): class WebWebScrapeMdResponse(BaseModel): + cache_metadata: CacheMetadata + """Cache outcome for this response. + + Composite responses are hits only when every cache-controlled fetch contributing + to the output was a hit; age_ms is the oldest contributing hit. + """ + content_length: int = FieldInfo(alias="contentLength") """UTF-8 byte length of the returned Markdown.