Skip to content

Commit 5193bc1

Browse files
author
stlc-bot
committed
fix(scrape): derive the /web/scrape request spec from its zod schema (#2044)
Stainless-Generated-From: 2735b3e1cda2abd0953eab038327255b109952b0
1 parent 9c97d2d commit 5193bc1

8 files changed

Lines changed: 143 additions & 49 deletions

File tree

‎lib/context_dev/models/batch_submit_params.rb‎

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,7 +1116,7 @@ class BatchUnifiedScrapeData < ContextDev::Internal::Type::BaseModel
11161116
api_name: :sharedParams
11171117

11181118
# @!attribute tags
1119-
# Labels for tracking request usage. Not retained when zdr is enabled.
1119+
# Labels for filtering usage in the dashboard.
11201120
#
11211121
# @return [Array<String>, nil]
11221122
optional :tags, ContextDev::Internal::Type::ArrayOf[String]
@@ -1170,7 +1170,7 @@ class BatchUnifiedScrapeData < ContextDev::Internal::Type::BaseModel
11701170
#
11711171
# @param shared_params [ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::BatchUnifiedScrapeData::SharedParams] Browser and content settings shared by all outputs.
11721172
#
1173-
# @param tags [Array<String>] Labels for tracking request usage. Not retained when zdr is enabled.
1173+
# @param tags [Array<String>] Labels for filtering usage in the dashboard.
11741174
#
11751175
# @param timeout_opts [ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::BatchUnifiedScrapeData::TimeoutOpts] Deadline for each page, using the same behavior and defaults as POST /web/scrape
11761176
#
@@ -1848,10 +1848,20 @@ class ProductParams < ContextDev::Internal::Type::BaseModel
18481848
# @return [Boolean, nil]
18491849
optional :dedupe_images, ContextDev::Internal::Type::Boolean, api_name: :dedupeImages
18501850

1851-
# @!method initialize(dedupe_images: nil)
1851+
# @!attribute use_ai_fallback
1852+
# @deprecated
1853+
#
1854+
# Ignored. The AI fallback runs automatically.
1855+
#
1856+
# @return [Boolean, nil]
1857+
optional :use_ai_fallback, ContextDev::Internal::Type::Boolean, api_name: :useAIFallback
1858+
1859+
# @!method initialize(dedupe_images: nil, use_ai_fallback: nil)
18521860
# Product options. Requires formats.product: true.
18531861
#
18541862
# @param dedupe_images [Boolean] Drop visually duplicate product images, keeping the largest copy.
1863+
#
1864+
# @param use_ai_fallback [Boolean] Ignored. The AI fallback runs automatically.
18551865
end
18561866

18571867
# @see ContextDev::Models::BatchSubmitParams::Input::Scrape::Data::BatchUnifiedScrapeData#screenshot_params
@@ -4137,7 +4147,7 @@ class BatchUnifiedCrawlData < ContextDev::Internal::Type::BaseModel
41374147
api_name: :sharedParams
41384148

41394149
# @!attribute tags
4140-
# Labels for tracking request usage. Not retained when zdr is enabled.
4150+
# Labels for filtering usage in the dashboard.
41414151
#
41424152
# @return [Array<String>, nil]
41434153
optional :tags, ContextDev::Internal::Type::ArrayOf[String]
@@ -4190,7 +4200,7 @@ class BatchUnifiedCrawlData < ContextDev::Internal::Type::BaseModel
41904200
#
41914201
# @param shared_params [ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::BatchUnifiedCrawlData::SharedParams] Browser and content settings shared by all outputs.
41924202
#
4193-
# @param tags [Array<String>] Labels for tracking request usage. Not retained when zdr is enabled.
4203+
# @param tags [Array<String>] Labels for filtering usage in the dashboard.
41944204
#
41954205
# @param timeout_opts [ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::BatchUnifiedCrawlData::TimeoutOpts] Deadline for each page, using the same behavior and defaults as POST /web/scrape
41964206
#
@@ -5140,10 +5150,20 @@ class ProductParams < ContextDev::Internal::Type::BaseModel
51405150
# @return [Boolean, nil]
51415151
optional :dedupe_images, ContextDev::Internal::Type::Boolean, api_name: :dedupeImages
51425152

5143-
# @!method initialize(dedupe_images: nil)
5153+
# @!attribute use_ai_fallback
5154+
# @deprecated
5155+
#
5156+
# Ignored. The AI fallback runs automatically.
5157+
#
5158+
# @return [Boolean, nil]
5159+
optional :use_ai_fallback, ContextDev::Internal::Type::Boolean, api_name: :useAIFallback
5160+
5161+
# @!method initialize(dedupe_images: nil, use_ai_fallback: nil)
51445162
# Product options. Requires formats.product: true.
51455163
#
51465164
# @param dedupe_images [Boolean] Drop visually duplicate product images, keeping the largest copy.
5165+
#
5166+
# @param use_ai_fallback [Boolean] Ignored. The AI fallback runs automatically.
51475167
end
51485168

51495169
# @see ContextDev::Models::BatchSubmitParams::Input::Crawl::Data::BatchUnifiedCrawlData#screenshot_params

‎lib/context_dev/models/web_scrape_params.rb‎

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,13 @@ class WebScrapeParams < ContextDev::Internal::Type::BaseModel
8585
optional :shared_params, -> { ContextDev::WebScrapeParams::SharedParams }, api_name: :sharedParams
8686

8787
# @!attribute tags
88-
# Labels for tracking request usage. Not retained when zdr is enabled.
88+
# Labels for filtering usage in the dashboard.
8989
#
9090
# @return [Array<String>, nil]
9191
optional :tags, ContextDev::Internal::Type::ArrayOf[String]
9292

9393
# @!attribute timeout_opts
94-
# Deadline for the whole request. Defaults to 90000 ms with `fail`. Fixed waits
95-
# must end before it.
94+
# Request deadline and what to return when it passes.
9695
#
9796
# @return [ContextDev::Models::WebScrapeParams::TimeoutOpts, nil]
9897
optional :timeout_opts, -> { ContextDev::WebScrapeParams::TimeoutOpts }, api_name: :timeoutOpts
@@ -131,9 +130,9 @@ class WebScrapeParams < ContextDev::Internal::Type::BaseModel
131130
#
132131
# @param shared_params [ContextDev::Models::WebScrapeParams::SharedParams] Browser and content settings shared by all outputs.
133132
#
134-
# @param tags [Array<String>] Labels for tracking request usage. Not retained when zdr is enabled.
133+
# @param tags [Array<String>] Labels for filtering usage in the dashboard.
135134
#
136-
# @param timeout_opts [ContextDev::Models::WebScrapeParams::TimeoutOpts] Deadline for the whole request. Defaults to 90000 ms with `fail`. Fixed waits mu
135+
# @param timeout_opts [ContextDev::Models::WebScrapeParams::TimeoutOpts] Request deadline and what to return when it passes.
137136
#
138137
# @param zdr [Symbol, ContextDev::Models::WebScrapeParams::Zdr] `enabled` turns on zero data retention. Your organization must have ZDR enabled.
139138
#
@@ -755,10 +754,20 @@ class ProductParams < ContextDev::Internal::Type::BaseModel
755754
# @return [Boolean, nil]
756755
optional :dedupe_images, ContextDev::Internal::Type::Boolean, api_name: :dedupeImages
757756

758-
# @!method initialize(dedupe_images: nil)
757+
# @!attribute use_ai_fallback
758+
# @deprecated
759+
#
760+
# Ignored. The AI fallback runs automatically.
761+
#
762+
# @return [Boolean, nil]
763+
optional :use_ai_fallback, ContextDev::Internal::Type::Boolean, api_name: :useAIFallback
764+
765+
# @!method initialize(dedupe_images: nil, use_ai_fallback: nil)
759766
# Product options. Requires formats.product: true.
760767
#
761768
# @param dedupe_images [Boolean] Drop visually duplicate product images, keeping the largest copy.
769+
#
770+
# @param use_ai_fallback [Boolean] Ignored. The AI fallback runs automatically.
762771
end
763772

764773
class ScreenshotParams < ContextDev::Internal::Type::BaseModel
@@ -1394,8 +1403,7 @@ class TimeoutOpts < ContextDev::Internal::Type::BaseModel
13941403
# Some parameter documentations has been truncated, see
13951404
# {ContextDev::Models::WebScrapeParams::TimeoutOpts} for more details.
13961405
#
1397-
# Deadline for the whole request. Defaults to 90000 ms with `fail`. Fixed waits
1398-
# must end before it.
1406+
# Request deadline and what to return when it passes.
13991407
#
14001408
# @param milliseconds [Integer] Deadline in milliseconds.
14011409
#

‎lib/context_dev/resources/web.rb‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,9 @@ def map_urls(params)
209209
#
210210
# @param shared_params [ContextDev::Models::WebScrapeParams::SharedParams] Browser and content settings shared by all outputs.
211211
#
212-
# @param tags [Array<String>] Labels for tracking request usage. Not retained when zdr is enabled.
212+
# @param tags [Array<String>] Labels for filtering usage in the dashboard.
213213
#
214-
# @param timeout_opts [ContextDev::Models::WebScrapeParams::TimeoutOpts] Deadline for the whole request. Defaults to 90000 ms with `fail`. Fixed waits mu
214+
# @param timeout_opts [ContextDev::Models::WebScrapeParams::TimeoutOpts] Request deadline and what to return when it passes.
215215
#
216216
# @param zdr [Symbol, ContextDev::Models::WebScrapeParams::Zdr] `enabled` turns on zero data retention. Your organization must have ZDR enabled.
217217
#

‎rbi/context_dev/models/batch_submit_params.rbi‎

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3376,7 +3376,7 @@ module ContextDev
33763376
end
33773377
attr_writer :shared_params
33783378

3379-
# Labels for tracking request usage. Not retained when zdr is enabled.
3379+
# Labels for filtering usage in the dashboard.
33803380
sig { returns(T.nilable(T::Array[String])) }
33813381
attr_reader :tags
33823382

@@ -3482,7 +3482,7 @@ module ContextDev
34823482
screenshot_params: nil,
34833483
# Browser and content settings shared by all outputs.
34843484
shared_params: nil,
3485-
# Labels for tracking request usage. Not retained when zdr is enabled.
3485+
# Labels for filtering usage in the dashboard.
34863486
tags: nil,
34873487
# Deadline for each page, using the same behavior and defaults as POST
34883488
# /web/scrape.
@@ -4973,17 +4973,33 @@ module ContextDev
49734973
sig { params(dedupe_images: T::Boolean).void }
49744974
attr_writer :dedupe_images
49754975

4976+
# Ignored. The AI fallback runs automatically.
4977+
sig { returns(T.nilable(T::Boolean)) }
4978+
attr_reader :use_ai_fallback
4979+
4980+
sig { params(use_ai_fallback: T::Boolean).void }
4981+
attr_writer :use_ai_fallback
4982+
49764983
# Product options. Requires formats.product: true.
49774984
sig do
4978-
params(dedupe_images: T::Boolean).returns(T.attached_class)
4985+
params(
4986+
dedupe_images: T::Boolean,
4987+
use_ai_fallback: T::Boolean
4988+
).returns(T.attached_class)
49794989
end
49804990
def self.new(
49814991
# Drop visually duplicate product images, keeping the largest copy.
4982-
dedupe_images: nil
4992+
dedupe_images: nil,
4993+
# Ignored. The AI fallback runs automatically.
4994+
use_ai_fallback: nil
49834995
)
49844996
end
49854997

4986-
sig { override.returns({ dedupe_images: T::Boolean }) }
4998+
sig do
4999+
override.returns(
5000+
{ dedupe_images: T::Boolean, use_ai_fallback: T::Boolean }
5001+
)
5002+
end
49875003
def to_hash
49885004
end
49895005
end
@@ -11204,7 +11220,7 @@ module ContextDev
1120411220
end
1120511221
attr_writer :shared_params
1120611222

11207-
# Labels for tracking request usage. Not retained when zdr is enabled.
11223+
# Labels for filtering usage in the dashboard.
1120811224
sig { returns(T.nilable(T::Array[String])) }
1120911225
attr_reader :tags
1121011226

@@ -11311,7 +11327,7 @@ module ContextDev
1131111327
screenshot_params: nil,
1131211328
# Browser and content settings shared by all outputs.
1131311329
shared_params: nil,
11314-
# Labels for tracking request usage. Not retained when zdr is enabled.
11330+
# Labels for filtering usage in the dashboard.
1131511331
tags: nil,
1131611332
# Deadline for each page, using the same behavior and defaults as POST
1131711333
# /web/scrape.
@@ -13546,17 +13562,33 @@ module ContextDev
1354613562
sig { params(dedupe_images: T::Boolean).void }
1354713563
attr_writer :dedupe_images
1354813564

13565+
# Ignored. The AI fallback runs automatically.
13566+
sig { returns(T.nilable(T::Boolean)) }
13567+
attr_reader :use_ai_fallback
13568+
13569+
sig { params(use_ai_fallback: T::Boolean).void }
13570+
attr_writer :use_ai_fallback
13571+
1354913572
# Product options. Requires formats.product: true.
1355013573
sig do
13551-
params(dedupe_images: T::Boolean).returns(T.attached_class)
13574+
params(
13575+
dedupe_images: T::Boolean,
13576+
use_ai_fallback: T::Boolean
13577+
).returns(T.attached_class)
1355213578
end
1355313579
def self.new(
1355413580
# Drop visually duplicate product images, keeping the largest copy.
13555-
dedupe_images: nil
13581+
dedupe_images: nil,
13582+
# Ignored. The AI fallback runs automatically.
13583+
use_ai_fallback: nil
1355613584
)
1355713585
end
1355813586

13559-
sig { override.returns({ dedupe_images: T::Boolean }) }
13587+
sig do
13588+
override.returns(
13589+
{ dedupe_images: T::Boolean, use_ai_fallback: T::Boolean }
13590+
)
13591+
end
1356013592
def to_hash
1356113593
end
1356213594
end

‎rbi/context_dev/models/web_scrape_params.rbi‎

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -140,15 +140,14 @@ module ContextDev
140140
end
141141
attr_writer :shared_params
142142

143-
# Labels for tracking request usage. Not retained when zdr is enabled.
143+
# Labels for filtering usage in the dashboard.
144144
sig { returns(T.nilable(T::Array[String])) }
145145
attr_reader :tags
146146

147147
sig { params(tags: T::Array[String]).void }
148148
attr_writer :tags
149149

150-
# Deadline for the whole request. Defaults to 90000 ms with `fail`. Fixed waits
151-
# must end before it.
150+
# Request deadline and what to return when it passes.
152151
sig { returns(T.nilable(ContextDev::WebScrapeParams::TimeoutOpts)) }
153152
attr_reader :timeout_opts
154153

@@ -218,10 +217,9 @@ module ContextDev
218217
screenshot_params: nil,
219218
# Browser and content settings shared by all outputs.
220219
shared_params: nil,
221-
# Labels for tracking request usage. Not retained when zdr is enabled.
220+
# Labels for filtering usage in the dashboard.
222221
tags: nil,
223-
# Deadline for the whole request. Defaults to 90000 ms with `fail`. Fixed waits
224-
# must end before it.
222+
# Request deadline and what to return when it passes.
225223
timeout_opts: nil,
226224
# `enabled` turns on zero data retention. Your organization must have ZDR enabled.
227225
zdr: nil,
@@ -1623,15 +1621,33 @@ module ContextDev
16231621
sig { params(dedupe_images: T::Boolean).void }
16241622
attr_writer :dedupe_images
16251623

1624+
# Ignored. The AI fallback runs automatically.
1625+
sig { returns(T.nilable(T::Boolean)) }
1626+
attr_reader :use_ai_fallback
1627+
1628+
sig { params(use_ai_fallback: T::Boolean).void }
1629+
attr_writer :use_ai_fallback
1630+
16261631
# Product options. Requires formats.product: true.
1627-
sig { params(dedupe_images: T::Boolean).returns(T.attached_class) }
1632+
sig do
1633+
params(
1634+
dedupe_images: T::Boolean,
1635+
use_ai_fallback: T::Boolean
1636+
).returns(T.attached_class)
1637+
end
16281638
def self.new(
16291639
# Drop visually duplicate product images, keeping the largest copy.
1630-
dedupe_images: nil
1640+
dedupe_images: nil,
1641+
# Ignored. The AI fallback runs automatically.
1642+
use_ai_fallback: nil
16311643
)
16321644
end
16331645

1634-
sig { override.returns({ dedupe_images: T::Boolean }) }
1646+
sig do
1647+
override.returns(
1648+
{ dedupe_images: T::Boolean, use_ai_fallback: T::Boolean }
1649+
)
1650+
end
16351651
def to_hash
16361652
end
16371653
end
@@ -2963,8 +2979,7 @@ module ContextDev
29632979
end
29642980
attr_writer :behavior
29652981

2966-
# Deadline for the whole request. Defaults to 90000 ms with `fail`. Fixed waits
2967-
# must end before it.
2982+
# Request deadline and what to return when it passes.
29682983
sig do
29692984
params(
29702985
milliseconds: Integer,

‎rbi/context_dev/resources/web.rbi‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,9 @@ module ContextDev
219219
screenshot_params: nil,
220220
# Browser and content settings shared by all outputs.
221221
shared_params: nil,
222-
# Labels for tracking request usage. Not retained when zdr is enabled.
222+
# Labels for filtering usage in the dashboard.
223223
tags: nil,
224-
# Deadline for the whole request. Defaults to 90000 ms with `fail`. Fixed waits
225-
# must end before it.
224+
# Request deadline and what to return when it passes.
226225
timeout_opts: nil,
227226
# `enabled` turns on zero data retention. Your organization must have ZDR enabled.
228227
zdr: nil,

0 commit comments

Comments
 (0)