context.dev 2.16.0 → 2.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/README.md +1 -1
- data/lib/context_dev/models/ai_extract_product_params.rb +53 -8
- data/lib/context_dev/models/ai_extract_product_response.rb +10 -1
- data/lib/context_dev/models/ai_extract_products_params.rb +116 -16
- data/lib/context_dev/models/ai_extract_products_response.rb +11 -1
- data/lib/context_dev/models/brand_retrieve_params.rb +355 -60
- data/lib/context_dev/models/brand_retrieve_response.rb +10 -1
- data/lib/context_dev/models/brand_retrieve_simplified_params.rb +57 -11
- data/lib/context_dev/models/brand_retrieve_simplified_response.rb +10 -1
- data/lib/context_dev/models/industry_retrieve_naics_params.rb +53 -8
- data/lib/context_dev/models/industry_retrieve_naics_response.rb +10 -1
- data/lib/context_dev/models/industry_retrieve_sic_params.rb +53 -8
- data/lib/context_dev/models/industry_retrieve_sic_response.rb +10 -1
- data/lib/context_dev/models/monitor_create_params.rb +27 -3
- data/lib/context_dev/models/monitor_create_response.rb +30 -5
- data/lib/context_dev/models/monitor_list_response.rb +30 -5
- data/lib/context_dev/models/monitor_retrieve_response.rb +30 -5
- data/lib/context_dev/models/monitor_update_params.rb +27 -3
- data/lib/context_dev/models/monitor_update_response.rb +30 -5
- data/lib/context_dev/models/person_enrich_params.rb +53 -8
- data/lib/context_dev/models/person_enrich_response.rb +10 -1
- data/lib/context_dev/models/utility_prefetch_params.rb +48 -8
- data/lib/context_dev/models/web_answers_params.rb +124 -0
- data/lib/context_dev/models/web_answers_response.rb +68 -0
- data/lib/context_dev/models/web_extract_competitors_params.rb +53 -8
- data/lib/context_dev/models/web_extract_competitors_response.rb +10 -1
- data/lib/context_dev/models/web_extract_fonts_params.rb +58 -11
- data/lib/context_dev/models/web_extract_fonts_response.rb +32 -1
- data/lib/context_dev/models/web_extract_params.rb +53 -8
- data/lib/context_dev/models/web_extract_response.rb +10 -1
- data/lib/context_dev/models/web_extract_styleguide_params.rb +58 -11
- data/lib/context_dev/models/web_extract_styleguide_response.rb +32 -1
- data/lib/context_dev/models/web_screenshot_params.rb +58 -10
- data/lib/context_dev/models/web_screenshot_response.rb +32 -1
- data/lib/context_dev/models/web_search_params.rb +112 -16
- data/lib/context_dev/models/web_search_response.rb +43 -2
- data/lib/context_dev/models/web_web_crawl_md_params.rb +53 -8
- data/lib/context_dev/models/web_web_crawl_md_response.rb +11 -1
- data/lib/context_dev/models/web_web_scrape_bytes_params.rb +344 -0
- data/lib/context_dev/models/web_web_scrape_bytes_response.rb +135 -0
- data/lib/context_dev/models/web_web_scrape_html_params.rb +57 -10
- data/lib/context_dev/models/web_web_scrape_html_response.rb +32 -1
- data/lib/context_dev/models/web_web_scrape_images_params.rb +57 -10
- data/lib/context_dev/models/web_web_scrape_images_response.rb +42 -1
- data/lib/context_dev/models/web_web_scrape_md_params.rb +57 -10
- data/lib/context_dev/models/web_web_scrape_md_response.rb +32 -1
- data/lib/context_dev/models/web_web_scrape_sitemap_params.rb +53 -8
- data/lib/context_dev/models/web_web_scrape_sitemap_response.rb +11 -1
- data/lib/context_dev/models.rb +4 -0
- data/lib/context_dev/resources/ai.rb +2 -2
- data/lib/context_dev/resources/brand.rb +3 -3
- data/lib/context_dev/resources/industry.rb +6 -6
- data/lib/context_dev/resources/people.rb +2 -2
- data/lib/context_dev/resources/utility.rb +2 -2
- data/lib/context_dev/resources/web.rb +119 -33
- data/lib/context_dev/version.rb +1 -1
- data/lib/context_dev.rb +4 -0
- data/rbi/context_dev/models/ai_extract_product_params.rbi +125 -13
- data/rbi/context_dev/models/ai_extract_product_response.rbi +13 -0
- data/rbi/context_dev/models/ai_extract_products_params.rbi +264 -26
- data/rbi/context_dev/models/ai_extract_products_response.rbi +15 -0
- data/rbi/context_dev/models/brand_retrieve_params.rbi +816 -102
- data/rbi/context_dev/models/brand_retrieve_response.rbi +13 -0
- data/rbi/context_dev/models/brand_retrieve_simplified_params.rbi +136 -19
- data/rbi/context_dev/models/brand_retrieve_simplified_response.rbi +13 -0
- data/rbi/context_dev/models/industry_retrieve_naics_params.rbi +127 -13
- data/rbi/context_dev/models/industry_retrieve_naics_response.rbi +13 -0
- data/rbi/context_dev/models/industry_retrieve_sic_params.rbi +127 -13
- data/rbi/context_dev/models/industry_retrieve_sic_response.rbi +13 -0
- data/rbi/context_dev/models/monitor_create_params.rbi +40 -2
- data/rbi/context_dev/models/monitor_create_response.rbi +44 -4
- data/rbi/context_dev/models/monitor_list_response.rbi +44 -4
- data/rbi/context_dev/models/monitor_retrieve_response.rbi +44 -4
- data/rbi/context_dev/models/monitor_update_params.rbi +40 -2
- data/rbi/context_dev/models/monitor_update_response.rbi +44 -4
- data/rbi/context_dev/models/person_enrich_params.rbi +123 -13
- data/rbi/context_dev/models/person_enrich_response.rbi +16 -3
- data/rbi/context_dev/models/utility_prefetch_params.rbi +112 -13
- data/rbi/context_dev/models/web_answers_params.rbi +234 -0
- data/rbi/context_dev/models/web_answers_response.rbi +122 -0
- data/rbi/context_dev/models/web_extract_competitors_params.rbi +127 -13
- data/rbi/context_dev/models/web_extract_competitors_response.rbi +16 -3
- data/rbi/context_dev/models/web_extract_fonts_params.rbi +132 -19
- data/rbi/context_dev/models/web_extract_fonts_response.rbi +71 -0
- data/rbi/context_dev/models/web_extract_params.rbi +120 -13
- data/rbi/context_dev/models/web_extract_response.rbi +16 -3
- data/rbi/context_dev/models/web_extract_styleguide_params.rbi +136 -19
- data/rbi/context_dev/models/web_extract_styleguide_response.rbi +71 -0
- data/rbi/context_dev/models/web_screenshot_params.rbi +132 -17
- data/rbi/context_dev/models/web_screenshot_response.rbi +71 -0
- data/rbi/context_dev/models/web_search_params.rbi +253 -26
- data/rbi/context_dev/models/web_search_response.rbi +92 -6
- data/rbi/context_dev/models/web_web_crawl_md_params.rbi +123 -13
- data/rbi/context_dev/models/web_web_crawl_md_response.rbi +19 -3
- data/rbi/context_dev/models/web_web_scrape_bytes_params.rbi +699 -0
- data/rbi/context_dev/models/web_web_scrape_bytes_response.rbi +238 -0
- data/rbi/context_dev/models/web_web_scrape_html_params.rbi +132 -17
- data/rbi/context_dev/models/web_web_scrape_html_response.rbi +61 -0
- data/rbi/context_dev/models/web_web_scrape_images_params.rbi +134 -17
- data/rbi/context_dev/models/web_web_scrape_images_response.rbi +89 -3
- data/rbi/context_dev/models/web_web_scrape_md_params.rbi +130 -17
- data/rbi/context_dev/models/web_web_scrape_md_response.rbi +61 -0
- data/rbi/context_dev/models/web_web_scrape_sitemap_params.rbi +127 -13
- data/rbi/context_dev/models/web_web_scrape_sitemap_response.rbi +18 -3
- data/rbi/context_dev/models.rbi +4 -0
- data/rbi/context_dev/resources/ai.rbi +5 -5
- data/rbi/context_dev/resources/brand.rbi +9 -8
- data/rbi/context_dev/resources/industry.rbi +12 -10
- data/rbi/context_dev/resources/people.rbi +5 -5
- data/rbi/context_dev/resources/utility.rbi +5 -5
- data/rbi/context_dev/resources/web.rbi +170 -72
- data/sig/context_dev/models/ai_extract_product_params.rbs +44 -5
- data/sig/context_dev/models/ai_extract_product_response.rbs +7 -0
- data/sig/context_dev/models/ai_extract_products_params.rbs +88 -10
- data/sig/context_dev/models/ai_extract_products_response.rbs +7 -0
- data/sig/context_dev/models/brand_retrieve_params.rbs +264 -30
- data/sig/context_dev/models/brand_retrieve_response.rbs +7 -0
- data/sig/context_dev/models/brand_retrieve_simplified_params.rbs +44 -5
- data/sig/context_dev/models/brand_retrieve_simplified_response.rbs +7 -0
- data/sig/context_dev/models/industry_retrieve_naics_params.rbs +44 -5
- data/sig/context_dev/models/industry_retrieve_naics_response.rbs +7 -0
- data/sig/context_dev/models/industry_retrieve_sic_params.rbs +44 -5
- data/sig/context_dev/models/industry_retrieve_sic_response.rbs +7 -0
- data/sig/context_dev/models/monitor_create_params.rbs +14 -0
- data/sig/context_dev/models/monitor_create_response.rbs +14 -0
- data/sig/context_dev/models/monitor_list_response.rbs +14 -0
- data/sig/context_dev/models/monitor_retrieve_response.rbs +14 -0
- data/sig/context_dev/models/monitor_update_params.rbs +14 -0
- data/sig/context_dev/models/monitor_update_response.rbs +14 -0
- data/sig/context_dev/models/person_enrich_params.rbs +44 -5
- data/sig/context_dev/models/person_enrich_response.rbs +10 -3
- data/sig/context_dev/models/utility_prefetch_params.rbs +43 -5
- data/sig/context_dev/models/web_answers_params.rbs +106 -0
- data/sig/context_dev/models/web_answers_response.rbs +60 -0
- data/sig/context_dev/models/web_extract_competitors_params.rbs +44 -5
- data/sig/context_dev/models/web_extract_competitors_response.rbs +10 -3
- data/sig/context_dev/models/web_extract_fonts_params.rbs +44 -5
- data/sig/context_dev/models/web_extract_fonts_response.rbs +20 -0
- data/sig/context_dev/models/web_extract_params.rbs +44 -5
- data/sig/context_dev/models/web_extract_response.rbs +10 -3
- data/sig/context_dev/models/web_extract_styleguide_params.rbs +44 -5
- data/sig/context_dev/models/web_extract_styleguide_response.rbs +20 -0
- data/sig/context_dev/models/web_screenshot_params.rbs +44 -5
- data/sig/context_dev/models/web_screenshot_response.rbs +20 -0
- data/sig/context_dev/models/web_search_params.rbs +88 -10
- data/sig/context_dev/models/web_search_response.rbs +33 -6
- data/sig/context_dev/models/web_web_crawl_md_params.rbs +44 -5
- data/sig/context_dev/models/web_web_crawl_md_response.rbs +10 -3
- data/sig/context_dev/models/web_web_scrape_bytes_params.rbs +531 -0
- data/sig/context_dev/models/web_web_scrape_bytes_response.rbs +108 -0
- data/sig/context_dev/models/web_web_scrape_html_params.rbs +44 -5
- data/sig/context_dev/models/web_web_scrape_html_response.rbs +16 -0
- data/sig/context_dev/models/web_web_scrape_images_params.rbs +44 -5
- data/sig/context_dev/models/web_web_scrape_images_response.rbs +30 -3
- data/sig/context_dev/models/web_web_scrape_md_params.rbs +44 -5
- data/sig/context_dev/models/web_web_scrape_md_response.rbs +16 -0
- data/sig/context_dev/models/web_web_scrape_sitemap_params.rbs +44 -5
- data/sig/context_dev/models/web_web_scrape_sitemap_response.rbs +10 -3
- data/sig/context_dev/models.rbs +4 -0
- data/sig/context_dev/resources/ai.rbs +1 -1
- data/sig/context_dev/resources/brand.rbs +1 -1
- data/sig/context_dev/resources/industry.rbs +2 -2
- data/sig/context_dev/resources/people.rbs +1 -1
- data/sig/context_dev/resources/utility.rbs +1 -1
- data/sig/context_dev/resources/web.rbs +30 -11
- metadata +14 -2
|
@@ -3,6 +3,45 @@
|
|
|
3
3
|
module ContextDev
|
|
4
4
|
module Resources
|
|
5
5
|
class Web
|
|
6
|
+
# Researches the live web and returns a sourced answer in your requested JSON
|
|
7
|
+
# shape. Select fast for a smaller research budget at 10 credits or ultra for
|
|
8
|
+
# deeper reasoning at 100 credits. Defaults to ultra. Fast research is limited to
|
|
9
|
+
# 30 seconds and ultra to 50 seconds; timeoutOpts.milliseconds can shorten either
|
|
10
|
+
# deadline.
|
|
11
|
+
sig do
|
|
12
|
+
params(
|
|
13
|
+
task: String,
|
|
14
|
+
json_format: T::Hash[Symbol, T.anything],
|
|
15
|
+
mode: ContextDev::WebAnswersParams::Mode::OrSymbol,
|
|
16
|
+
tags: T::Array[String],
|
|
17
|
+
timeout_opts: ContextDev::WebAnswersParams::TimeoutOpts::OrHash,
|
|
18
|
+
request_options: ContextDev::RequestOptions::OrHash
|
|
19
|
+
).returns(ContextDev::Models::WebAnswersResponse)
|
|
20
|
+
end
|
|
21
|
+
def answers(
|
|
22
|
+
# What to research and answer, in plain language. Naming a domain in the task (for
|
|
23
|
+
# example "pricing on context.dev") makes the agent read that site before it
|
|
24
|
+
# searches.
|
|
25
|
+
task:,
|
|
26
|
+
# An example object with placeholder values (for example {"pricing_page_url": "",
|
|
27
|
+
# "plans": [{"name": "", "price": 0}]}). Object keys and value types are
|
|
28
|
+
# preserved; unknown values may be null. Empty arrays accept any JSON items.
|
|
29
|
+
# Defaults to {"result": ""}. Maximum 8 levels, 500 values, and 16000 characters.
|
|
30
|
+
json_format: nil,
|
|
31
|
+
# Research level: fast uses a smaller model and research budget for 10 credits;
|
|
32
|
+
# ultra uses deeper reasoning and research for 100 credits. Defaults to ultra.
|
|
33
|
+
# Only successful requests consume credits.
|
|
34
|
+
mode: nil,
|
|
35
|
+
# Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
|
|
36
|
+
tags: nil,
|
|
37
|
+
# Optional request deadline and behavior on timeout. For GET requests, use
|
|
38
|
+
# timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded
|
|
39
|
+
# timeoutOpts object.
|
|
40
|
+
timeout_opts: nil,
|
|
41
|
+
request_options: {}
|
|
42
|
+
)
|
|
43
|
+
end
|
|
44
|
+
|
|
6
45
|
# Crawl a website, use the provided JSON Schema and instructions to prioritize
|
|
7
46
|
# relevant internal links, and extract structured data from the selected pages.
|
|
8
47
|
sig do
|
|
@@ -28,7 +67,7 @@ module ContextDev
|
|
|
28
67
|
settle_animations: T::Boolean,
|
|
29
68
|
stop_after_ms: Integer,
|
|
30
69
|
tags: T::Array[String],
|
|
31
|
-
|
|
70
|
+
timeout_opts: ContextDev::WebExtractParams::TimeoutOpts::OrHash,
|
|
32
71
|
wait_for_ms: Integer,
|
|
33
72
|
request_options: ContextDev::RequestOptions::OrHash
|
|
34
73
|
).returns(ContextDev::Models::WebExtractResponse)
|
|
@@ -81,10 +120,10 @@ module ContextDev
|
|
|
81
120
|
stop_after_ms: nil,
|
|
82
121
|
# Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
|
|
83
122
|
tags: nil,
|
|
84
|
-
# Optional
|
|
85
|
-
#
|
|
86
|
-
#
|
|
87
|
-
|
|
123
|
+
# Optional request deadline and behavior on timeout. For GET requests, use
|
|
124
|
+
# timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded
|
|
125
|
+
# timeoutOpts object.
|
|
126
|
+
timeout_opts: nil,
|
|
88
127
|
# Optional browser wait time in milliseconds after initial page load for each
|
|
89
128
|
# crawled page.
|
|
90
129
|
wait_for_ms: nil,
|
|
@@ -99,7 +138,8 @@ module ContextDev
|
|
|
99
138
|
domain: String,
|
|
100
139
|
num_competitors: Integer,
|
|
101
140
|
tags: T::Array[String],
|
|
102
|
-
|
|
141
|
+
timeout_opts:
|
|
142
|
+
ContextDev::WebExtractCompetitorsParams::TimeoutOpts::OrHash,
|
|
103
143
|
request_options: ContextDev::RequestOptions::OrHash
|
|
104
144
|
).returns(ContextDev::Models::WebExtractCompetitorsResponse)
|
|
105
145
|
end
|
|
@@ -112,10 +152,10 @@ module ContextDev
|
|
|
112
152
|
# Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50
|
|
113
153
|
# characters.
|
|
114
154
|
tags: nil,
|
|
115
|
-
# Optional
|
|
116
|
-
#
|
|
117
|
-
#
|
|
118
|
-
|
|
155
|
+
# Optional request deadline and behavior on timeout. For GET requests, use
|
|
156
|
+
# timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded
|
|
157
|
+
# timeoutOpts object.
|
|
158
|
+
timeout_opts: nil,
|
|
119
159
|
request_options: {}
|
|
120
160
|
)
|
|
121
161
|
end
|
|
@@ -128,7 +168,7 @@ module ContextDev
|
|
|
128
168
|
domain: String,
|
|
129
169
|
max_age_ms: T.nilable(Integer),
|
|
130
170
|
tags: T::Array[String],
|
|
131
|
-
|
|
171
|
+
timeout_opts: ContextDev::WebExtractFontsParams::TimeoutOpts::OrHash,
|
|
132
172
|
request_options: ContextDev::RequestOptions::OrHash
|
|
133
173
|
).returns(ContextDev::Models::WebExtractFontsResponse)
|
|
134
174
|
end
|
|
@@ -142,17 +182,17 @@ module ContextDev
|
|
|
142
182
|
# 'domain' or 'directUrl', but not both.
|
|
143
183
|
domain: nil,
|
|
144
184
|
# Maximum age in milliseconds for cached brand data before the API performs a hard
|
|
145
|
-
# refresh. Defaults to 3 months (7776000000 ms).
|
|
146
|
-
# are clamped to
|
|
147
|
-
# year.
|
|
185
|
+
# refresh. Defaults to 3 months (7776000000 ms). Set to 0 to always perform a hard
|
|
186
|
+
# refresh. Negative values are clamped to 0; values above 1 year (31536000000 ms)
|
|
187
|
+
# are clamped to 1 year.
|
|
148
188
|
max_age_ms: nil,
|
|
149
189
|
# Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50
|
|
150
190
|
# characters.
|
|
151
191
|
tags: nil,
|
|
152
|
-
# Optional
|
|
153
|
-
#
|
|
154
|
-
#
|
|
155
|
-
|
|
192
|
+
# Optional request deadline and behavior on timeout. For GET requests, use
|
|
193
|
+
# timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded
|
|
194
|
+
# timeoutOpts object.
|
|
195
|
+
timeout_opts: nil,
|
|
156
196
|
request_options: {}
|
|
157
197
|
)
|
|
158
198
|
end
|
|
@@ -167,7 +207,8 @@ module ContextDev
|
|
|
167
207
|
domain: String,
|
|
168
208
|
max_age_ms: T.nilable(Integer),
|
|
169
209
|
tags: T::Array[String],
|
|
170
|
-
|
|
210
|
+
timeout_opts:
|
|
211
|
+
ContextDev::WebExtractStyleguideParams::TimeoutOpts::OrHash,
|
|
171
212
|
request_options: ContextDev::RequestOptions::OrHash
|
|
172
213
|
).returns(ContextDev::Models::WebExtractStyleguideResponse)
|
|
173
214
|
end
|
|
@@ -185,17 +226,17 @@ module ContextDev
|
|
|
185
226
|
# 'domain' or 'directUrl', but not both.
|
|
186
227
|
domain: nil,
|
|
187
228
|
# Maximum age in milliseconds for cached brand data before the API performs a hard
|
|
188
|
-
# refresh. Defaults to 3 months (7776000000 ms).
|
|
189
|
-
# are clamped to
|
|
190
|
-
# year.
|
|
229
|
+
# refresh. Defaults to 3 months (7776000000 ms). Set to 0 to always perform a hard
|
|
230
|
+
# refresh. Negative values are clamped to 0; values above 1 year (31536000000 ms)
|
|
231
|
+
# are clamped to 1 year.
|
|
191
232
|
max_age_ms: nil,
|
|
192
233
|
# Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50
|
|
193
234
|
# characters.
|
|
194
235
|
tags: nil,
|
|
195
|
-
# Optional
|
|
196
|
-
#
|
|
197
|
-
#
|
|
198
|
-
|
|
236
|
+
# Optional request deadline and behavior on timeout. For GET requests, use
|
|
237
|
+
# timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded
|
|
238
|
+
# timeoutOpts object.
|
|
239
|
+
timeout_opts: nil,
|
|
199
240
|
request_options: {}
|
|
200
241
|
)
|
|
201
242
|
end
|
|
@@ -215,7 +256,7 @@ module ContextDev
|
|
|
215
256
|
page: ContextDev::WebScreenshotParams::Page::OrSymbol,
|
|
216
257
|
scroll_offset: T.nilable(Integer),
|
|
217
258
|
tags: T::Array[String],
|
|
218
|
-
|
|
259
|
+
timeout_opts: ContextDev::WebScreenshotParams::TimeoutOpts::OrHash,
|
|
219
260
|
viewport: ContextDev::WebScreenshotParams::Viewport::OrHash,
|
|
220
261
|
wait_for_ms: T.nilable(Integer),
|
|
221
262
|
zdr: ContextDev::WebScreenshotParams::Zdr::OrSymbol,
|
|
@@ -271,16 +312,17 @@ module ContextDev
|
|
|
271
312
|
# Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50
|
|
272
313
|
# characters.
|
|
273
314
|
tags: nil,
|
|
274
|
-
# Optional
|
|
275
|
-
#
|
|
276
|
-
#
|
|
277
|
-
|
|
315
|
+
# Optional request deadline and behavior on timeout. For GET requests, use
|
|
316
|
+
# timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded
|
|
317
|
+
# timeoutOpts object.
|
|
318
|
+
timeout_opts: nil,
|
|
278
319
|
# Optional browser viewport dimensions for the screenshot. Defaults to 1920x1080.
|
|
279
320
|
viewport: nil,
|
|
280
321
|
# Optional browser wait time in milliseconds after initial page load before taking
|
|
281
322
|
# the screenshot. Min: 0. Max: 30000 (30 seconds). Defaults to 3000 ms when
|
|
282
|
-
# omitted. When combined with
|
|
283
|
-
# 10000 ms; a shorter deadline is rejected with 400
|
|
323
|
+
# omitted. When combined with timeoutOpts, timeoutOpts.milliseconds must be at
|
|
324
|
+
# least waitForMs + 10000 ms; a shorter deadline is rejected with 400
|
|
325
|
+
# TIMEOUT_TOO_SHORT_FOR_WAIT.
|
|
284
326
|
wait_for_ms: nil,
|
|
285
327
|
# Set to enabled to bypass shared caches and omit request and response content
|
|
286
328
|
# from retained usage logs. Requires zero data retention to be enabled for your
|
|
@@ -304,7 +346,7 @@ module ContextDev
|
|
|
304
346
|
num_results: Integer,
|
|
305
347
|
query_fanout: T::Boolean,
|
|
306
348
|
tags: T::Array[String],
|
|
307
|
-
|
|
349
|
+
timeout_opts: ContextDev::WebSearchParams::TimeoutOpts::OrHash,
|
|
308
350
|
request_options: ContextDev::RequestOptions::OrHash
|
|
309
351
|
).returns(ContextDev::Models::WebSearchResponse)
|
|
310
352
|
end
|
|
@@ -331,10 +373,10 @@ module ContextDev
|
|
|
331
373
|
query_fanout: nil,
|
|
332
374
|
# Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
|
|
333
375
|
tags: nil,
|
|
334
|
-
# Optional
|
|
335
|
-
#
|
|
336
|
-
#
|
|
337
|
-
|
|
376
|
+
# Optional request deadline and behavior on timeout. For GET requests, use
|
|
377
|
+
# timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded
|
|
378
|
+
# timeoutOpts object.
|
|
379
|
+
timeout_opts: nil,
|
|
338
380
|
request_options: {}
|
|
339
381
|
)
|
|
340
382
|
end
|
|
@@ -359,7 +401,7 @@ module ContextDev
|
|
|
359
401
|
shorten_base64_images: T::Boolean,
|
|
360
402
|
stop_after_ms: Integer,
|
|
361
403
|
tags: T::Array[String],
|
|
362
|
-
|
|
404
|
+
timeout_opts: ContextDev::WebWebCrawlMdParams::TimeoutOpts::OrHash,
|
|
363
405
|
url_regex: String,
|
|
364
406
|
use_main_content_only: T::Boolean,
|
|
365
407
|
wait_for_ms: Integer,
|
|
@@ -417,10 +459,10 @@ module ContextDev
|
|
|
417
459
|
stop_after_ms: nil,
|
|
418
460
|
# Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
|
|
419
461
|
tags: nil,
|
|
420
|
-
# Optional
|
|
421
|
-
#
|
|
422
|
-
#
|
|
423
|
-
|
|
462
|
+
# Optional request deadline and behavior on timeout. For GET requests, use
|
|
463
|
+
# timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded
|
|
464
|
+
# timeoutOpts object.
|
|
465
|
+
timeout_opts: nil,
|
|
424
466
|
# Regex pattern. Only URLs matching this pattern will be followed and scraped. An
|
|
425
467
|
# automatic prefix scope in the form ^<starting URL> follows a redirect of the
|
|
426
468
|
# starting page.
|
|
@@ -440,8 +482,62 @@ module ContextDev
|
|
|
440
482
|
)
|
|
441
483
|
end
|
|
442
484
|
|
|
485
|
+
# Downloads a resource and returns its bytes as base64. Supports images, PDFs,
|
|
486
|
+
# HTML pages, and any other content type without image conversion, text
|
|
487
|
+
# extraction, or character-encoding changes. HTTP compression is decoded before
|
|
488
|
+
# base64 encoding. HTML is the original HTTP response; JavaScript is not rendered.
|
|
489
|
+
# Follows public redirects and retries failed downloads through ISP and
|
|
490
|
+
# residential proxies, with a direct fallback. When country is specified, only a
|
|
491
|
+
# residential proxy in that country is used. Supply headers such as Referer for
|
|
492
|
+
# images that require a referring page. Downloads are not cached. Maximum decoded
|
|
493
|
+
# resource size: 20 MiB (20971520 bytes), before base64 encoding. Successful
|
|
494
|
+
# requests cost 1 credit; errors are not billed.
|
|
495
|
+
sig do
|
|
496
|
+
params(
|
|
497
|
+
url: String,
|
|
498
|
+
country: ContextDev::WebWebScrapeBytesParams::Country::OrSymbol,
|
|
499
|
+
headers: T::Hash[Symbol, String],
|
|
500
|
+
tags: T::Array[String],
|
|
501
|
+
timeout_opts:
|
|
502
|
+
ContextDev::WebWebScrapeBytesParams::TimeoutOpts::OrHash,
|
|
503
|
+
zdr: ContextDev::WebWebScrapeBytesParams::Zdr::OrSymbol,
|
|
504
|
+
request_options: ContextDev::RequestOptions::OrHash
|
|
505
|
+
).returns(ContextDev::Models::WebWebScrapeBytesResponse)
|
|
506
|
+
end
|
|
507
|
+
def web_scrape_bytes(
|
|
508
|
+
# Full HTTP(S) URL of the resource to download, such as an image, PDF, or page.
|
|
509
|
+
url:,
|
|
510
|
+
# Fetch the target page through a residential proxy in this country (ISO 3166-1
|
|
511
|
+
# alpha-2).
|
|
512
|
+
country: nil,
|
|
513
|
+
# Optional outbound HTTP headers, such as Referer, Cookie, or Authorization. Send
|
|
514
|
+
# as a JSON object or deep-object query params such as
|
|
515
|
+
# headers[Referer]=https://example.com/. Host, Content-Length, and hop-by-hop
|
|
516
|
+
# transport headers are rejected. Authorization and cookies are removed when a
|
|
517
|
+
# redirect changes origin.
|
|
518
|
+
headers: nil,
|
|
519
|
+
# Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50
|
|
520
|
+
# characters.
|
|
521
|
+
tags: nil,
|
|
522
|
+
# Optional request deadline and behavior on timeout. For GET requests, use
|
|
523
|
+
# timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded
|
|
524
|
+
# timeoutOpts object.
|
|
525
|
+
timeout_opts: nil,
|
|
526
|
+
# Set to enabled to bypass shared caches and omit request and response content
|
|
527
|
+
# from retained usage logs. Requires zero data retention to be enabled for your
|
|
528
|
+
# organization (contact support@context.dev), otherwise the request fails with
|
|
529
|
+
# ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.
|
|
530
|
+
zdr: nil,
|
|
531
|
+
request_options: {}
|
|
532
|
+
)
|
|
533
|
+
end
|
|
534
|
+
|
|
443
535
|
# Scrapes the given URL and returns the raw HTML content of the page. The base
|
|
444
|
-
# request costs 1 credit; requests with browser actions cost 2 credits.
|
|
536
|
+
# request costs 1 credit; requests with browser actions cost 2 credits. A request
|
|
537
|
+
# that hits its timeoutOpts.milliseconds deadline fails with 408 and is not
|
|
538
|
+
# billed, unless timeoutOpts.behavior=return-partial is set — then the page as
|
|
539
|
+
# rendered so far is returned with `finalDOMState: "still-loading"` and billed at
|
|
540
|
+
# the base cost of 1 credit.
|
|
445
541
|
sig do
|
|
446
542
|
params(
|
|
447
543
|
url: String,
|
|
@@ -464,7 +560,7 @@ module ContextDev
|
|
|
464
560
|
pdf: ContextDev::WebWebScrapeHTMLParams::Pdf::OrHash,
|
|
465
561
|
settle_animations: T::Boolean,
|
|
466
562
|
tags: T::Array[String],
|
|
467
|
-
|
|
563
|
+
timeout_opts: ContextDev::WebWebScrapeHTMLParams::TimeoutOpts::OrHash,
|
|
468
564
|
use_main_content_only: T::Boolean,
|
|
469
565
|
wait_for_ms: T.nilable(Integer),
|
|
470
566
|
zdr: ContextDev::WebWebScrapeHTMLParams::Zdr::OrSymbol,
|
|
@@ -509,16 +605,16 @@ module ContextDev
|
|
|
509
605
|
# Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50
|
|
510
606
|
# characters.
|
|
511
607
|
tags: nil,
|
|
512
|
-
# Optional
|
|
513
|
-
#
|
|
514
|
-
#
|
|
515
|
-
|
|
608
|
+
# Optional request deadline and behavior on timeout. For GET requests, use
|
|
609
|
+
# timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded
|
|
610
|
+
# timeoutOpts object.
|
|
611
|
+
timeout_opts: nil,
|
|
516
612
|
# When true, return only the page's main content in the HTML response, excluding
|
|
517
613
|
# headers, footers, sidebars, and navigation when detectable.
|
|
518
614
|
use_main_content_only: nil,
|
|
519
615
|
# Optional browser wait time in milliseconds after initial page load. Min: 0. Max:
|
|
520
|
-
# 30000 (30 seconds). When combined with
|
|
521
|
-
# waitForMs + 10000 ms; a shorter deadline is rejected with 400
|
|
616
|
+
# 30000 (30 seconds). When combined with timeoutOpts, timeoutOpts.milliseconds
|
|
617
|
+
# must be at least waitForMs + 10000 ms; a shorter deadline is rejected with 400
|
|
522
618
|
# TIMEOUT_TOO_SHORT_FOR_WAIT.
|
|
523
619
|
wait_for_ms: nil,
|
|
524
620
|
# Set to enabled to bypass shared caches and omit request and response content
|
|
@@ -554,7 +650,8 @@ module ContextDev
|
|
|
554
650
|
headers: T::Hash[Symbol, String],
|
|
555
651
|
max_age_ms: T.nilable(Integer),
|
|
556
652
|
tags: T::Array[String],
|
|
557
|
-
|
|
653
|
+
timeout_opts:
|
|
654
|
+
ContextDev::WebWebScrapeImagesParams::TimeoutOpts::OrHash,
|
|
558
655
|
wait_for_ms: T.nilable(Integer),
|
|
559
656
|
request_options: ContextDev::RequestOptions::OrHash
|
|
560
657
|
).returns(ContextDev::Models::WebWebScrapeImagesResponse)
|
|
@@ -584,14 +681,14 @@ module ContextDev
|
|
|
584
681
|
# Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50
|
|
585
682
|
# characters.
|
|
586
683
|
tags: nil,
|
|
587
|
-
# Optional
|
|
588
|
-
#
|
|
589
|
-
#
|
|
590
|
-
|
|
684
|
+
# Optional request deadline and behavior on timeout. For GET requests, use
|
|
685
|
+
# timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded
|
|
686
|
+
# timeoutOpts object.
|
|
687
|
+
timeout_opts: nil,
|
|
591
688
|
# Optional browser wait time in milliseconds after initial page load before
|
|
592
689
|
# collecting images. Min: 0. Max: 30000 (30 seconds). When combined with
|
|
593
|
-
#
|
|
594
|
-
# is rejected with 400 TIMEOUT_TOO_SHORT_FOR_WAIT.
|
|
690
|
+
# timeoutOpts, timeoutOpts.milliseconds must be at least waitForMs + 10000 ms; a
|
|
691
|
+
# shorter deadline is rejected with 400 TIMEOUT_TOO_SHORT_FOR_WAIT.
|
|
595
692
|
wait_for_ms: nil,
|
|
596
693
|
request_options: {}
|
|
597
694
|
)
|
|
@@ -617,11 +714,11 @@ module ContextDev
|
|
|
617
714
|
#
|
|
618
715
|
# | HTTP status | Billed? | Meaning |
|
|
619
716
|
# | ----------- | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
620
|
-
# | 200 | Yes — 1 credit, or 2 credits with actions | Successful scrape, including a zero-length result when includeSelectors matched nothing
|
|
717
|
+
# | 200 | Yes — 1 credit, or 2 credits with actions | Successful scrape, including a zero-length result when includeSelectors matched nothing. A partial result (`finalDOMState: "still-loading"`, only with timeoutOpts.behavior=return-partial) is billed at the base 1 credit with no OCR or actions surcharge |
|
|
621
718
|
# | 400 | No | Invalid input, skipped PDF, or the page could not be scraped. error_code WEBSITE_BLOCKED specifically means the site answered with an anti-bot challenge, CAPTCHA wall, or login shell instead of the page (even when the site returned HTTP 200) — retrying later or from another country sometimes succeeds |
|
|
622
719
|
# | 401 / 403 | No | Invalid/disabled key, insufficient permissions, or credits exhausted; inspect error_code |
|
|
623
720
|
# | 404 | No | Target page returned or fingerprinted as not found |
|
|
624
|
-
# | 408 | No | Request timed out
|
|
721
|
+
# | 408 | No | Request timed out. With timeoutOpts.behavior=return-partial this only happens when nothing usable had rendered by the deadline |
|
|
625
722
|
# | 413 | No | Target content exceeds the maximum supported size (20 MB) |
|
|
626
723
|
# | 415 | No | Unsupported content type |
|
|
627
724
|
# | 429 | No | Per-minute rate limit exceeded; honor Retry-After |
|
|
@@ -652,7 +749,7 @@ module ContextDev
|
|
|
652
749
|
settle_animations: T::Boolean,
|
|
653
750
|
shorten_base64_images: T::Boolean,
|
|
654
751
|
tags: T::Array[String],
|
|
655
|
-
|
|
752
|
+
timeout_opts: ContextDev::WebWebScrapeMdParams::TimeoutOpts::OrHash,
|
|
656
753
|
use_main_content_only: T::Boolean,
|
|
657
754
|
wait_for_ms: T.nilable(Integer),
|
|
658
755
|
zdr: ContextDev::WebWebScrapeMdParams::Zdr::OrSymbol,
|
|
@@ -708,17 +805,17 @@ module ContextDev
|
|
|
708
805
|
# Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50
|
|
709
806
|
# characters.
|
|
710
807
|
tags: nil,
|
|
711
|
-
# Optional
|
|
712
|
-
#
|
|
713
|
-
#
|
|
714
|
-
|
|
808
|
+
# Optional request deadline and behavior on timeout. For GET requests, use
|
|
809
|
+
# timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded
|
|
810
|
+
# timeoutOpts object.
|
|
811
|
+
timeout_opts: nil,
|
|
715
812
|
# Extract only the main content of the page, excluding headers, footers, sidebars,
|
|
716
813
|
# and navigation
|
|
717
814
|
use_main_content_only: nil,
|
|
718
815
|
# Optional browser wait time in milliseconds after initial page load before
|
|
719
816
|
# converting the page to Markdown. Min: 0. Max: 30000 (30 seconds). When combined
|
|
720
|
-
# with
|
|
721
|
-
# deadline is rejected with 400 TIMEOUT_TOO_SHORT_FOR_WAIT.
|
|
817
|
+
# with timeoutOpts, timeoutOpts.milliseconds must be at least waitForMs + 10000
|
|
818
|
+
# ms; a shorter deadline is rejected with 400 TIMEOUT_TOO_SHORT_FOR_WAIT.
|
|
722
819
|
wait_for_ms: nil,
|
|
723
820
|
# Set to enabled to bypass shared caches and omit request and response content
|
|
724
821
|
# from retained usage logs. Requires zero data retention to be enabled for your
|
|
@@ -744,7 +841,8 @@ module ContextDev
|
|
|
744
841
|
search: String,
|
|
745
842
|
sitemap_url: String,
|
|
746
843
|
tags: T::Array[String],
|
|
747
|
-
|
|
844
|
+
timeout_opts:
|
|
845
|
+
ContextDev::WebWebScrapeSitemapParams::TimeoutOpts::OrHash,
|
|
748
846
|
url_regex: String,
|
|
749
847
|
zdr: ContextDev::WebWebScrapeSitemapParams::Zdr::OrSymbol,
|
|
750
848
|
request_options: ContextDev::RequestOptions::OrHash
|
|
@@ -773,10 +871,10 @@ module ContextDev
|
|
|
773
871
|
# Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50
|
|
774
872
|
# characters.
|
|
775
873
|
tags: nil,
|
|
776
|
-
# Optional
|
|
777
|
-
#
|
|
778
|
-
#
|
|
779
|
-
|
|
874
|
+
# Optional request deadline and behavior on timeout. For GET requests, use
|
|
875
|
+
# timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded
|
|
876
|
+
# timeoutOpts object.
|
|
877
|
+
timeout_opts: nil,
|
|
780
878
|
# Optional RE2-compatible regex pattern. Only URLs matching this pattern are
|
|
781
879
|
# returned and counted against maxLinks.
|
|
782
880
|
url_regex: nil,
|
|
@@ -5,7 +5,7 @@ module ContextDev
|
|
|
5
5
|
url: String,
|
|
6
6
|
max_age_ms: Integer,
|
|
7
7
|
tags: ::Array[String],
|
|
8
|
-
|
|
8
|
+
timeout_opts: ContextDev::AIExtractProductParams::TimeoutOpts
|
|
9
9
|
}
|
|
10
10
|
& ContextDev::Internal::Type::request_parameters
|
|
11
11
|
|
|
@@ -23,15 +23,17 @@ module ContextDev
|
|
|
23
23
|
|
|
24
24
|
def tags=: (::Array[String]) -> ::Array[String]
|
|
25
25
|
|
|
26
|
-
attr_reader
|
|
26
|
+
attr_reader timeout_opts: ContextDev::AIExtractProductParams::TimeoutOpts?
|
|
27
27
|
|
|
28
|
-
def
|
|
28
|
+
def timeout_opts=: (
|
|
29
|
+
ContextDev::AIExtractProductParams::TimeoutOpts
|
|
30
|
+
) -> ContextDev::AIExtractProductParams::TimeoutOpts
|
|
29
31
|
|
|
30
32
|
def initialize: (
|
|
31
33
|
url: String,
|
|
32
34
|
?max_age_ms: Integer,
|
|
33
35
|
?tags: ::Array[String],
|
|
34
|
-
?
|
|
36
|
+
?timeout_opts: ContextDev::AIExtractProductParams::TimeoutOpts,
|
|
35
37
|
?request_options: ContextDev::request_opts
|
|
36
38
|
) -> void
|
|
37
39
|
|
|
@@ -39,9 +41,46 @@ module ContextDev
|
|
|
39
41
|
url: String,
|
|
40
42
|
max_age_ms: Integer,
|
|
41
43
|
tags: ::Array[String],
|
|
42
|
-
|
|
44
|
+
timeout_opts: ContextDev::AIExtractProductParams::TimeoutOpts,
|
|
43
45
|
request_options: ContextDev::RequestOptions
|
|
44
46
|
}
|
|
47
|
+
|
|
48
|
+
type timeout_opts =
|
|
49
|
+
{
|
|
50
|
+
milliseconds: Integer,
|
|
51
|
+
behavior: ContextDev::Models::AIExtractProductParams::TimeoutOpts::behavior
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
class TimeoutOpts < ContextDev::Internal::Type::BaseModel
|
|
55
|
+
attr_accessor milliseconds: Integer
|
|
56
|
+
|
|
57
|
+
attr_reader behavior: ContextDev::Models::AIExtractProductParams::TimeoutOpts::behavior?
|
|
58
|
+
|
|
59
|
+
def behavior=: (
|
|
60
|
+
ContextDev::Models::AIExtractProductParams::TimeoutOpts::behavior
|
|
61
|
+
) -> ContextDev::Models::AIExtractProductParams::TimeoutOpts::behavior
|
|
62
|
+
|
|
63
|
+
def initialize: (
|
|
64
|
+
milliseconds: Integer,
|
|
65
|
+
?behavior: ContextDev::Models::AIExtractProductParams::TimeoutOpts::behavior
|
|
66
|
+
) -> void
|
|
67
|
+
|
|
68
|
+
def to_hash: -> {
|
|
69
|
+
milliseconds: Integer,
|
|
70
|
+
behavior: ContextDev::Models::AIExtractProductParams::TimeoutOpts::behavior
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
type behavior = :fail | :"return-partial"
|
|
74
|
+
|
|
75
|
+
module Behavior
|
|
76
|
+
extend ContextDev::Internal::Type::Enum
|
|
77
|
+
|
|
78
|
+
FAIL: :fail
|
|
79
|
+
RETURN_PARTIAL: :"return-partial"
|
|
80
|
+
|
|
81
|
+
def self?.values: -> ::Array[ContextDev::Models::AIExtractProductParams::TimeoutOpts::behavior]
|
|
82
|
+
end
|
|
83
|
+
end
|
|
45
84
|
end
|
|
46
85
|
end
|
|
47
86
|
end
|
|
@@ -6,6 +6,7 @@ module ContextDev
|
|
|
6
6
|
request_id: String,
|
|
7
7
|
is_product_page: bool,
|
|
8
8
|
key_metadata: ContextDev::Models::AIExtractProductResponse::KeyMetadata,
|
|
9
|
+
partial: bool,
|
|
9
10
|
platform: ContextDev::Models::AIExtractProductResponse::platform?,
|
|
10
11
|
product: ContextDev::Models::AIExtractProductResponse::Product?
|
|
11
12
|
}
|
|
@@ -25,6 +26,10 @@ module ContextDev
|
|
|
25
26
|
ContextDev::Models::AIExtractProductResponse::KeyMetadata
|
|
26
27
|
) -> ContextDev::Models::AIExtractProductResponse::KeyMetadata
|
|
27
28
|
|
|
29
|
+
attr_reader partial: bool?
|
|
30
|
+
|
|
31
|
+
def partial=: (bool) -> bool
|
|
32
|
+
|
|
28
33
|
attr_accessor platform: ContextDev::Models::AIExtractProductResponse::platform?
|
|
29
34
|
|
|
30
35
|
attr_accessor product: ContextDev::Models::AIExtractProductResponse::Product?
|
|
@@ -34,6 +39,7 @@ module ContextDev
|
|
|
34
39
|
request_id: String,
|
|
35
40
|
?is_product_page: bool,
|
|
36
41
|
?key_metadata: ContextDev::Models::AIExtractProductResponse::KeyMetadata,
|
|
42
|
+
?partial: bool,
|
|
37
43
|
?platform: ContextDev::Models::AIExtractProductResponse::platform?,
|
|
38
44
|
?product: ContextDev::Models::AIExtractProductResponse::Product?
|
|
39
45
|
) -> void
|
|
@@ -43,6 +49,7 @@ module ContextDev
|
|
|
43
49
|
request_id: String,
|
|
44
50
|
is_product_page: bool,
|
|
45
51
|
key_metadata: ContextDev::Models::AIExtractProductResponse::KeyMetadata,
|
|
52
|
+
partial: bool,
|
|
46
53
|
platform: ContextDev::Models::AIExtractProductResponse::platform?,
|
|
47
54
|
product: ContextDev::Models::AIExtractProductResponse::Product?
|
|
48
55
|
}
|