diff --git a/.release-please-manifest.json b/.release-please-manifest.json index bc845f32..6a197bef 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.16.0" + ".": "1.17.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 7f12b687..8baafcff 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 22 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-d880c25aee159e1260e23dfa3685b1bb9e35b02a1927adecbff32664ba8e11a4.yml -openapi_spec_hash: aa96a6030390bca0b4cdfa2363961807 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-18e7692e180f911962f33787228afa2cf31f6c05ab23c6afb1ca4f82b108fba5.yml +openapi_spec_hash: 865bd1e346267d1e33f8ca63963c6aa3 config_hash: 70354330f92ce169beabc98696ebb9a3 diff --git a/CHANGELOG.md b/CHANGELOG.md index 75f2ccbe..c66d4af6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 1.17.0 (2026-05-09) + +Full Changelog: [v1.16.0...v1.17.0](https://github.com/context-dot-dev/context-ruby-sdk/compare/v1.16.0...v1.17.0) + +### Features + +* **api:** api update ([ae638b0](https://github.com/context-dot-dev/context-ruby-sdk/commit/ae638b04d0e08bf93e2cdd1211236d841d5313b1)) +* **api:** api update ([8376344](https://github.com/context-dot-dev/context-ruby-sdk/commit/8376344a7a72a7ff01906bc3d6a5913a4de60bcb)) + ## 1.16.0 (2026-05-07) Full Changelog: [v1.15.0...v1.16.0](https://github.com/context-dot-dev/context-ruby-sdk/compare/v1.15.0...v1.16.0) diff --git a/Gemfile.lock b/Gemfile.lock index 8a267339..0ed99eac 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GIT PATH remote: . specs: - context.dev (1.16.0) + context.dev (1.17.0) cgi connection_pool diff --git a/README.md b/README.md index 41bd0a02..c4242d0e 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ To use this gem, install via Bundler by adding the following to your application ```ruby -gem "context.dev", "~> 1.16.0" +gem "context.dev", "~> 1.17.0" ``` diff --git a/lib/context_dev/models/ai_extract_product_params.rb b/lib/context_dev/models/ai_extract_product_params.rb index 364bb703..8baeb3cb 100644 --- a/lib/context_dev/models/ai_extract_product_params.rb +++ b/lib/context_dev/models/ai_extract_product_params.rb @@ -22,8 +22,9 @@ class AIExtractProductParams < ContextDev::Internal::Type::BaseModel optional :max_age_ms, Integer, api_name: :maxAgeMs # @!attribute timeout_ms - # Optional timeout in milliseconds for the request. Maximum allowed value is - # 300000ms (5 minutes). + # 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). # # @return [Integer, nil] optional :timeout_ms, Integer, api_name: :timeoutMS @@ -36,7 +37,7 @@ class AIExtractProductParams < ContextDev::Internal::Type::BaseModel # # @param max_age_ms [Integer] Return a cached result if a prior scrape for the same parameters exists and is y # - # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. Maximum allowed value is 30000 + # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th # # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}] end diff --git a/lib/context_dev/models/ai_extract_products_params.rb b/lib/context_dev/models/ai_extract_products_params.rb index 7594ddba..592a101a 100644 --- a/lib/context_dev/models/ai_extract_products_params.rb +++ b/lib/context_dev/models/ai_extract_products_params.rb @@ -45,8 +45,9 @@ class ByDomain < ContextDev::Internal::Type::BaseModel optional :max_products, Integer, api_name: :maxProducts # @!attribute timeout_ms - # Optional timeout in milliseconds for the request. Maximum allowed value is - # 300000ms (5 minutes). + # 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). # # @return [Integer, nil] optional :timeout_ms, Integer, api_name: :timeoutMS @@ -61,7 +62,7 @@ class ByDomain < ContextDev::Internal::Type::BaseModel # # @param max_products [Integer] Maximum number of products to extract. # - # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. Maximum allowed value is 30000 + # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th end class ByDirectURL < ContextDev::Internal::Type::BaseModel @@ -87,8 +88,9 @@ class ByDirectURL < ContextDev::Internal::Type::BaseModel optional :max_products, Integer, api_name: :maxProducts # @!attribute timeout_ms - # Optional timeout in milliseconds for the request. Maximum allowed value is - # 300000ms (5 minutes). + # 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). # # @return [Integer, nil] optional :timeout_ms, Integer, api_name: :timeoutMS @@ -104,7 +106,7 @@ class ByDirectURL < ContextDev::Internal::Type::BaseModel # # @param max_products [Integer] Maximum number of products to extract. # - # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. Maximum allowed value is 30000 + # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th end # @!method self.variants diff --git a/lib/context_dev/models/web_screenshot_params.rb b/lib/context_dev/models/web_screenshot_params.rb index 661953af..29945e5d 100644 --- a/lib/context_dev/models/web_screenshot_params.rb +++ b/lib/context_dev/models/web_screenshot_params.rb @@ -49,13 +49,13 @@ class WebScreenshotParams < ContextDev::Internal::Type::BaseModel # @return [Symbol, ContextDev::Models::WebScreenshotParams::Page, nil] optional :page, enum: -> { ContextDev::WebScreenshotParams::Page } - # @!attribute prioritize - # Optional parameter to prioritize screenshot capture. If 'speed', optimizes for - # faster capture with basic quality. If 'quality', optimizes for higher quality - # with longer wait times. Defaults to 'quality' if not provided. + # @!attribute 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). # - # @return [Symbol, ContextDev::Models::WebScreenshotParams::Prioritize, nil] - optional :prioritize, enum: -> { ContextDev::WebScreenshotParams::Prioritize } + # @return [Integer, nil] + optional :timeout_ms, Integer # @!attribute viewport # Optional browser viewport dimensions for the screenshot. Defaults to 1920x1080. @@ -63,7 +63,15 @@ class WebScreenshotParams < ContextDev::Internal::Type::BaseModel # @return [ContextDev::Models::WebScreenshotParams::Viewport, nil] optional :viewport, -> { ContextDev::WebScreenshotParams::Viewport } - # @!method initialize(direct_url: nil, domain: nil, full_screenshot: nil, max_age_ms: nil, page: nil, prioritize: nil, viewport: nil, request_options: {}) + # @!attribute wait_for_ms + # Optional browser wait time in milliseconds after initial page load before taking + # the screenshot. Min: 0. Max: 30000 (30 seconds). Defaults to 3000 ms when + # omitted. + # + # @return [Integer, nil] + optional :wait_for_ms, Integer + + # @!method initialize(direct_url: nil, domain: nil, full_screenshot: nil, max_age_ms: nil, page: nil, timeout_ms: nil, viewport: nil, wait_for_ms: nil, request_options: {}) # Some parameter documentations has been truncated, see # {ContextDev::Models::WebScreenshotParams} for more details. # @@ -77,10 +85,12 @@ class WebScreenshotParams < ContextDev::Internal::Type::BaseModel # # @param page [Symbol, ContextDev::Models::WebScreenshotParams::Page] Optional parameter to specify which page type to screenshot. If provided, the sy # - # @param prioritize [Symbol, ContextDev::Models::WebScreenshotParams::Prioritize] Optional parameter to prioritize screenshot capture. If 'speed', optimizes for f + # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th # # @param viewport [ContextDev::Models::WebScreenshotParams::Viewport] Optional browser viewport dimensions for the screenshot. Defaults to 1920x1080. # + # @param wait_for_ms [Integer] Optional browser wait time in milliseconds after initial page load before taking + # # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}] # Optional parameter to determine screenshot type. If 'true', takes a full page @@ -117,19 +127,6 @@ module Page # @return [Array] end - # Optional parameter to prioritize screenshot capture. If 'speed', optimizes for - # faster capture with basic quality. If 'quality', optimizes for higher quality - # with longer wait times. Defaults to 'quality' if not provided. - module Prioritize - extend ContextDev::Internal::Type::Enum - - SPEED = :speed - QUALITY = :quality - - # @!method self.values - # @return [Array] - end - class Viewport < ContextDev::Internal::Type::BaseModel # @!attribute height # Viewport height in pixels. diff --git a/lib/context_dev/models/web_web_crawl_md_params.rb b/lib/context_dev/models/web_web_crawl_md_params.rb index 87e3c19e..c3044f2f 100644 --- a/lib/context_dev/models/web_web_crawl_md_params.rb +++ b/lib/context_dev/models/web_web_crawl_md_params.rb @@ -74,6 +74,14 @@ class WebWebCrawlMdParams < ContextDev::Internal::Type::BaseModel # @return [Boolean, nil] optional :shorten_base64_images, ContextDev::Internal::Type::Boolean, api_name: :shortenBase64Images + # @!attribute 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). + # + # @return [Integer, nil] + optional :timeout_ms, Integer, api_name: :timeoutMS + # @!attribute url_regex # Regex pattern. Only URLs matching this pattern will be followed and scraped. # @@ -87,7 +95,14 @@ class WebWebCrawlMdParams < ContextDev::Internal::Type::BaseModel # @return [Boolean, nil] optional :use_main_content_only, ContextDev::Internal::Type::Boolean, api_name: :useMainContentOnly - # @!method initialize(url:, follow_subdomains: nil, include_frames: nil, include_images: nil, include_links: nil, max_age_ms: nil, max_depth: nil, max_pages: nil, parse_pdf: nil, shorten_base64_images: nil, url_regex: nil, use_main_content_only: nil, request_options: {}) + # @!attribute wait_for_ms + # Optional browser wait time in milliseconds after initial page load for each + # crawled page. Min: 0. Max: 30000 (30 seconds). + # + # @return [Integer, nil] + optional :wait_for_ms, Integer, api_name: :waitForMs + + # @!method initialize(url:, follow_subdomains: nil, include_frames: nil, include_images: nil, include_links: nil, max_age_ms: nil, max_depth: nil, max_pages: nil, parse_pdf: nil, shorten_base64_images: nil, timeout_ms: nil, url_regex: nil, use_main_content_only: nil, wait_for_ms: nil, request_options: {}) # Some parameter documentations has been truncated, see # {ContextDev::Models::WebWebCrawlMdParams} for more details. # @@ -111,10 +126,14 @@ class WebWebCrawlMdParams < ContextDev::Internal::Type::BaseModel # # @param shorten_base64_images [Boolean] Truncate base64-encoded image data in the Markdown output # + # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th + # # @param url_regex [String] Regex pattern. Only URLs matching this pattern will be followed and scraped. # # @param use_main_content_only [Boolean] Extract only the main content, stripping headers, footers, sidebars, and navigat # + # @param wait_for_ms [Integer] Optional browser wait time in milliseconds after initial page load for each craw + # # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}] end end diff --git a/lib/context_dev/models/web_web_scrape_html_params.rb b/lib/context_dev/models/web_web_scrape_html_params.rb index cc5373d0..615aec15 100644 --- a/lib/context_dev/models/web_web_scrape_html_params.rb +++ b/lib/context_dev/models/web_web_scrape_html_params.rb @@ -35,7 +35,22 @@ class WebWebScrapeHTMLParams < ContextDev::Internal::Type::BaseModel # @return [Boolean, nil] optional :parse_pdf, ContextDev::Internal::Type::Boolean - # @!method initialize(url:, include_frames: nil, max_age_ms: nil, parse_pdf: nil, request_options: {}) + # @!attribute 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). + # + # @return [Integer, nil] + optional :timeout_ms, Integer + + # @!attribute wait_for_ms + # Optional browser wait time in milliseconds after initial page load. Min: 0. Max: + # 30000 (30 seconds). + # + # @return [Integer, nil] + optional :wait_for_ms, Integer + + # @!method initialize(url:, include_frames: nil, max_age_ms: nil, parse_pdf: nil, timeout_ms: nil, wait_for_ms: nil, request_options: {}) # Some parameter documentations has been truncated, see # {ContextDev::Models::WebWebScrapeHTMLParams} for more details. # @@ -47,6 +62,10 @@ class WebWebScrapeHTMLParams < ContextDev::Internal::Type::BaseModel # # @param parse_pdf [Boolean] When true (default), PDF URLs are fetched and their text layer is extracted and # + # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th + # + # @param wait_for_ms [Integer] Optional browser wait time in milliseconds after initial page load. Min: 0. Max: + # # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}] end end diff --git a/lib/context_dev/models/web_web_scrape_images_params.rb b/lib/context_dev/models/web_web_scrape_images_params.rb index 3a3663a2..19ff0e25 100644 --- a/lib/context_dev/models/web_web_scrape_images_params.rb +++ b/lib/context_dev/models/web_web_scrape_images_params.rb @@ -27,7 +27,22 @@ class WebWebScrapeImagesParams < ContextDev::Internal::Type::BaseModel # @return [Integer, nil] optional :max_age_ms, Integer - # @!method initialize(url:, enrichment: nil, max_age_ms: nil, request_options: {}) + # @!attribute 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). + # + # @return [Integer, nil] + optional :timeout_ms, Integer + + # @!attribute wait_for_ms + # Optional browser wait time in milliseconds after initial page load before + # collecting images. Min: 0. Max: 30000 (30 seconds). + # + # @return [Integer, nil] + optional :wait_for_ms, Integer + + # @!method initialize(url:, enrichment: nil, max_age_ms: nil, timeout_ms: nil, wait_for_ms: nil, request_options: {}) # Some parameter documentations has been truncated, see # {ContextDev::Models::WebWebScrapeImagesParams} for more details. # @@ -37,6 +52,10 @@ class WebWebScrapeImagesParams < ContextDev::Internal::Type::BaseModel # # @param max_age_ms [Integer] Reuse a cached result this many milliseconds old or newer. Default: 86400000 (1 # + # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th + # + # @param wait_for_ms [Integer] Optional browser wait time in milliseconds after initial page load before collec + # # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}] class Enrichment < ContextDev::Internal::Type::BaseModel diff --git a/lib/context_dev/models/web_web_scrape_md_params.rb b/lib/context_dev/models/web_web_scrape_md_params.rb index 572e6aeb..8f31c3f1 100644 --- a/lib/context_dev/models/web_web_scrape_md_params.rb +++ b/lib/context_dev/models/web_web_scrape_md_params.rb @@ -54,6 +54,14 @@ class WebWebScrapeMdParams < ContextDev::Internal::Type::BaseModel # @return [Boolean, nil] optional :shorten_base64_images, ContextDev::Internal::Type::Boolean + # @!attribute 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). + # + # @return [Integer, nil] + optional :timeout_ms, Integer + # @!attribute use_main_content_only # Extract only the main content of the page, excluding headers, footers, sidebars, # and navigation @@ -61,7 +69,14 @@ class WebWebScrapeMdParams < ContextDev::Internal::Type::BaseModel # @return [Boolean, nil] optional :use_main_content_only, ContextDev::Internal::Type::Boolean - # @!method initialize(url:, include_frames: nil, include_images: nil, include_links: nil, max_age_ms: nil, parse_pdf: nil, shorten_base64_images: nil, use_main_content_only: nil, request_options: {}) + # @!attribute wait_for_ms + # Optional browser wait time in milliseconds after initial page load before + # converting the page to Markdown. Min: 0. Max: 30000 (30 seconds). + # + # @return [Integer, nil] + optional :wait_for_ms, Integer + + # @!method initialize(url:, include_frames: nil, include_images: nil, include_links: nil, max_age_ms: nil, parse_pdf: nil, shorten_base64_images: nil, timeout_ms: nil, use_main_content_only: nil, wait_for_ms: nil, request_options: {}) # Some parameter documentations has been truncated, see # {ContextDev::Models::WebWebScrapeMdParams} for more details. # @@ -79,8 +94,12 @@ class WebWebScrapeMdParams < ContextDev::Internal::Type::BaseModel # # @param shorten_base64_images [Boolean] Shorten base64-encoded image data in the Markdown output # + # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th + # # @param use_main_content_only [Boolean] Extract only the main content of the page, excluding headers, footers, sidebars, # + # @param wait_for_ms [Integer] Optional browser wait time in milliseconds after initial page load before conver + # # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}] end end diff --git a/lib/context_dev/models/web_web_scrape_sitemap_params.rb b/lib/context_dev/models/web_web_scrape_sitemap_params.rb index f6db1719..ff3c91bc 100644 --- a/lib/context_dev/models/web_web_scrape_sitemap_params.rb +++ b/lib/context_dev/models/web_web_scrape_sitemap_params.rb @@ -20,6 +20,14 @@ class WebWebScrapeSitemapParams < ContextDev::Internal::Type::BaseModel # @return [Integer, nil] optional :max_links, Integer + # @!attribute 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). + # + # @return [Integer, nil] + optional :timeout_ms, Integer + # @!attribute url_regex # Optional RE2-compatible regex pattern. Only URLs matching this pattern are # returned and counted against maxLinks. @@ -27,7 +35,7 @@ class WebWebScrapeSitemapParams < ContextDev::Internal::Type::BaseModel # @return [String, nil] optional :url_regex, String - # @!method initialize(domain:, max_links: nil, url_regex: nil, request_options: {}) + # @!method initialize(domain:, max_links: nil, timeout_ms: nil, url_regex: nil, request_options: {}) # Some parameter documentations has been truncated, see # {ContextDev::Models::WebWebScrapeSitemapParams} for more details. # @@ -35,6 +43,8 @@ class WebWebScrapeSitemapParams < ContextDev::Internal::Type::BaseModel # # @param max_links [Integer] Maximum number of links to return from the sitemap crawl. Defaults to 10,000. Mi # + # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th + # # @param url_regex [String] Optional RE2-compatible regex pattern. Only URLs matching this pattern are retur # # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}] diff --git a/lib/context_dev/resources/ai.rb b/lib/context_dev/resources/ai.rb index f604cbb8..bd295fbd 100644 --- a/lib/context_dev/resources/ai.rb +++ b/lib/context_dev/resources/ai.rb @@ -48,7 +48,7 @@ def ai_query(params) # # @param max_age_ms [Integer] Return a cached result if a prior scrape for the same parameters exists and is y # - # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. Maximum allowed value is 30000 + # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th # # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil] # diff --git a/lib/context_dev/resources/web.rb b/lib/context_dev/resources/web.rb index b3367348..6f92b0f1 100644 --- a/lib/context_dev/resources/web.rb +++ b/lib/context_dev/resources/web.rb @@ -70,7 +70,7 @@ def extract_styleguide(params = {}) # # Capture a screenshot of a website. # - # @overload screenshot(direct_url: nil, domain: nil, full_screenshot: nil, max_age_ms: nil, page: nil, prioritize: nil, viewport: nil, request_options: {}) + # @overload screenshot(direct_url: nil, domain: nil, full_screenshot: nil, max_age_ms: nil, page: nil, timeout_ms: nil, viewport: nil, wait_for_ms: nil, request_options: {}) # # @param direct_url [String] A specific URL to screenshot directly, bypassing domain resolution (e.g., 'https # @@ -82,10 +82,12 @@ def extract_styleguide(params = {}) # # @param page [Symbol, ContextDev::Models::WebScreenshotParams::Page] Optional parameter to specify which page type to screenshot. If provided, the sy # - # @param prioritize [Symbol, ContextDev::Models::WebScreenshotParams::Prioritize] Optional parameter to prioritize screenshot capture. If 'speed', optimizes for f + # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th # # @param viewport [ContextDev::Models::WebScreenshotParams::Viewport] Optional browser viewport dimensions for the screenshot. Defaults to 1920x1080. # + # @param wait_for_ms [Integer] Optional browser wait time in milliseconds after initial page load before taking + # # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil] # # @return [ContextDev::Models::WebScreenshotResponse] @@ -100,7 +102,9 @@ def screenshot(params = {}) query: query.transform_keys( direct_url: "directUrl", full_screenshot: "fullScreenshot", - max_age_ms: "maxAgeMs" + max_age_ms: "maxAgeMs", + timeout_ms: "timeoutMS", + wait_for_ms: "waitForMs" ), model: ContextDev::Models::WebScreenshotResponse, options: options @@ -113,7 +117,7 @@ def screenshot(params = {}) # Performs a crawl starting from a given URL, extracts page content as Markdown, # and returns results for all crawled pages. # - # @overload web_crawl_md(url:, follow_subdomains: nil, include_frames: nil, include_images: nil, include_links: nil, max_age_ms: nil, max_depth: nil, max_pages: nil, parse_pdf: nil, shorten_base64_images: nil, url_regex: nil, use_main_content_only: nil, request_options: {}) + # @overload web_crawl_md(url:, follow_subdomains: nil, include_frames: nil, include_images: nil, include_links: nil, max_age_ms: nil, max_depth: nil, max_pages: nil, parse_pdf: nil, shorten_base64_images: nil, timeout_ms: nil, url_regex: nil, use_main_content_only: nil, wait_for_ms: nil, request_options: {}) # # @param url [String] The starting URL for the crawl (must include http:// or https:// protocol) # @@ -135,10 +139,14 @@ def screenshot(params = {}) # # @param shorten_base64_images [Boolean] Truncate base64-encoded image data in the Markdown output # + # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th + # # @param url_regex [String] Regex pattern. Only URLs matching this pattern will be followed and scraped. # # @param use_main_content_only [Boolean] Extract only the main content, stripping headers, footers, sidebars, and navigat # + # @param wait_for_ms [Integer] Optional browser wait time in milliseconds after initial page load for each craw + # # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil] # # @return [ContextDev::Models::WebWebCrawlMdResponse] @@ -160,7 +168,7 @@ def web_crawl_md(params) # # Scrapes the given URL and returns the raw HTML content of the page. # - # @overload web_scrape_html(url:, include_frames: nil, max_age_ms: nil, parse_pdf: nil, request_options: {}) + # @overload web_scrape_html(url:, include_frames: nil, max_age_ms: nil, parse_pdf: nil, timeout_ms: nil, wait_for_ms: nil, request_options: {}) # # @param url [String] Full URL to scrape (must include http:// or https:// protocol) # @@ -170,6 +178,10 @@ def web_crawl_md(params) # # @param parse_pdf [Boolean] When true (default), PDF URLs are fetched and their text layer is extracted and # + # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th + # + # @param wait_for_ms [Integer] Optional browser wait time in milliseconds after initial page load. Min: 0. Max: + # # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil] # # @return [ContextDev::Models::WebWebScrapeHTMLResponse] @@ -184,7 +196,9 @@ def web_scrape_html(params) query: query.transform_keys( include_frames: "includeFrames", max_age_ms: "maxAgeMs", - parse_pdf: "parsePDF" + parse_pdf: "parsePDF", + timeout_ms: "timeoutMS", + wait_for_ms: "waitForMs" ), model: ContextDev::Models::WebWebScrapeHTMLResponse, options: options @@ -199,7 +213,7 @@ def web_scrape_html(params) # embeds. The base request costs 1 credit; enrichment costs 1 credit per returned # image. # - # @overload web_scrape_images(url:, enrichment: nil, max_age_ms: nil, request_options: {}) + # @overload web_scrape_images(url:, enrichment: nil, max_age_ms: nil, timeout_ms: nil, wait_for_ms: nil, request_options: {}) # # @param url [String] Page URL to inspect. Must include http:// or https://. # @@ -207,6 +221,10 @@ def web_scrape_html(params) # # @param max_age_ms [Integer] Reuse a cached result this many milliseconds old or newer. Default: 86400000 (1 # + # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th + # + # @param wait_for_ms [Integer] Optional browser wait time in milliseconds after initial page load before collec + # # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil] # # @return [ContextDev::Models::WebWebScrapeImagesResponse] @@ -218,7 +236,11 @@ def web_scrape_images(params) @client.request( method: :get, path: "web/scrape/images", - query: query.transform_keys(max_age_ms: "maxAgeMs"), + query: query.transform_keys( + max_age_ms: "maxAgeMs", + timeout_ms: "timeoutMS", + wait_for_ms: "waitForMs" + ), model: ContextDev::Models::WebWebScrapeImagesResponse, options: options ) @@ -229,7 +251,7 @@ def web_scrape_images(params) # # Scrapes the given URL into LLM usable Markdown. # - # @overload web_scrape_md(url:, include_frames: nil, include_images: nil, include_links: nil, max_age_ms: nil, parse_pdf: nil, shorten_base64_images: nil, use_main_content_only: nil, request_options: {}) + # @overload web_scrape_md(url:, include_frames: nil, include_images: nil, include_links: nil, max_age_ms: nil, parse_pdf: nil, shorten_base64_images: nil, timeout_ms: nil, use_main_content_only: nil, wait_for_ms: nil, request_options: {}) # # @param url [String] Full URL to scrape into LLM usable Markdown (must include http:// or https:// pr # @@ -245,8 +267,12 @@ def web_scrape_images(params) # # @param shorten_base64_images [Boolean] Shorten base64-encoded image data in the Markdown output # + # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th + # # @param use_main_content_only [Boolean] Extract only the main content of the page, excluding headers, footers, sidebars, # + # @param wait_for_ms [Integer] Optional browser wait time in milliseconds after initial page load before conver + # # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil] # # @return [ContextDev::Models::WebWebScrapeMdResponse] @@ -265,7 +291,9 @@ def web_scrape_md(params) max_age_ms: "maxAgeMs", parse_pdf: "parsePDF", shorten_base64_images: "shortenBase64Images", - use_main_content_only: "useMainContentOnly" + timeout_ms: "timeoutMS", + use_main_content_only: "useMainContentOnly", + wait_for_ms: "waitForMs" ), model: ContextDev::Models::WebWebScrapeMdResponse, options: options @@ -277,12 +305,14 @@ def web_scrape_md(params) # # Crawl an entire website's sitemap and return all discovered page URLs. # - # @overload web_scrape_sitemap(domain:, max_links: nil, url_regex: nil, request_options: {}) + # @overload web_scrape_sitemap(domain:, max_links: nil, timeout_ms: nil, url_regex: nil, request_options: {}) # # @param domain [String] Domain to build a sitemap for # # @param max_links [Integer] Maximum number of links to return from the sitemap crawl. Defaults to 10,000. Mi # + # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th + # # @param url_regex [String] Optional RE2-compatible regex pattern. Only URLs matching this pattern are retur # # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil] @@ -296,7 +326,7 @@ def web_scrape_sitemap(params) @client.request( method: :get, path: "web/scrape/sitemap", - query: query.transform_keys(max_links: "maxLinks", url_regex: "urlRegex"), + query: query.transform_keys(max_links: "maxLinks", timeout_ms: "timeoutMS", url_regex: "urlRegex"), model: ContextDev::Models::WebWebScrapeSitemapResponse, options: options ) diff --git a/lib/context_dev/version.rb b/lib/context_dev/version.rb index dd992a65..a28a32bb 100644 --- a/lib/context_dev/version.rb +++ b/lib/context_dev/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module ContextDev - VERSION = "1.16.0" + VERSION = "1.17.0" end diff --git a/rbi/context_dev/models/ai_extract_product_params.rbi b/rbi/context_dev/models/ai_extract_product_params.rbi index 669ed76c..ef6e788d 100644 --- a/rbi/context_dev/models/ai_extract_product_params.rbi +++ b/rbi/context_dev/models/ai_extract_product_params.rbi @@ -27,8 +27,9 @@ module ContextDev sig { params(max_age_ms: Integer).void } attr_writer :max_age_ms - # Optional timeout in milliseconds for the request. Maximum allowed value is - # 300000ms (5 minutes). + # 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). sig { returns(T.nilable(Integer)) } attr_reader :timeout_ms @@ -50,8 +51,9 @@ module ContextDev # younger than this many milliseconds. Defaults to 7 days (604800000 ms) when # omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. max_age_ms: nil, - # Optional timeout in milliseconds for the request. Maximum allowed value is - # 300000ms (5 minutes). + # 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). timeout_ms: nil, request_options: {} ) diff --git a/rbi/context_dev/models/ai_extract_products_params.rbi b/rbi/context_dev/models/ai_extract_products_params.rbi index 4976fae8..3e81df18 100644 --- a/rbi/context_dev/models/ai_extract_products_params.rbi +++ b/rbi/context_dev/models/ai_extract_products_params.rbi @@ -92,8 +92,9 @@ module ContextDev sig { params(max_products: Integer).void } attr_writer :max_products - # Optional timeout in milliseconds for the request. Maximum allowed value is - # 300000ms (5 minutes). + # 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). sig { returns(T.nilable(Integer)) } attr_reader :timeout_ms @@ -117,8 +118,9 @@ module ContextDev max_age_ms: nil, # Maximum number of products to extract. max_products: nil, - # Optional timeout in milliseconds for the request. Maximum allowed value is - # 300000ms (5 minutes). + # 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). timeout_ms: nil ) end @@ -167,8 +169,9 @@ module ContextDev sig { params(max_products: Integer).void } attr_writer :max_products - # Optional timeout in milliseconds for the request. Maximum allowed value is - # 300000ms (5 minutes). + # 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). sig { returns(T.nilable(Integer)) } attr_reader :timeout_ms @@ -193,8 +196,9 @@ module ContextDev max_age_ms: nil, # Maximum number of products to extract. max_products: nil, - # Optional timeout in milliseconds for the request. Maximum allowed value is - # 300000ms (5 minutes). + # 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). timeout_ms: nil ) end diff --git a/rbi/context_dev/models/web_screenshot_params.rbi b/rbi/context_dev/models/web_screenshot_params.rbi index eb65d5d3..5effb615 100644 --- a/rbi/context_dev/models/web_screenshot_params.rbi +++ b/rbi/context_dev/models/web_screenshot_params.rbi @@ -69,22 +69,14 @@ module ContextDev sig { params(page: ContextDev::WebScreenshotParams::Page::OrSymbol).void } attr_writer :page - # Optional parameter to prioritize screenshot capture. If 'speed', optimizes for - # faster capture with basic quality. If 'quality', optimizes for higher quality - # with longer wait times. Defaults to 'quality' if not provided. - sig do - returns( - T.nilable(ContextDev::WebScreenshotParams::Prioritize::OrSymbol) - ) - end - attr_reader :prioritize + # 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). + sig { returns(T.nilable(Integer)) } + attr_reader :timeout_ms - sig do - params( - prioritize: ContextDev::WebScreenshotParams::Prioritize::OrSymbol - ).void - end - attr_writer :prioritize + sig { params(timeout_ms: Integer).void } + attr_writer :timeout_ms # Optional browser viewport dimensions for the screenshot. Defaults to 1920x1080. sig { returns(T.nilable(ContextDev::WebScreenshotParams::Viewport)) } @@ -95,6 +87,15 @@ module ContextDev end attr_writer :viewport + # Optional browser wait time in milliseconds after initial page load before taking + # the screenshot. Min: 0. Max: 30000 (30 seconds). Defaults to 3000 ms when + # omitted. + sig { returns(T.nilable(Integer)) } + attr_reader :wait_for_ms + + sig { params(wait_for_ms: Integer).void } + attr_writer :wait_for_ms + sig do params( direct_url: String, @@ -103,8 +104,9 @@ module ContextDev ContextDev::WebScreenshotParams::FullScreenshot::OrSymbol, max_age_ms: Integer, page: ContextDev::WebScreenshotParams::Page::OrSymbol, - prioritize: ContextDev::WebScreenshotParams::Prioritize::OrSymbol, + timeout_ms: Integer, viewport: ContextDev::WebScreenshotParams::Viewport::OrHash, + wait_for_ms: Integer, request_options: ContextDev::RequestOptions::OrHash ).returns(T.attached_class) end @@ -131,12 +133,16 @@ module ContextDev # provided, screenshots the main domain landing page. Only applicable when using # 'domain', not 'directUrl'. page: nil, - # Optional parameter to prioritize screenshot capture. If 'speed', optimizes for - # faster capture with basic quality. If 'quality', optimizes for higher quality - # with longer wait times. Defaults to 'quality' if not provided. - prioritize: nil, + # 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). + timeout_ms: nil, # Optional browser viewport dimensions for the screenshot. Defaults to 1920x1080. viewport: nil, + # Optional browser wait time in milliseconds after initial page load before taking + # the screenshot. Min: 0. Max: 30000 (30 seconds). Defaults to 3000 ms when + # omitted. + wait_for_ms: nil, request_options: {} ) end @@ -150,8 +156,9 @@ module ContextDev ContextDev::WebScreenshotParams::FullScreenshot::OrSymbol, max_age_ms: Integer, page: ContextDev::WebScreenshotParams::Page::OrSymbol, - prioritize: ContextDev::WebScreenshotParams::Prioritize::OrSymbol, + timeout_ms: Integer, viewport: ContextDev::WebScreenshotParams::Viewport, + wait_for_ms: Integer, request_options: ContextDev::RequestOptions } ) @@ -230,38 +237,6 @@ module ContextDev end end - # Optional parameter to prioritize screenshot capture. If 'speed', optimizes for - # faster capture with basic quality. If 'quality', optimizes for higher quality - # with longer wait times. Defaults to 'quality' if not provided. - module Prioritize - extend ContextDev::Internal::Type::Enum - - TaggedSymbol = - T.type_alias do - T.all(Symbol, ContextDev::WebScreenshotParams::Prioritize) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - SPEED = - T.let( - :speed, - ContextDev::WebScreenshotParams::Prioritize::TaggedSymbol - ) - QUALITY = - T.let( - :quality, - ContextDev::WebScreenshotParams::Prioritize::TaggedSymbol - ) - - sig do - override.returns( - T::Array[ContextDev::WebScreenshotParams::Prioritize::TaggedSymbol] - ) - end - def self.values - end - end - class Viewport < ContextDev::Internal::Type::BaseModel OrHash = T.type_alias do diff --git a/rbi/context_dev/models/web_web_crawl_md_params.rbi b/rbi/context_dev/models/web_web_crawl_md_params.rbi index 1007f855..41d2b33e 100644 --- a/rbi/context_dev/models/web_web_crawl_md_params.rbi +++ b/rbi/context_dev/models/web_web_crawl_md_params.rbi @@ -85,6 +85,15 @@ module ContextDev sig { params(shorten_base64_images: T::Boolean).void } attr_writer :shorten_base64_images + # 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). + sig { returns(T.nilable(Integer)) } + attr_reader :timeout_ms + + sig { params(timeout_ms: Integer).void } + attr_writer :timeout_ms + # Regex pattern. Only URLs matching this pattern will be followed and scraped. sig { returns(T.nilable(String)) } attr_reader :url_regex @@ -100,6 +109,14 @@ module ContextDev sig { params(use_main_content_only: T::Boolean).void } attr_writer :use_main_content_only + # Optional browser wait time in milliseconds after initial page load for each + # crawled page. Min: 0. Max: 30000 (30 seconds). + sig { returns(T.nilable(Integer)) } + attr_reader :wait_for_ms + + sig { params(wait_for_ms: Integer).void } + attr_writer :wait_for_ms + sig do params( url: String, @@ -112,8 +129,10 @@ module ContextDev max_pages: Integer, parse_pdf: T::Boolean, shorten_base64_images: T::Boolean, + timeout_ms: Integer, url_regex: String, use_main_content_only: T::Boolean, + wait_for_ms: Integer, request_options: ContextDev::RequestOptions::OrHash ).returns(T.attached_class) end @@ -145,11 +164,18 @@ module ContextDev parse_pdf: nil, # Truncate base64-encoded image data in the Markdown output shorten_base64_images: nil, + # 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). + timeout_ms: nil, # Regex pattern. Only URLs matching this pattern will be followed and scraped. url_regex: nil, # Extract only the main content, stripping headers, footers, sidebars, and # navigation use_main_content_only: nil, + # Optional browser wait time in milliseconds after initial page load for each + # crawled page. Min: 0. Max: 30000 (30 seconds). + wait_for_ms: nil, request_options: {} ) end @@ -167,8 +193,10 @@ module ContextDev max_pages: Integer, parse_pdf: T::Boolean, shorten_base64_images: T::Boolean, + timeout_ms: Integer, url_regex: String, use_main_content_only: T::Boolean, + wait_for_ms: Integer, request_options: ContextDev::RequestOptions } ) diff --git a/rbi/context_dev/models/web_web_scrape_html_params.rbi b/rbi/context_dev/models/web_web_scrape_html_params.rbi index 36bb79b6..9eb380ff 100644 --- a/rbi/context_dev/models/web_web_scrape_html_params.rbi +++ b/rbi/context_dev/models/web_web_scrape_html_params.rbi @@ -43,12 +43,31 @@ module ContextDev sig { params(parse_pdf: T::Boolean).void } attr_writer :parse_pdf + # 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). + sig { returns(T.nilable(Integer)) } + attr_reader :timeout_ms + + sig { params(timeout_ms: Integer).void } + attr_writer :timeout_ms + + # Optional browser wait time in milliseconds after initial page load. Min: 0. Max: + # 30000 (30 seconds). + sig { returns(T.nilable(Integer)) } + attr_reader :wait_for_ms + + sig { params(wait_for_ms: Integer).void } + attr_writer :wait_for_ms + sig do params( url: String, include_frames: T::Boolean, max_age_ms: Integer, parse_pdf: T::Boolean, + timeout_ms: Integer, + wait_for_ms: Integer, request_options: ContextDev::RequestOptions::OrHash ).returns(T.attached_class) end @@ -65,6 +84,13 @@ module ContextDev # returned wrapped in …. When false, PDF URLs are skipped # and a 400 WEBSITE_ACCESS_ERROR is returned. parse_pdf: nil, + # 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). + timeout_ms: nil, + # Optional browser wait time in milliseconds after initial page load. Min: 0. Max: + # 30000 (30 seconds). + wait_for_ms: nil, request_options: {} ) end @@ -76,6 +102,8 @@ module ContextDev include_frames: T::Boolean, max_age_ms: Integer, parse_pdf: T::Boolean, + timeout_ms: Integer, + wait_for_ms: Integer, request_options: ContextDev::RequestOptions } ) diff --git a/rbi/context_dev/models/web_web_scrape_images_params.rbi b/rbi/context_dev/models/web_web_scrape_images_params.rbi index 12d4a5e7..a5be0b21 100644 --- a/rbi/context_dev/models/web_web_scrape_images_params.rbi +++ b/rbi/context_dev/models/web_web_scrape_images_params.rbi @@ -40,11 +40,30 @@ module ContextDev sig { params(max_age_ms: Integer).void } attr_writer :max_age_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). + sig { returns(T.nilable(Integer)) } + attr_reader :timeout_ms + + sig { params(timeout_ms: Integer).void } + attr_writer :timeout_ms + + # Optional browser wait time in milliseconds after initial page load before + # collecting images. Min: 0. Max: 30000 (30 seconds). + sig { returns(T.nilable(Integer)) } + attr_reader :wait_for_ms + + sig { params(wait_for_ms: Integer).void } + attr_writer :wait_for_ms + sig do params( url: String, enrichment: ContextDev::WebWebScrapeImagesParams::Enrichment::OrHash, max_age_ms: Integer, + timeout_ms: Integer, + wait_for_ms: Integer, request_options: ContextDev::RequestOptions::OrHash ).returns(T.attached_class) end @@ -57,6 +76,13 @@ module ContextDev # Reuse a cached result this many milliseconds old or newer. Default: 86400000 (1 # day). Set to 0 to bypass cache. Maximum: 2592000000 (30 days). max_age_ms: nil, + # 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). + timeout_ms: nil, + # Optional browser wait time in milliseconds after initial page load before + # collecting images. Min: 0. Max: 30000 (30 seconds). + wait_for_ms: nil, request_options: {} ) end @@ -67,6 +93,8 @@ module ContextDev url: String, enrichment: ContextDev::WebWebScrapeImagesParams::Enrichment, max_age_ms: Integer, + timeout_ms: Integer, + wait_for_ms: Integer, request_options: ContextDev::RequestOptions } ) diff --git a/rbi/context_dev/models/web_web_scrape_md_params.rbi b/rbi/context_dev/models/web_web_scrape_md_params.rbi index d555cbfd..fb6b362a 100644 --- a/rbi/context_dev/models/web_web_scrape_md_params.rbi +++ b/rbi/context_dev/models/web_web_scrape_md_params.rbi @@ -62,6 +62,15 @@ module ContextDev sig { params(shorten_base64_images: T::Boolean).void } attr_writer :shorten_base64_images + # 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). + sig { returns(T.nilable(Integer)) } + attr_reader :timeout_ms + + sig { params(timeout_ms: Integer).void } + attr_writer :timeout_ms + # Extract only the main content of the page, excluding headers, footers, sidebars, # and navigation sig { returns(T.nilable(T::Boolean)) } @@ -70,6 +79,14 @@ module ContextDev sig { params(use_main_content_only: T::Boolean).void } attr_writer :use_main_content_only + # Optional browser wait time in milliseconds after initial page load before + # converting the page to Markdown. Min: 0. Max: 30000 (30 seconds). + sig { returns(T.nilable(Integer)) } + attr_reader :wait_for_ms + + sig { params(wait_for_ms: Integer).void } + attr_writer :wait_for_ms + sig do params( url: String, @@ -79,7 +96,9 @@ module ContextDev max_age_ms: Integer, parse_pdf: T::Boolean, shorten_base64_images: T::Boolean, + timeout_ms: Integer, use_main_content_only: T::Boolean, + wait_for_ms: Integer, request_options: ContextDev::RequestOptions::OrHash ).returns(T.attached_class) end @@ -103,9 +122,16 @@ module ContextDev parse_pdf: nil, # Shorten base64-encoded image data in the Markdown output shorten_base64_images: nil, + # 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). + timeout_ms: nil, # Extract only the main content of the page, excluding headers, footers, sidebars, # and navigation use_main_content_only: nil, + # Optional browser wait time in milliseconds after initial page load before + # converting the page to Markdown. Min: 0. Max: 30000 (30 seconds). + wait_for_ms: nil, request_options: {} ) end @@ -120,7 +146,9 @@ module ContextDev max_age_ms: Integer, parse_pdf: T::Boolean, shorten_base64_images: T::Boolean, + timeout_ms: Integer, use_main_content_only: T::Boolean, + wait_for_ms: Integer, request_options: ContextDev::RequestOptions } ) diff --git a/rbi/context_dev/models/web_web_scrape_sitemap_params.rbi b/rbi/context_dev/models/web_web_scrape_sitemap_params.rbi index ad158a45..d71d0c53 100644 --- a/rbi/context_dev/models/web_web_scrape_sitemap_params.rbi +++ b/rbi/context_dev/models/web_web_scrape_sitemap_params.rbi @@ -26,6 +26,15 @@ module ContextDev sig { params(max_links: Integer).void } attr_writer :max_links + # 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). + sig { returns(T.nilable(Integer)) } + attr_reader :timeout_ms + + sig { params(timeout_ms: Integer).void } + attr_writer :timeout_ms + # Optional RE2-compatible regex pattern. Only URLs matching this pattern are # returned and counted against maxLinks. sig { returns(T.nilable(String)) } @@ -38,6 +47,7 @@ module ContextDev params( domain: String, max_links: Integer, + timeout_ms: Integer, url_regex: String, request_options: ContextDev::RequestOptions::OrHash ).returns(T.attached_class) @@ -48,6 +58,10 @@ module ContextDev # Maximum number of links to return from the sitemap crawl. Defaults to 10,000. # Minimum is 1, maximum is 100,000. max_links: nil, + # 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). + timeout_ms: nil, # Optional RE2-compatible regex pattern. Only URLs matching this pattern are # returned and counted against maxLinks. url_regex: nil, @@ -60,6 +74,7 @@ module ContextDev { domain: String, max_links: Integer, + timeout_ms: Integer, url_regex: String, request_options: ContextDev::RequestOptions } diff --git a/rbi/context_dev/resources/ai.rbi b/rbi/context_dev/resources/ai.rbi index dc103d43..d8382cd7 100644 --- a/rbi/context_dev/resources/ai.rbi +++ b/rbi/context_dev/resources/ai.rbi @@ -48,8 +48,9 @@ module ContextDev # younger than this many milliseconds. Defaults to 7 days (604800000 ms) when # omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. max_age_ms: nil, - # Optional timeout in milliseconds for the request. Maximum allowed value is - # 300000ms (5 minutes). + # 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). timeout_ms: nil, request_options: {} ) diff --git a/rbi/context_dev/resources/web.rbi b/rbi/context_dev/resources/web.rbi index 0e6cd5e2..24d629a7 100644 --- a/rbi/context_dev/resources/web.rbi +++ b/rbi/context_dev/resources/web.rbi @@ -67,8 +67,9 @@ module ContextDev ContextDev::WebScreenshotParams::FullScreenshot::OrSymbol, max_age_ms: Integer, page: ContextDev::WebScreenshotParams::Page::OrSymbol, - prioritize: ContextDev::WebScreenshotParams::Prioritize::OrSymbol, + timeout_ms: Integer, viewport: ContextDev::WebScreenshotParams::Viewport::OrHash, + wait_for_ms: Integer, request_options: ContextDev::RequestOptions::OrHash ).returns(ContextDev::Models::WebScreenshotResponse) end @@ -95,12 +96,16 @@ module ContextDev # provided, screenshots the main domain landing page. Only applicable when using # 'domain', not 'directUrl'. page: nil, - # Optional parameter to prioritize screenshot capture. If 'speed', optimizes for - # faster capture with basic quality. If 'quality', optimizes for higher quality - # with longer wait times. Defaults to 'quality' if not provided. - prioritize: nil, + # 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). + timeout_ms: nil, # Optional browser viewport dimensions for the screenshot. Defaults to 1920x1080. viewport: nil, + # Optional browser wait time in milliseconds after initial page load before taking + # the screenshot. Min: 0. Max: 30000 (30 seconds). Defaults to 3000 ms when + # omitted. + wait_for_ms: nil, request_options: {} ) end @@ -119,8 +124,10 @@ module ContextDev max_pages: Integer, parse_pdf: T::Boolean, shorten_base64_images: T::Boolean, + timeout_ms: Integer, url_regex: String, use_main_content_only: T::Boolean, + wait_for_ms: Integer, request_options: ContextDev::RequestOptions::OrHash ).returns(ContextDev::Models::WebWebCrawlMdResponse) end @@ -152,11 +159,18 @@ module ContextDev parse_pdf: nil, # Truncate base64-encoded image data in the Markdown output shorten_base64_images: nil, + # 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). + timeout_ms: nil, # Regex pattern. Only URLs matching this pattern will be followed and scraped. url_regex: nil, # Extract only the main content, stripping headers, footers, sidebars, and # navigation use_main_content_only: nil, + # Optional browser wait time in milliseconds after initial page load for each + # crawled page. Min: 0. Max: 30000 (30 seconds). + wait_for_ms: nil, request_options: {} ) end @@ -168,6 +182,8 @@ module ContextDev include_frames: T::Boolean, max_age_ms: Integer, parse_pdf: T::Boolean, + timeout_ms: Integer, + wait_for_ms: Integer, request_options: ContextDev::RequestOptions::OrHash ).returns(ContextDev::Models::WebWebScrapeHTMLResponse) end @@ -184,6 +200,13 @@ module ContextDev # returned wrapped in …. When false, PDF URLs are skipped # and a 400 WEBSITE_ACCESS_ERROR is returned. parse_pdf: nil, + # 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). + timeout_ms: nil, + # Optional browser wait time in milliseconds after initial page load. Min: 0. Max: + # 30000 (30 seconds). + wait_for_ms: nil, request_options: {} ) end @@ -197,6 +220,8 @@ module ContextDev url: String, enrichment: ContextDev::WebWebScrapeImagesParams::Enrichment::OrHash, max_age_ms: Integer, + timeout_ms: Integer, + wait_for_ms: Integer, request_options: ContextDev::RequestOptions::OrHash ).returns(ContextDev::Models::WebWebScrapeImagesResponse) end @@ -209,6 +234,13 @@ module ContextDev # Reuse a cached result this many milliseconds old or newer. Default: 86400000 (1 # day). Set to 0 to bypass cache. Maximum: 2592000000 (30 days). max_age_ms: nil, + # 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). + timeout_ms: nil, + # Optional browser wait time in milliseconds after initial page load before + # collecting images. Min: 0. Max: 30000 (30 seconds). + wait_for_ms: nil, request_options: {} ) end @@ -223,7 +255,9 @@ module ContextDev max_age_ms: Integer, parse_pdf: T::Boolean, shorten_base64_images: T::Boolean, + timeout_ms: Integer, use_main_content_only: T::Boolean, + wait_for_ms: Integer, request_options: ContextDev::RequestOptions::OrHash ).returns(ContextDev::Models::WebWebScrapeMdResponse) end @@ -247,9 +281,16 @@ module ContextDev parse_pdf: nil, # Shorten base64-encoded image data in the Markdown output shorten_base64_images: nil, + # 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). + timeout_ms: nil, # Extract only the main content of the page, excluding headers, footers, sidebars, # and navigation use_main_content_only: nil, + # Optional browser wait time in milliseconds after initial page load before + # converting the page to Markdown. Min: 0. Max: 30000 (30 seconds). + wait_for_ms: nil, request_options: {} ) end @@ -259,6 +300,7 @@ module ContextDev params( domain: String, max_links: Integer, + timeout_ms: Integer, url_regex: String, request_options: ContextDev::RequestOptions::OrHash ).returns(ContextDev::Models::WebWebScrapeSitemapResponse) @@ -269,6 +311,10 @@ module ContextDev # Maximum number of links to return from the sitemap crawl. Defaults to 10,000. # Minimum is 1, maximum is 100,000. max_links: nil, + # 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). + timeout_ms: nil, # Optional RE2-compatible regex pattern. Only URLs matching this pattern are # returned and counted against maxLinks. url_regex: nil, diff --git a/sig/context_dev/models/web_screenshot_params.rbs b/sig/context_dev/models/web_screenshot_params.rbs index 1f9de9a0..19856fee 100644 --- a/sig/context_dev/models/web_screenshot_params.rbs +++ b/sig/context_dev/models/web_screenshot_params.rbs @@ -7,8 +7,9 @@ module ContextDev full_screenshot: ContextDev::Models::WebScreenshotParams::full_screenshot, max_age_ms: Integer, page: ContextDev::Models::WebScreenshotParams::page, - prioritize: ContextDev::Models::WebScreenshotParams::prioritize, - viewport: ContextDev::WebScreenshotParams::Viewport + timeout_ms: Integer, + viewport: ContextDev::WebScreenshotParams::Viewport, + wait_for_ms: Integer } & ContextDev::Internal::Type::request_parameters @@ -40,11 +41,9 @@ module ContextDev ContextDev::Models::WebScreenshotParams::page ) -> ContextDev::Models::WebScreenshotParams::page - attr_reader prioritize: ContextDev::Models::WebScreenshotParams::prioritize? + attr_reader timeout_ms: Integer? - def prioritize=: ( - ContextDev::Models::WebScreenshotParams::prioritize - ) -> ContextDev::Models::WebScreenshotParams::prioritize + def timeout_ms=: (Integer) -> Integer attr_reader viewport: ContextDev::WebScreenshotParams::Viewport? @@ -52,14 +51,19 @@ module ContextDev ContextDev::WebScreenshotParams::Viewport ) -> ContextDev::WebScreenshotParams::Viewport + attr_reader wait_for_ms: Integer? + + def wait_for_ms=: (Integer) -> Integer + def initialize: ( ?direct_url: String, ?domain: String, ?full_screenshot: ContextDev::Models::WebScreenshotParams::full_screenshot, ?max_age_ms: Integer, ?page: ContextDev::Models::WebScreenshotParams::page, - ?prioritize: ContextDev::Models::WebScreenshotParams::prioritize, + ?timeout_ms: Integer, ?viewport: ContextDev::WebScreenshotParams::Viewport, + ?wait_for_ms: Integer, ?request_options: ContextDev::request_opts ) -> void @@ -69,8 +73,9 @@ module ContextDev full_screenshot: ContextDev::Models::WebScreenshotParams::full_screenshot, max_age_ms: Integer, page: ContextDev::Models::WebScreenshotParams::page, - prioritize: ContextDev::Models::WebScreenshotParams::prioritize, + timeout_ms: Integer, viewport: ContextDev::WebScreenshotParams::Viewport, + wait_for_ms: Integer, request_options: ContextDev::RequestOptions } @@ -110,17 +115,6 @@ module ContextDev def self?.values: -> ::Array[ContextDev::Models::WebScreenshotParams::page] end - type prioritize = :speed | :quality - - module Prioritize - extend ContextDev::Internal::Type::Enum - - SPEED: :speed - QUALITY: :quality - - def self?.values: -> ::Array[ContextDev::Models::WebScreenshotParams::prioritize] - end - type viewport = { height: Integer, width: Integer } class Viewport < ContextDev::Internal::Type::BaseModel diff --git a/sig/context_dev/models/web_web_crawl_md_params.rbs b/sig/context_dev/models/web_web_crawl_md_params.rbs index 56505674..baaaaa10 100644 --- a/sig/context_dev/models/web_web_crawl_md_params.rbs +++ b/sig/context_dev/models/web_web_crawl_md_params.rbs @@ -12,8 +12,10 @@ module ContextDev max_pages: Integer, parse_pdf: bool, :shorten_base64_images => bool, + timeout_ms: Integer, url_regex: String, - use_main_content_only: bool + use_main_content_only: bool, + wait_for_ms: Integer } & ContextDev::Internal::Type::request_parameters @@ -59,6 +61,10 @@ module ContextDev def shorten_base64_images=: (bool) -> bool + attr_reader timeout_ms: Integer? + + def timeout_ms=: (Integer) -> Integer + attr_reader url_regex: String? def url_regex=: (String) -> String @@ -67,6 +73,10 @@ module ContextDev def use_main_content_only=: (bool) -> bool + attr_reader wait_for_ms: Integer? + + def wait_for_ms=: (Integer) -> Integer + def initialize: ( url: String, ?follow_subdomains: bool, @@ -78,8 +88,10 @@ module ContextDev ?max_pages: Integer, ?parse_pdf: bool, ?shorten_base64_images: bool, + ?timeout_ms: Integer, ?url_regex: String, ?use_main_content_only: bool, + ?wait_for_ms: Integer, ?request_options: ContextDev::request_opts ) -> void @@ -94,8 +106,10 @@ module ContextDev max_pages: Integer, parse_pdf: bool, :shorten_base64_images => bool, + timeout_ms: Integer, url_regex: String, use_main_content_only: bool, + wait_for_ms: Integer, request_options: ContextDev::RequestOptions } end diff --git a/sig/context_dev/models/web_web_scrape_html_params.rbs b/sig/context_dev/models/web_web_scrape_html_params.rbs index a1ad7e0b..f9c4a03d 100644 --- a/sig/context_dev/models/web_web_scrape_html_params.rbs +++ b/sig/context_dev/models/web_web_scrape_html_params.rbs @@ -5,7 +5,9 @@ module ContextDev url: String, include_frames: bool, max_age_ms: Integer, - parse_pdf: bool + parse_pdf: bool, + timeout_ms: Integer, + wait_for_ms: Integer } & ContextDev::Internal::Type::request_parameters @@ -27,11 +29,21 @@ module ContextDev def parse_pdf=: (bool) -> bool + attr_reader timeout_ms: Integer? + + def timeout_ms=: (Integer) -> Integer + + attr_reader wait_for_ms: Integer? + + def wait_for_ms=: (Integer) -> Integer + def initialize: ( url: String, ?include_frames: bool, ?max_age_ms: Integer, ?parse_pdf: bool, + ?timeout_ms: Integer, + ?wait_for_ms: Integer, ?request_options: ContextDev::request_opts ) -> void @@ -40,6 +52,8 @@ module ContextDev include_frames: bool, max_age_ms: Integer, parse_pdf: bool, + timeout_ms: Integer, + wait_for_ms: Integer, request_options: ContextDev::RequestOptions } end diff --git a/sig/context_dev/models/web_web_scrape_images_params.rbs b/sig/context_dev/models/web_web_scrape_images_params.rbs index 9fea33f5..acecf286 100644 --- a/sig/context_dev/models/web_web_scrape_images_params.rbs +++ b/sig/context_dev/models/web_web_scrape_images_params.rbs @@ -4,7 +4,9 @@ module ContextDev { url: String, enrichment: ContextDev::WebWebScrapeImagesParams::Enrichment, - max_age_ms: Integer + max_age_ms: Integer, + timeout_ms: Integer, + wait_for_ms: Integer } & ContextDev::Internal::Type::request_parameters @@ -24,10 +26,20 @@ module ContextDev def max_age_ms=: (Integer) -> Integer + attr_reader timeout_ms: Integer? + + def timeout_ms=: (Integer) -> Integer + + attr_reader wait_for_ms: Integer? + + def wait_for_ms=: (Integer) -> Integer + def initialize: ( url: String, ?enrichment: ContextDev::WebWebScrapeImagesParams::Enrichment, ?max_age_ms: Integer, + ?timeout_ms: Integer, + ?wait_for_ms: Integer, ?request_options: ContextDev::request_opts ) -> void @@ -35,6 +47,8 @@ module ContextDev url: String, enrichment: ContextDev::WebWebScrapeImagesParams::Enrichment, max_age_ms: Integer, + timeout_ms: Integer, + wait_for_ms: Integer, request_options: ContextDev::RequestOptions } diff --git a/sig/context_dev/models/web_web_scrape_md_params.rbs b/sig/context_dev/models/web_web_scrape_md_params.rbs index 7c53b008..9cca6f53 100644 --- a/sig/context_dev/models/web_web_scrape_md_params.rbs +++ b/sig/context_dev/models/web_web_scrape_md_params.rbs @@ -9,7 +9,9 @@ module ContextDev max_age_ms: Integer, parse_pdf: bool, :shorten_base64_images => bool, - use_main_content_only: bool + timeout_ms: Integer, + use_main_content_only: bool, + wait_for_ms: Integer } & ContextDev::Internal::Type::request_parameters @@ -43,10 +45,18 @@ module ContextDev def shorten_base64_images=: (bool) -> bool + attr_reader timeout_ms: Integer? + + def timeout_ms=: (Integer) -> Integer + attr_reader use_main_content_only: bool? def use_main_content_only=: (bool) -> bool + attr_reader wait_for_ms: Integer? + + def wait_for_ms=: (Integer) -> Integer + def initialize: ( url: String, ?include_frames: bool, @@ -55,7 +65,9 @@ module ContextDev ?max_age_ms: Integer, ?parse_pdf: bool, ?shorten_base64_images: bool, + ?timeout_ms: Integer, ?use_main_content_only: bool, + ?wait_for_ms: Integer, ?request_options: ContextDev::request_opts ) -> void @@ -67,7 +79,9 @@ module ContextDev max_age_ms: Integer, parse_pdf: bool, :shorten_base64_images => bool, + timeout_ms: Integer, use_main_content_only: bool, + wait_for_ms: Integer, request_options: ContextDev::RequestOptions } end diff --git a/sig/context_dev/models/web_web_scrape_sitemap_params.rbs b/sig/context_dev/models/web_web_scrape_sitemap_params.rbs index bc00055c..a01a1e20 100644 --- a/sig/context_dev/models/web_web_scrape_sitemap_params.rbs +++ b/sig/context_dev/models/web_web_scrape_sitemap_params.rbs @@ -1,7 +1,12 @@ module ContextDev module Models type web_web_scrape_sitemap_params = - { domain: String, max_links: Integer, url_regex: String } + { + domain: String, + max_links: Integer, + timeout_ms: Integer, + url_regex: String + } & ContextDev::Internal::Type::request_parameters class WebWebScrapeSitemapParams < ContextDev::Internal::Type::BaseModel @@ -14,6 +19,10 @@ module ContextDev def max_links=: (Integer) -> Integer + attr_reader timeout_ms: Integer? + + def timeout_ms=: (Integer) -> Integer + attr_reader url_regex: String? def url_regex=: (String) -> String @@ -21,6 +30,7 @@ module ContextDev def initialize: ( domain: String, ?max_links: Integer, + ?timeout_ms: Integer, ?url_regex: String, ?request_options: ContextDev::request_opts ) -> void @@ -28,6 +38,7 @@ module ContextDev def to_hash: -> { domain: String, max_links: Integer, + timeout_ms: Integer, url_regex: String, request_options: ContextDev::RequestOptions } diff --git a/sig/context_dev/resources/web.rbs b/sig/context_dev/resources/web.rbs index 42eea19d..9c2579c3 100644 --- a/sig/context_dev/resources/web.rbs +++ b/sig/context_dev/resources/web.rbs @@ -21,8 +21,9 @@ module ContextDev ?full_screenshot: ContextDev::Models::WebScreenshotParams::full_screenshot, ?max_age_ms: Integer, ?page: ContextDev::Models::WebScreenshotParams::page, - ?prioritize: ContextDev::Models::WebScreenshotParams::prioritize, + ?timeout_ms: Integer, ?viewport: ContextDev::WebScreenshotParams::Viewport, + ?wait_for_ms: Integer, ?request_options: ContextDev::request_opts ) -> ContextDev::Models::WebScreenshotResponse @@ -37,8 +38,10 @@ module ContextDev ?max_pages: Integer, ?parse_pdf: bool, ?shorten_base64_images: bool, + ?timeout_ms: Integer, ?url_regex: String, ?use_main_content_only: bool, + ?wait_for_ms: Integer, ?request_options: ContextDev::request_opts ) -> ContextDev::Models::WebWebCrawlMdResponse @@ -47,6 +50,8 @@ module ContextDev ?include_frames: bool, ?max_age_ms: Integer, ?parse_pdf: bool, + ?timeout_ms: Integer, + ?wait_for_ms: Integer, ?request_options: ContextDev::request_opts ) -> ContextDev::Models::WebWebScrapeHTMLResponse @@ -54,6 +59,8 @@ module ContextDev url: String, ?enrichment: ContextDev::WebWebScrapeImagesParams::Enrichment, ?max_age_ms: Integer, + ?timeout_ms: Integer, + ?wait_for_ms: Integer, ?request_options: ContextDev::request_opts ) -> ContextDev::Models::WebWebScrapeImagesResponse @@ -65,13 +72,16 @@ module ContextDev ?max_age_ms: Integer, ?parse_pdf: bool, ?shorten_base64_images: bool, + ?timeout_ms: Integer, ?use_main_content_only: bool, + ?wait_for_ms: Integer, ?request_options: ContextDev::request_opts ) -> ContextDev::Models::WebWebScrapeMdResponse def web_scrape_sitemap: ( domain: String, ?max_links: Integer, + ?timeout_ms: Integer, ?url_regex: String, ?request_options: ContextDev::request_opts ) -> ContextDev::Models::WebWebScrapeSitemapResponse