context.dev 2.19.0 → 2.21.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 +219 -0
- data/README.md +1 -1
- data/lib/context_dev/client.rb +6 -0
- data/lib/context_dev/models/feedback_submit_params.rb +73 -0
- data/lib/context_dev/models/feedback_submit_response.rb +68 -0
- data/lib/context_dev/models/news_search_params.rb +13 -6
- data/lib/context_dev/models/web_scrape_params.rb +149 -14
- data/lib/context_dev/models/web_scrape_response.rb +404 -12
- data/lib/context_dev/models.rb +2 -0
- data/lib/context_dev/resources/feedback.rb +50 -0
- data/lib/context_dev/resources/news.rb +8 -4
- data/lib/context_dev/resources/web.rb +26 -8
- data/lib/context_dev/version.rb +1 -1
- data/lib/context_dev.rb +3 -0
- data/rbi/context_dev/client.rbi +5 -0
- data/rbi/context_dev/models/feedback_submit_params.rbi +133 -0
- data/rbi/context_dev/models/feedback_submit_response.rbi +122 -0
- data/rbi/context_dev/models/news_search_params.rbi +12 -6
- data/rbi/context_dev/models/web_scrape_params.rbi +248 -18
- data/rbi/context_dev/models/web_scrape_response.rbi +702 -30
- data/rbi/context_dev/models.rbi +2 -0
- data/rbi/context_dev/resources/feedback.rbi +42 -0
- data/rbi/context_dev/resources/news.rbi +7 -4
- data/rbi/context_dev/resources/web.rbi +38 -12
- data/sig/context_dev/client.rbs +2 -0
- data/sig/context_dev/models/feedback_submit_params.rbs +73 -0
- data/sig/context_dev/models/feedback_submit_response.rbs +58 -0
- data/sig/context_dev/models/web_scrape_params.rbs +91 -0
- data/sig/context_dev/models/web_scrape_response.rbs +302 -18
- data/sig/context_dev/models.rbs +2 -0
- data/sig/context_dev/resources/feedback.rbs +16 -0
- data/sig/context_dev/resources/web.rbs +3 -0
- metadata +11 -2
|
@@ -19,12 +19,26 @@ module ContextDev
|
|
|
19
19
|
# @return [String]
|
|
20
20
|
required :url, String
|
|
21
21
|
|
|
22
|
+
# @!attribute highlights_params
|
|
23
|
+
# Highlight options. Requires formats.highlights: true.
|
|
24
|
+
#
|
|
25
|
+
# @return [ContextDev::Models::WebScrapeParams::HighlightsParams, nil]
|
|
26
|
+
optional :highlights_params,
|
|
27
|
+
-> { ContextDev::WebScrapeParams::HighlightsParams },
|
|
28
|
+
api_name: :highlightsParams
|
|
29
|
+
|
|
22
30
|
# @!attribute image_params
|
|
23
31
|
# Image options. Requires formats.images: true.
|
|
24
32
|
#
|
|
25
33
|
# @return [ContextDev::Models::WebScrapeParams::ImageParams, nil]
|
|
26
34
|
optional :image_params, -> { ContextDev::WebScrapeParams::ImageParams }, api_name: :imageParams
|
|
27
35
|
|
|
36
|
+
# @!attribute json_params
|
|
37
|
+
# Required when formats.json is true.
|
|
38
|
+
#
|
|
39
|
+
# @return [ContextDev::Models::WebScrapeParams::JsonParams, nil]
|
|
40
|
+
optional :json_params, -> { ContextDev::WebScrapeParams::JsonParams }, api_name: :jsonParams
|
|
41
|
+
|
|
28
42
|
# @!attribute markdown_params
|
|
29
43
|
# Markdown options. Requires formats.markdown: true.
|
|
30
44
|
#
|
|
@@ -46,6 +60,12 @@ module ContextDev
|
|
|
46
60
|
# @return [ContextDev::Models::WebScrapeParams::ParseParams, nil]
|
|
47
61
|
optional :parse_params, -> { ContextDev::WebScrapeParams::ParseParams }, api_name: :parseParams
|
|
48
62
|
|
|
63
|
+
# @!attribute product_params
|
|
64
|
+
# Product options. Requires formats.product: true.
|
|
65
|
+
#
|
|
66
|
+
# @return [ContextDev::Models::WebScrapeParams::ProductParams, nil]
|
|
67
|
+
optional :product_params, -> { ContextDev::WebScrapeParams::ProductParams }, api_name: :productParams
|
|
68
|
+
|
|
49
69
|
# @!attribute screenshot_params
|
|
50
70
|
# Screenshot options. Requires formats.screenshot: true.
|
|
51
71
|
#
|
|
@@ -69,12 +89,16 @@ module ContextDev
|
|
|
69
89
|
|
|
70
90
|
# @!attribute timeout_opts
|
|
71
91
|
# Total deadline, including navigation, actions, waiting, and all outputs.
|
|
72
|
-
# Defaults to 60000 milliseconds with behavior fail.
|
|
73
|
-
#
|
|
74
|
-
#
|
|
75
|
-
#
|
|
76
|
-
#
|
|
77
|
-
# when
|
|
92
|
+
# Defaults to 60000 milliseconds with behavior fail. Individual outputs have
|
|
93
|
+
# internal deadlines that reserve time to return completed outputs; timed-out
|
|
94
|
+
# outputs have success: false and data: null under either behavior. The overall
|
|
95
|
+
# request deadline remains enforced: fail returns an error if that deadline is
|
|
96
|
+
# reached. Use return-partial to allow the current page state and available
|
|
97
|
+
# outputs when the page is still loading. Partial responses set isPartial. Failed
|
|
98
|
+
# retrievals and incomplete captures are not cached; valid captured pieces may be
|
|
99
|
+
# cached independently. Fixed waits must fit before a response reserve of up to
|
|
100
|
+
# 5000 milliseconds (at most one quarter of the timeout) when using
|
|
101
|
+
# return-partial.
|
|
78
102
|
#
|
|
79
103
|
# @return [ContextDev::Models::WebScrapeParams::TimeoutOpts, nil]
|
|
80
104
|
optional :timeout_opts, -> { ContextDev::WebScrapeParams::TimeoutOpts }, api_name: :timeoutOpts
|
|
@@ -86,7 +110,7 @@ module ContextDev
|
|
|
86
110
|
# @return [Symbol, ContextDev::Models::WebScrapeParams::Zdr, nil]
|
|
87
111
|
optional :zdr, enum: -> { ContextDev::WebScrapeParams::Zdr }
|
|
88
112
|
|
|
89
|
-
# @!method initialize(formats:, url:, image_params: nil, markdown_params: nil, max_age_ms: nil, parse_params: nil, screenshot_params: nil, shared_params: nil, tags: nil, timeout_opts: nil, zdr: nil, request_options: {})
|
|
113
|
+
# @!method initialize(formats:, url:, highlights_params: nil, image_params: nil, json_params: nil, markdown_params: nil, max_age_ms: nil, parse_params: nil, product_params: nil, screenshot_params: nil, shared_params: nil, tags: nil, timeout_opts: nil, zdr: nil, request_options: {})
|
|
90
114
|
# Some parameter documentations has been truncated, see
|
|
91
115
|
# {ContextDev::Models::WebScrapeParams} for more details.
|
|
92
116
|
#
|
|
@@ -94,14 +118,20 @@ module ContextDev
|
|
|
94
118
|
#
|
|
95
119
|
# @param url [String] The URL to scrape.
|
|
96
120
|
#
|
|
121
|
+
# @param highlights_params [ContextDev::Models::WebScrapeParams::HighlightsParams] Highlight options. Requires formats.highlights: true.
|
|
122
|
+
#
|
|
97
123
|
# @param image_params [ContextDev::Models::WebScrapeParams::ImageParams] Image options. Requires formats.images: true.
|
|
98
124
|
#
|
|
125
|
+
# @param json_params [ContextDev::Models::WebScrapeParams::JsonParams] Required when formats.json is true.
|
|
126
|
+
#
|
|
99
127
|
# @param markdown_params [ContextDev::Models::WebScrapeParams::MarkdownParams] Markdown options. Requires formats.markdown: true.
|
|
100
128
|
#
|
|
101
129
|
# @param max_age_ms [Integer] Maximum age of each cached output. Defaults to 1 day; 0 fetches fresh and update
|
|
102
130
|
#
|
|
103
131
|
# @param parse_params [ContextDev::Models::WebScrapeParams::ParseParams] Required when formats.parse is true.
|
|
104
132
|
#
|
|
133
|
+
# @param product_params [ContextDev::Models::WebScrapeParams::ProductParams] Product options. Requires formats.product: true.
|
|
134
|
+
#
|
|
105
135
|
# @param screenshot_params [ContextDev::Models::WebScrapeParams::ScreenshotParams] Screenshot options. Requires formats.screenshot: true.
|
|
106
136
|
#
|
|
107
137
|
# @param shared_params [ContextDev::Models::WebScrapeParams::SharedParams] Shared browser and content settings. Content filters leave screenshots and origi
|
|
@@ -121,6 +151,14 @@ module ContextDev
|
|
|
121
151
|
# @return [Boolean, nil]
|
|
122
152
|
optional :bytes, ContextDev::Internal::Type::Boolean
|
|
123
153
|
|
|
154
|
+
# @!attribute highlights
|
|
155
|
+
# Relevant Markdown excerpts for your question or topic, preserving code, lists,
|
|
156
|
+
# and tables, with headings included when needed for context. Adds 3 credits when
|
|
157
|
+
# passages are returned.
|
|
158
|
+
#
|
|
159
|
+
# @return [Boolean, nil]
|
|
160
|
+
optional :highlights, ContextDev::Internal::Type::Boolean
|
|
161
|
+
|
|
124
162
|
# @!attribute html
|
|
125
163
|
# Rendered HTML.
|
|
126
164
|
#
|
|
@@ -133,6 +171,13 @@ module ContextDev
|
|
|
133
171
|
# @return [Boolean, nil]
|
|
134
172
|
optional :images, ContextDev::Internal::Type::Boolean
|
|
135
173
|
|
|
174
|
+
# @!attribute json
|
|
175
|
+
# Page data extracted using your schema. Adds 4 credits when extraction succeeds
|
|
176
|
+
# and its result is returned.
|
|
177
|
+
#
|
|
178
|
+
# @return [Boolean, nil]
|
|
179
|
+
optional :json, ContextDev::Internal::Type::Boolean
|
|
180
|
+
|
|
136
181
|
# @!attribute markdown
|
|
137
182
|
# Page content as Markdown.
|
|
138
183
|
#
|
|
@@ -145,28 +190,65 @@ module ContextDev
|
|
|
145
190
|
# @return [Boolean, nil]
|
|
146
191
|
optional :parse, ContextDev::Internal::Type::Boolean
|
|
147
192
|
|
|
193
|
+
# @!attribute product
|
|
194
|
+
# Product details such as name, price, and availability. Adds 1 credit when its
|
|
195
|
+
# successful result is returned or the target page is missing.
|
|
196
|
+
#
|
|
197
|
+
# @return [Boolean, nil]
|
|
198
|
+
optional :product, ContextDev::Internal::Type::Boolean
|
|
199
|
+
|
|
148
200
|
# @!attribute screenshot
|
|
149
201
|
# An inline image of the page.
|
|
150
202
|
#
|
|
151
203
|
# @return [Boolean, nil]
|
|
152
204
|
optional :screenshot, ContextDev::Internal::Type::Boolean
|
|
153
205
|
|
|
154
|
-
# @!method initialize(bytes: nil, html: nil, images: nil, markdown: nil, parse: nil, screenshot: nil)
|
|
206
|
+
# @!method initialize(bytes: nil, highlights: nil, html: nil, images: nil, json: nil, markdown: nil, parse: nil, product: nil, screenshot: nil)
|
|
207
|
+
# Some parameter documentations has been truncated, see
|
|
208
|
+
# {ContextDev::Models::WebScrapeParams::Formats} for more details.
|
|
209
|
+
#
|
|
155
210
|
# Outputs to return. Enable at least one; omitted formats are false.
|
|
156
211
|
#
|
|
157
212
|
# @param bytes [Boolean] The original HTTP response body.
|
|
158
213
|
#
|
|
214
|
+
# @param highlights [Boolean] Relevant Markdown excerpts for your question or topic, preserving code, lists, a
|
|
215
|
+
#
|
|
159
216
|
# @param html [Boolean] Rendered HTML.
|
|
160
217
|
#
|
|
161
218
|
# @param images [Boolean] Images found on the page.
|
|
162
219
|
#
|
|
220
|
+
# @param json [Boolean] Page data extracted using your schema. Adds 4 credits when extraction succeeds a
|
|
221
|
+
#
|
|
163
222
|
# @param markdown [Boolean] Page content as Markdown.
|
|
164
223
|
#
|
|
165
224
|
# @param parse [Boolean] Fields selected by parseParams.rules.
|
|
166
225
|
#
|
|
226
|
+
# @param product [Boolean] Product details such as name, price, and availability. Adds 1 credit when its su
|
|
227
|
+
#
|
|
167
228
|
# @param screenshot [Boolean] An inline image of the page.
|
|
168
229
|
end
|
|
169
230
|
|
|
231
|
+
class HighlightsParams < ContextDev::Internal::Type::BaseModel
|
|
232
|
+
# @!attribute query
|
|
233
|
+
# The question or topic to find passages for.
|
|
234
|
+
#
|
|
235
|
+
# @return [String]
|
|
236
|
+
required :query, String
|
|
237
|
+
|
|
238
|
+
# @!attribute max_characters
|
|
239
|
+
# Maximum combined length of the returned passages, in characters.
|
|
240
|
+
#
|
|
241
|
+
# @return [Integer, nil]
|
|
242
|
+
optional :max_characters, Integer, api_name: :maxCharacters
|
|
243
|
+
|
|
244
|
+
# @!method initialize(query:, max_characters: nil)
|
|
245
|
+
# Highlight options. Requires formats.highlights: true.
|
|
246
|
+
#
|
|
247
|
+
# @param query [String] The question or topic to find passages for.
|
|
248
|
+
#
|
|
249
|
+
# @param max_characters [Integer] Maximum combined length of the returned passages, in characters.
|
|
250
|
+
end
|
|
251
|
+
|
|
170
252
|
class ImageParams < ContextDev::Internal::Type::BaseModel
|
|
171
253
|
# @!attribute dedupe
|
|
172
254
|
# For visual duplicates, keep the largest image.
|
|
@@ -218,6 +300,35 @@ module ContextDev
|
|
|
218
300
|
end
|
|
219
301
|
end
|
|
220
302
|
|
|
303
|
+
class JsonParams < ContextDev::Internal::Type::BaseModel
|
|
304
|
+
# @!attribute schema
|
|
305
|
+
# JSON Schema for the returned object. Must describe a top-level object; at most
|
|
306
|
+
# 50 KB serialized. Optional fields the page does not state are omitted, or null
|
|
307
|
+
# when their type allows null, while required non-nullable fields always receive a
|
|
308
|
+
# best-effort value, so prefer nullable or optional fields for data a page may
|
|
309
|
+
# omit. Zod users can pass the output of z.toJSONSchema().
|
|
310
|
+
#
|
|
311
|
+
# @return [Hash{Symbol=>Object}]
|
|
312
|
+
required :schema, ContextDev::Internal::Type::HashOf[ContextDev::Internal::Type::Unknown]
|
|
313
|
+
|
|
314
|
+
# @!attribute instructions
|
|
315
|
+
# Optional guidance on which facts to prioritize or how to interpret schema
|
|
316
|
+
# fields.
|
|
317
|
+
#
|
|
318
|
+
# @return [String, nil]
|
|
319
|
+
optional :instructions, String
|
|
320
|
+
|
|
321
|
+
# @!method initialize(schema:, instructions: nil)
|
|
322
|
+
# Some parameter documentations has been truncated, see
|
|
323
|
+
# {ContextDev::Models::WebScrapeParams::JsonParams} for more details.
|
|
324
|
+
#
|
|
325
|
+
# Required when formats.json is true.
|
|
326
|
+
#
|
|
327
|
+
# @param schema [Hash{Symbol=>Object}] JSON Schema for the returned object. Must describe a top-level object; at most 5
|
|
328
|
+
#
|
|
329
|
+
# @param instructions [String] Optional guidance on which facts to prioritize or how to interpret schema fields
|
|
330
|
+
end
|
|
331
|
+
|
|
221
332
|
class MarkdownParams < ContextDev::Internal::Type::BaseModel
|
|
222
333
|
# @!attribute include_images
|
|
223
334
|
#
|
|
@@ -355,6 +466,26 @@ module ContextDev
|
|
|
355
466
|
end
|
|
356
467
|
end
|
|
357
468
|
|
|
469
|
+
class ProductParams < ContextDev::Internal::Type::BaseModel
|
|
470
|
+
# @!attribute use_ai_fallback
|
|
471
|
+
# Extract the product with a specialized model when the page has no structured
|
|
472
|
+
# product data. Adds six credits when the model verdict is returned successfully.
|
|
473
|
+
# If the fallback fails, the product output has success: false and data: null with
|
|
474
|
+
# no fallback charge; other outputs remain available. Request deadlines and client
|
|
475
|
+
# disconnects still apply.
|
|
476
|
+
#
|
|
477
|
+
# @return [Boolean, nil]
|
|
478
|
+
optional :use_ai_fallback, ContextDev::Internal::Type::Boolean, api_name: :useAIFallback
|
|
479
|
+
|
|
480
|
+
# @!method initialize(use_ai_fallback: nil)
|
|
481
|
+
# Some parameter documentations has been truncated, see
|
|
482
|
+
# {ContextDev::Models::WebScrapeParams::ProductParams} for more details.
|
|
483
|
+
#
|
|
484
|
+
# Product options. Requires formats.product: true.
|
|
485
|
+
#
|
|
486
|
+
# @param use_ai_fallback [Boolean] Extract the product with a specialized model when the page has no structured pro
|
|
487
|
+
end
|
|
488
|
+
|
|
358
489
|
class ScreenshotParams < ContextDev::Internal::Type::BaseModel
|
|
359
490
|
# @!attribute area
|
|
360
491
|
# Viewport, full page, one visible element, or a rectangle. Maximum 40 megapixels.
|
|
@@ -861,12 +992,16 @@ module ContextDev
|
|
|
861
992
|
# {ContextDev::Models::WebScrapeParams::TimeoutOpts} for more details.
|
|
862
993
|
#
|
|
863
994
|
# Total deadline, including navigation, actions, waiting, and all outputs.
|
|
864
|
-
# Defaults to 60000 milliseconds with behavior fail.
|
|
865
|
-
#
|
|
866
|
-
#
|
|
867
|
-
#
|
|
868
|
-
#
|
|
869
|
-
# when
|
|
995
|
+
# Defaults to 60000 milliseconds with behavior fail. Individual outputs have
|
|
996
|
+
# internal deadlines that reserve time to return completed outputs; timed-out
|
|
997
|
+
# outputs have success: false and data: null under either behavior. The overall
|
|
998
|
+
# request deadline remains enforced: fail returns an error if that deadline is
|
|
999
|
+
# reached. Use return-partial to allow the current page state and available
|
|
1000
|
+
# outputs when the page is still loading. Partial responses set isPartial. Failed
|
|
1001
|
+
# retrievals and incomplete captures are not cached; valid captured pieces may be
|
|
1002
|
+
# cached independently. Fixed waits must fit before a response reserve of up to
|
|
1003
|
+
# 5000 milliseconds (at most one quarter of the timeout) when using
|
|
1004
|
+
# return-partial.
|
|
870
1005
|
#
|
|
871
1006
|
# @param milliseconds [Integer] Request deadline in milliseconds. Maximum: 300000 (5 minutes).
|
|
872
1007
|
#
|