context.dev 2.11.0 → 2.12.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 +11 -0
- data/README.md +1 -1
- data/lib/context_dev/models/ai_extract_product_response.rb +48 -1
- data/lib/context_dev/models/ai_extract_products_response.rb +48 -1
- data/lib/context_dev/models/news_search_params.rb +1 -0
- data/lib/context_dev/models/web_extract_params.rb +169 -6
- data/lib/context_dev/models/web_extract_response.rb +85 -1
- data/lib/context_dev/models/web_web_crawl_md_params.rb +7 -5
- data/lib/context_dev/models/web_web_scrape_html_params.rb +99 -3
- data/lib/context_dev/models/web_web_scrape_images_params.rb +99 -3
- data/lib/context_dev/models/web_web_scrape_images_response.rb +85 -1
- data/lib/context_dev/models/web_web_scrape_md_params.rb +99 -3
- data/lib/context_dev/resources/web.rb +9 -7
- data/lib/context_dev/version.rb +1 -1
- data/rbi/context_dev/models/ai_extract_product_response.rbi +99 -0
- data/rbi/context_dev/models/ai_extract_products_response.rbi +99 -0
- data/rbi/context_dev/models/news_search_params.rbi +5 -0
- data/rbi/context_dev/models/web_extract_params.rbi +353 -8
- data/rbi/context_dev/models/web_extract_response.rbi +172 -3
- data/rbi/context_dev/models/web_web_crawl_md_params.rbi +10 -6
- data/rbi/context_dev/models/web_web_scrape_html_params.rbi +218 -4
- data/rbi/context_dev/models/web_web_scrape_images_params.rbi +218 -4
- data/rbi/context_dev/models/web_web_scrape_images_response.rbi +169 -0
- data/rbi/context_dev/models/web_web_scrape_md_params.rbi +218 -4
- data/rbi/context_dev/resources/web.rbi +31 -10
- data/sig/context_dev/models/ai_extract_product_response.rbs +40 -0
- data/sig/context_dev/models/ai_extract_products_response.rbs +40 -0
- data/sig/context_dev/models/news_search_params.rbs +2 -0
- data/sig/context_dev/models/web_extract_params.rbs +117 -0
- data/sig/context_dev/models/web_extract_response.rbs +81 -3
- data/sig/context_dev/models/web_web_scrape_html_params.rbs +74 -0
- data/sig/context_dev/models/web_web_scrape_images_params.rbs +74 -0
- data/sig/context_dev/models/web_web_scrape_images_response.rbs +78 -0
- data/sig/context_dev/models/web_web_scrape_md_params.rbs +74 -0
- data/sig/context_dev/resources/web.rbs +1 -0
- metadata +2 -2
|
@@ -11,9 +11,11 @@ module ContextDev
|
|
|
11
11
|
T.any(ContextDev::WebExtractParams, ContextDev::Internal::AnyHash)
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
# JSON Schema for the returned data object.
|
|
15
|
-
#
|
|
16
|
-
#
|
|
14
|
+
# JSON Schema for the returned data object. Image fields such as `image_urls` or
|
|
15
|
+
# `product_photos` automatically make page image references available to
|
|
16
|
+
# extraction, so product data and photos can be returned in one call. TypeScript
|
|
17
|
+
# Zod users can pass a JSON Schema generated from a Zod object; Python users can
|
|
18
|
+
# pass the equivalent JSON Schema object.
|
|
17
19
|
sig { returns(T::Hash[Symbol, T.anything]) }
|
|
18
20
|
attr_accessor :schema
|
|
19
21
|
|
|
@@ -22,6 +24,39 @@ module ContextDev
|
|
|
22
24
|
sig { returns(String) }
|
|
23
25
|
attr_accessor :url
|
|
24
26
|
|
|
27
|
+
# Optional browser actions executed in order on the requested page after it loads,
|
|
28
|
+
# before links are discovered or additional pages are crawled. Requires a paid
|
|
29
|
+
# plan. When actions are provided and stopAfterMs is omitted, the crawl budget
|
|
30
|
+
# defaults to 110000 ms.
|
|
31
|
+
sig do
|
|
32
|
+
returns(
|
|
33
|
+
T.nilable(
|
|
34
|
+
T::Array[
|
|
35
|
+
T.any(
|
|
36
|
+
ContextDev::WebExtractParams::Action::Wait,
|
|
37
|
+
ContextDev::WebExtractParams::Action::Perform,
|
|
38
|
+
ContextDev::WebExtractParams::Action::Scroll
|
|
39
|
+
)
|
|
40
|
+
]
|
|
41
|
+
)
|
|
42
|
+
)
|
|
43
|
+
end
|
|
44
|
+
attr_reader :actions
|
|
45
|
+
|
|
46
|
+
sig do
|
|
47
|
+
params(
|
|
48
|
+
actions:
|
|
49
|
+
T::Array[
|
|
50
|
+
T.any(
|
|
51
|
+
ContextDev::WebExtractParams::Action::Wait::OrHash,
|
|
52
|
+
ContextDev::WebExtractParams::Action::Perform::OrHash,
|
|
53
|
+
ContextDev::WebExtractParams::Action::Scroll::OrHash
|
|
54
|
+
)
|
|
55
|
+
]
|
|
56
|
+
).void
|
|
57
|
+
end
|
|
58
|
+
attr_writer :actions
|
|
59
|
+
|
|
25
60
|
# When true, every returned value must be grounded in facts stated on the page;
|
|
26
61
|
# fields that cannot be supported by the page are returned as null/empty. When
|
|
27
62
|
# false (default), the model may make reasonable inferences and derivations from
|
|
@@ -95,7 +130,8 @@ module ContextDev
|
|
|
95
130
|
attr_writer :settle_animations
|
|
96
131
|
|
|
97
132
|
# Soft time budget for the crawl in milliseconds. Min: 10000 (10s). Max: 110000
|
|
98
|
-
# (110s).
|
|
133
|
+
# (110s). Defaults to 80000 (80s), or 110000 (110s) when browser actions are
|
|
134
|
+
# provided.
|
|
99
135
|
sig { returns(T.nilable(Integer)) }
|
|
100
136
|
attr_reader :stop_after_ms
|
|
101
137
|
|
|
@@ -130,6 +166,14 @@ module ContextDev
|
|
|
130
166
|
params(
|
|
131
167
|
schema: T::Hash[Symbol, T.anything],
|
|
132
168
|
url: String,
|
|
169
|
+
actions:
|
|
170
|
+
T::Array[
|
|
171
|
+
T.any(
|
|
172
|
+
ContextDev::WebExtractParams::Action::Wait::OrHash,
|
|
173
|
+
ContextDev::WebExtractParams::Action::Perform::OrHash,
|
|
174
|
+
ContextDev::WebExtractParams::Action::Scroll::OrHash
|
|
175
|
+
)
|
|
176
|
+
],
|
|
133
177
|
fact_check: T::Boolean,
|
|
134
178
|
follow_subdomains: T::Boolean,
|
|
135
179
|
include_frames: T::Boolean,
|
|
@@ -147,13 +191,20 @@ module ContextDev
|
|
|
147
191
|
).returns(T.attached_class)
|
|
148
192
|
end
|
|
149
193
|
def self.new(
|
|
150
|
-
# JSON Schema for the returned data object.
|
|
151
|
-
#
|
|
152
|
-
#
|
|
194
|
+
# JSON Schema for the returned data object. Image fields such as `image_urls` or
|
|
195
|
+
# `product_photos` automatically make page image references available to
|
|
196
|
+
# extraction, so product data and photos can be returned in one call. TypeScript
|
|
197
|
+
# Zod users can pass a JSON Schema generated from a Zod object; Python users can
|
|
198
|
+
# pass the equivalent JSON Schema object.
|
|
153
199
|
schema:,
|
|
154
200
|
# The starting website URL to crawl and extract from. Must include http:// or
|
|
155
201
|
# https://.
|
|
156
202
|
url:,
|
|
203
|
+
# Optional browser actions executed in order on the requested page after it loads,
|
|
204
|
+
# before links are discovered or additional pages are crawled. Requires a paid
|
|
205
|
+
# plan. When actions are provided and stopAfterMs is omitted, the crawl budget
|
|
206
|
+
# defaults to 110000 ms.
|
|
207
|
+
actions: nil,
|
|
157
208
|
# When true, every returned value must be grounded in facts stated on the page;
|
|
158
209
|
# fields that cannot be supported by the page are returned as null/empty. When
|
|
159
210
|
# false (default), the model may make reasonable inferences and derivations from
|
|
@@ -182,7 +233,8 @@ module ContextDev
|
|
|
182
233
|
# exchange for more stable output on animated pages.
|
|
183
234
|
settle_animations: nil,
|
|
184
235
|
# Soft time budget for the crawl in milliseconds. Min: 10000 (10s). Max: 110000
|
|
185
|
-
# (110s).
|
|
236
|
+
# (110s). Defaults to 80000 (80s), or 110000 (110s) when browser actions are
|
|
237
|
+
# provided.
|
|
186
238
|
stop_after_ms: nil,
|
|
187
239
|
# Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
|
|
188
240
|
tags: nil,
|
|
@@ -202,6 +254,14 @@ module ContextDev
|
|
|
202
254
|
{
|
|
203
255
|
schema: T::Hash[Symbol, T.anything],
|
|
204
256
|
url: String,
|
|
257
|
+
actions:
|
|
258
|
+
T::Array[
|
|
259
|
+
T.any(
|
|
260
|
+
ContextDev::WebExtractParams::Action::Wait,
|
|
261
|
+
ContextDev::WebExtractParams::Action::Perform,
|
|
262
|
+
ContextDev::WebExtractParams::Action::Scroll
|
|
263
|
+
)
|
|
264
|
+
],
|
|
205
265
|
fact_check: T::Boolean,
|
|
206
266
|
follow_subdomains: T::Boolean,
|
|
207
267
|
include_frames: T::Boolean,
|
|
@@ -222,6 +282,291 @@ module ContextDev
|
|
|
222
282
|
def to_hash
|
|
223
283
|
end
|
|
224
284
|
|
|
285
|
+
# Browser action discriminated by `do`. Each variant exposes only its applicable
|
|
286
|
+
# fields.
|
|
287
|
+
module Action
|
|
288
|
+
extend ContextDev::Internal::Type::Union
|
|
289
|
+
|
|
290
|
+
Variants =
|
|
291
|
+
T.type_alias do
|
|
292
|
+
T.any(
|
|
293
|
+
ContextDev::WebExtractParams::Action::Wait,
|
|
294
|
+
ContextDev::WebExtractParams::Action::Perform,
|
|
295
|
+
ContextDev::WebExtractParams::Action::Scroll
|
|
296
|
+
)
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
class Wait < ContextDev::Internal::Type::BaseModel
|
|
300
|
+
OrHash =
|
|
301
|
+
T.type_alias do
|
|
302
|
+
T.any(
|
|
303
|
+
ContextDev::WebExtractParams::Action::Wait,
|
|
304
|
+
ContextDev::Internal::AnyHash
|
|
305
|
+
)
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
sig { returns(Symbol) }
|
|
309
|
+
attr_accessor :do_
|
|
310
|
+
|
|
311
|
+
sig { returns(Integer) }
|
|
312
|
+
attr_accessor :time_ms
|
|
313
|
+
|
|
314
|
+
# Pause for a fixed number of milliseconds before continuing to the next action.
|
|
315
|
+
sig do
|
|
316
|
+
params(time_ms: Integer, do_: Symbol).returns(T.attached_class)
|
|
317
|
+
end
|
|
318
|
+
def self.new(time_ms:, do_: :wait)
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
sig { override.returns({ do_: Symbol, time_ms: Integer }) }
|
|
322
|
+
def to_hash
|
|
323
|
+
end
|
|
324
|
+
end
|
|
325
|
+
|
|
326
|
+
class Perform < ContextDev::Internal::Type::BaseModel
|
|
327
|
+
OrHash =
|
|
328
|
+
T.type_alias do
|
|
329
|
+
T.any(
|
|
330
|
+
ContextDev::WebExtractParams::Action::Perform,
|
|
331
|
+
ContextDev::Internal::AnyHash
|
|
332
|
+
)
|
|
333
|
+
end
|
|
334
|
+
|
|
335
|
+
sig { returns(String) }
|
|
336
|
+
attr_accessor :action
|
|
337
|
+
|
|
338
|
+
sig { returns(Symbol) }
|
|
339
|
+
attr_accessor :do_
|
|
340
|
+
|
|
341
|
+
# Resolve and perform one natural-language browser action.
|
|
342
|
+
sig { params(action: String, do_: Symbol).returns(T.attached_class) }
|
|
343
|
+
def self.new(action:, do_: :perform)
|
|
344
|
+
end
|
|
345
|
+
|
|
346
|
+
sig { override.returns({ action: String, do_: Symbol }) }
|
|
347
|
+
def to_hash
|
|
348
|
+
end
|
|
349
|
+
end
|
|
350
|
+
|
|
351
|
+
class Scroll < ContextDev::Internal::Type::BaseModel
|
|
352
|
+
OrHash =
|
|
353
|
+
T.type_alias do
|
|
354
|
+
T.any(
|
|
355
|
+
ContextDev::WebExtractParams::Action::Scroll,
|
|
356
|
+
ContextDev::Internal::AnyHash
|
|
357
|
+
)
|
|
358
|
+
end
|
|
359
|
+
|
|
360
|
+
sig { returns(Symbol) }
|
|
361
|
+
attr_accessor :do_
|
|
362
|
+
|
|
363
|
+
# Pixels per scroll, one visible viewport, or the current scroll boundary.
|
|
364
|
+
# Defaults to viewport.
|
|
365
|
+
sig do
|
|
366
|
+
returns(
|
|
367
|
+
T.nilable(
|
|
368
|
+
T.any(
|
|
369
|
+
Integer,
|
|
370
|
+
ContextDev::WebExtractParams::Action::Scroll::Amount::OrSymbol
|
|
371
|
+
)
|
|
372
|
+
)
|
|
373
|
+
)
|
|
374
|
+
end
|
|
375
|
+
attr_reader :amount
|
|
376
|
+
|
|
377
|
+
sig do
|
|
378
|
+
params(
|
|
379
|
+
amount:
|
|
380
|
+
T.any(
|
|
381
|
+
Integer,
|
|
382
|
+
ContextDev::WebExtractParams::Action::Scroll::Amount::OrSymbol
|
|
383
|
+
)
|
|
384
|
+
).void
|
|
385
|
+
end
|
|
386
|
+
attr_writer :amount
|
|
387
|
+
|
|
388
|
+
# CSS selector for the first matching scroll container. Defaults to the page.
|
|
389
|
+
sig { returns(T.nilable(String)) }
|
|
390
|
+
attr_reader :container
|
|
391
|
+
|
|
392
|
+
sig { params(container: String).void }
|
|
393
|
+
attr_writer :container
|
|
394
|
+
|
|
395
|
+
# Direction to scroll. Defaults to down.
|
|
396
|
+
sig do
|
|
397
|
+
returns(
|
|
398
|
+
T.nilable(
|
|
399
|
+
ContextDev::WebExtractParams::Action::Scroll::Direction::OrSymbol
|
|
400
|
+
)
|
|
401
|
+
)
|
|
402
|
+
end
|
|
403
|
+
attr_reader :direction
|
|
404
|
+
|
|
405
|
+
sig do
|
|
406
|
+
params(
|
|
407
|
+
direction:
|
|
408
|
+
ContextDev::WebExtractParams::Action::Scroll::Direction::OrSymbol
|
|
409
|
+
).void
|
|
410
|
+
end
|
|
411
|
+
attr_writer :direction
|
|
412
|
+
|
|
413
|
+
# Maximum scroll iterations. Stops early when scrolling and scrollable extent stop
|
|
414
|
+
# changing. Defaults to 1.
|
|
415
|
+
sig { returns(T.nilable(Integer)) }
|
|
416
|
+
attr_reader :max_scrolls
|
|
417
|
+
|
|
418
|
+
sig { params(max_scrolls: Integer).void }
|
|
419
|
+
attr_writer :max_scrolls
|
|
420
|
+
|
|
421
|
+
# Scroll the page or a selected scrollable container, waiting adaptively for
|
|
422
|
+
# content and dimensions to settle after each iteration.
|
|
423
|
+
sig do
|
|
424
|
+
params(
|
|
425
|
+
amount:
|
|
426
|
+
T.any(
|
|
427
|
+
Integer,
|
|
428
|
+
ContextDev::WebExtractParams::Action::Scroll::Amount::OrSymbol
|
|
429
|
+
),
|
|
430
|
+
container: String,
|
|
431
|
+
direction:
|
|
432
|
+
ContextDev::WebExtractParams::Action::Scroll::Direction::OrSymbol,
|
|
433
|
+
max_scrolls: Integer,
|
|
434
|
+
do_: Symbol
|
|
435
|
+
).returns(T.attached_class)
|
|
436
|
+
end
|
|
437
|
+
def self.new(
|
|
438
|
+
# Pixels per scroll, one visible viewport, or the current scroll boundary.
|
|
439
|
+
# Defaults to viewport.
|
|
440
|
+
amount: nil,
|
|
441
|
+
# CSS selector for the first matching scroll container. Defaults to the page.
|
|
442
|
+
container: nil,
|
|
443
|
+
# Direction to scroll. Defaults to down.
|
|
444
|
+
direction: nil,
|
|
445
|
+
# Maximum scroll iterations. Stops early when scrolling and scrollable extent stop
|
|
446
|
+
# changing. Defaults to 1.
|
|
447
|
+
max_scrolls: nil,
|
|
448
|
+
do_: :scroll
|
|
449
|
+
)
|
|
450
|
+
end
|
|
451
|
+
|
|
452
|
+
sig do
|
|
453
|
+
override.returns(
|
|
454
|
+
{
|
|
455
|
+
do_: Symbol,
|
|
456
|
+
amount:
|
|
457
|
+
T.any(
|
|
458
|
+
Integer,
|
|
459
|
+
ContextDev::WebExtractParams::Action::Scroll::Amount::OrSymbol
|
|
460
|
+
),
|
|
461
|
+
container: String,
|
|
462
|
+
direction:
|
|
463
|
+
ContextDev::WebExtractParams::Action::Scroll::Direction::OrSymbol,
|
|
464
|
+
max_scrolls: Integer
|
|
465
|
+
}
|
|
466
|
+
)
|
|
467
|
+
end
|
|
468
|
+
def to_hash
|
|
469
|
+
end
|
|
470
|
+
|
|
471
|
+
# Pixels per scroll, one visible viewport, or the current scroll boundary.
|
|
472
|
+
# Defaults to viewport.
|
|
473
|
+
module Amount
|
|
474
|
+
extend ContextDev::Internal::Type::Union
|
|
475
|
+
|
|
476
|
+
Variants =
|
|
477
|
+
T.type_alias do
|
|
478
|
+
T.any(
|
|
479
|
+
Integer,
|
|
480
|
+
ContextDev::WebExtractParams::Action::Scroll::Amount::TaggedSymbol
|
|
481
|
+
)
|
|
482
|
+
end
|
|
483
|
+
|
|
484
|
+
sig do
|
|
485
|
+
override.returns(
|
|
486
|
+
T::Array[
|
|
487
|
+
ContextDev::WebExtractParams::Action::Scroll::Amount::Variants
|
|
488
|
+
]
|
|
489
|
+
)
|
|
490
|
+
end
|
|
491
|
+
def self.variants
|
|
492
|
+
end
|
|
493
|
+
|
|
494
|
+
TaggedSymbol =
|
|
495
|
+
T.type_alias do
|
|
496
|
+
T.all(
|
|
497
|
+
Symbol,
|
|
498
|
+
ContextDev::WebExtractParams::Action::Scroll::Amount
|
|
499
|
+
)
|
|
500
|
+
end
|
|
501
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
502
|
+
|
|
503
|
+
VIEWPORT =
|
|
504
|
+
T.let(
|
|
505
|
+
:viewport,
|
|
506
|
+
ContextDev::WebExtractParams::Action::Scroll::Amount::TaggedSymbol
|
|
507
|
+
)
|
|
508
|
+
MAX =
|
|
509
|
+
T.let(
|
|
510
|
+
:max,
|
|
511
|
+
ContextDev::WebExtractParams::Action::Scroll::Amount::TaggedSymbol
|
|
512
|
+
)
|
|
513
|
+
end
|
|
514
|
+
|
|
515
|
+
# Direction to scroll. Defaults to down.
|
|
516
|
+
module Direction
|
|
517
|
+
extend ContextDev::Internal::Type::Enum
|
|
518
|
+
|
|
519
|
+
TaggedSymbol =
|
|
520
|
+
T.type_alias do
|
|
521
|
+
T.all(
|
|
522
|
+
Symbol,
|
|
523
|
+
ContextDev::WebExtractParams::Action::Scroll::Direction
|
|
524
|
+
)
|
|
525
|
+
end
|
|
526
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
527
|
+
|
|
528
|
+
UP =
|
|
529
|
+
T.let(
|
|
530
|
+
:up,
|
|
531
|
+
ContextDev::WebExtractParams::Action::Scroll::Direction::TaggedSymbol
|
|
532
|
+
)
|
|
533
|
+
DOWN =
|
|
534
|
+
T.let(
|
|
535
|
+
:down,
|
|
536
|
+
ContextDev::WebExtractParams::Action::Scroll::Direction::TaggedSymbol
|
|
537
|
+
)
|
|
538
|
+
LEFT =
|
|
539
|
+
T.let(
|
|
540
|
+
:left,
|
|
541
|
+
ContextDev::WebExtractParams::Action::Scroll::Direction::TaggedSymbol
|
|
542
|
+
)
|
|
543
|
+
RIGHT =
|
|
544
|
+
T.let(
|
|
545
|
+
:right,
|
|
546
|
+
ContextDev::WebExtractParams::Action::Scroll::Direction::TaggedSymbol
|
|
547
|
+
)
|
|
548
|
+
|
|
549
|
+
sig do
|
|
550
|
+
override.returns(
|
|
551
|
+
T::Array[
|
|
552
|
+
ContextDev::WebExtractParams::Action::Scroll::Direction::TaggedSymbol
|
|
553
|
+
]
|
|
554
|
+
)
|
|
555
|
+
end
|
|
556
|
+
def self.values
|
|
557
|
+
end
|
|
558
|
+
end
|
|
559
|
+
end
|
|
560
|
+
|
|
561
|
+
sig do
|
|
562
|
+
override.returns(
|
|
563
|
+
T::Array[ContextDev::WebExtractParams::Action::Variants]
|
|
564
|
+
)
|
|
565
|
+
end
|
|
566
|
+
def self.variants
|
|
567
|
+
end
|
|
568
|
+
end
|
|
569
|
+
|
|
225
570
|
class Pdf < ContextDev::Internal::Type::BaseModel
|
|
226
571
|
OrHash =
|
|
227
572
|
T.type_alias do
|
|
@@ -123,6 +123,28 @@ module ContextDev
|
|
|
123
123
|
sig { returns(Integer) }
|
|
124
124
|
attr_accessor :num_urls
|
|
125
125
|
|
|
126
|
+
# One verified outcome per requested browser action, in request order.
|
|
127
|
+
sig do
|
|
128
|
+
returns(
|
|
129
|
+
T.nilable(
|
|
130
|
+
T::Array[
|
|
131
|
+
ContextDev::Models::WebExtractResponse::Metadata::ActionsApplied
|
|
132
|
+
]
|
|
133
|
+
)
|
|
134
|
+
)
|
|
135
|
+
end
|
|
136
|
+
attr_reader :actions_applied
|
|
137
|
+
|
|
138
|
+
sig do
|
|
139
|
+
params(
|
|
140
|
+
actions_applied:
|
|
141
|
+
T::Array[
|
|
142
|
+
ContextDev::Models::WebExtractResponse::Metadata::ActionsApplied::OrHash
|
|
143
|
+
]
|
|
144
|
+
).void
|
|
145
|
+
end
|
|
146
|
+
attr_writer :actions_applied
|
|
147
|
+
|
|
126
148
|
sig do
|
|
127
149
|
params(
|
|
128
150
|
max_crawl_depth: Integer,
|
|
@@ -130,7 +152,11 @@ module ContextDev
|
|
|
130
152
|
num_failed: Integer,
|
|
131
153
|
num_skipped: Integer,
|
|
132
154
|
num_succeeded: Integer,
|
|
133
|
-
num_urls: Integer
|
|
155
|
+
num_urls: Integer,
|
|
156
|
+
actions_applied:
|
|
157
|
+
T::Array[
|
|
158
|
+
ContextDev::Models::WebExtractResponse::Metadata::ActionsApplied::OrHash
|
|
159
|
+
]
|
|
134
160
|
).returns(T.attached_class)
|
|
135
161
|
end
|
|
136
162
|
def self.new(
|
|
@@ -141,7 +167,9 @@ module ContextDev
|
|
|
141
167
|
num_failed:,
|
|
142
168
|
num_skipped:,
|
|
143
169
|
num_succeeded:,
|
|
144
|
-
num_urls
|
|
170
|
+
num_urls:,
|
|
171
|
+
# One verified outcome per requested browser action, in request order.
|
|
172
|
+
actions_applied: nil
|
|
145
173
|
)
|
|
146
174
|
end
|
|
147
175
|
|
|
@@ -153,12 +181,153 @@ module ContextDev
|
|
|
153
181
|
num_failed: Integer,
|
|
154
182
|
num_skipped: Integer,
|
|
155
183
|
num_succeeded: Integer,
|
|
156
|
-
num_urls: Integer
|
|
184
|
+
num_urls: Integer,
|
|
185
|
+
actions_applied:
|
|
186
|
+
T::Array[
|
|
187
|
+
ContextDev::Models::WebExtractResponse::Metadata::ActionsApplied
|
|
188
|
+
]
|
|
157
189
|
}
|
|
158
190
|
)
|
|
159
191
|
end
|
|
160
192
|
def to_hash
|
|
161
193
|
end
|
|
194
|
+
|
|
195
|
+
class ActionsApplied < ContextDev::Internal::Type::BaseModel
|
|
196
|
+
OrHash =
|
|
197
|
+
T.type_alias do
|
|
198
|
+
T.any(
|
|
199
|
+
ContextDev::Models::WebExtractResponse::Metadata::ActionsApplied,
|
|
200
|
+
ContextDev::Internal::AnyHash
|
|
201
|
+
)
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
sig { returns(String) }
|
|
205
|
+
attr_accessor :instruction
|
|
206
|
+
|
|
207
|
+
# Applied means the requested page state was visibly verified. Failed means it was
|
|
208
|
+
# not verified. Skipped means it was not attempted.
|
|
209
|
+
sig do
|
|
210
|
+
returns(
|
|
211
|
+
ContextDev::Models::WebExtractResponse::Metadata::ActionsApplied::Status::TaggedSymbol
|
|
212
|
+
)
|
|
213
|
+
end
|
|
214
|
+
attr_accessor :status
|
|
215
|
+
|
|
216
|
+
# Visible page evidence used to verify an applied action.
|
|
217
|
+
sig { returns(T.nilable(String)) }
|
|
218
|
+
attr_reader :completion_evidence
|
|
219
|
+
|
|
220
|
+
sig { params(completion_evidence: String).void }
|
|
221
|
+
attr_writer :completion_evidence
|
|
222
|
+
|
|
223
|
+
sig { returns(T.nilable(Float)) }
|
|
224
|
+
attr_reader :duration_ms
|
|
225
|
+
|
|
226
|
+
sig { params(duration_ms: Float).void }
|
|
227
|
+
attr_writer :duration_ms
|
|
228
|
+
|
|
229
|
+
sig { returns(T.nilable(String)) }
|
|
230
|
+
attr_reader :error
|
|
231
|
+
|
|
232
|
+
sig { params(error: String).void }
|
|
233
|
+
attr_writer :error
|
|
234
|
+
|
|
235
|
+
sig { returns(T.nilable(String)) }
|
|
236
|
+
attr_reader :method_
|
|
237
|
+
|
|
238
|
+
sig { params(method_: String).void }
|
|
239
|
+
attr_writer :method_
|
|
240
|
+
|
|
241
|
+
sig { returns(T.nilable(String)) }
|
|
242
|
+
attr_reader :target_description
|
|
243
|
+
|
|
244
|
+
sig { params(target_description: String).void }
|
|
245
|
+
attr_writer :target_description
|
|
246
|
+
|
|
247
|
+
sig do
|
|
248
|
+
params(
|
|
249
|
+
instruction: String,
|
|
250
|
+
status:
|
|
251
|
+
ContextDev::Models::WebExtractResponse::Metadata::ActionsApplied::Status::OrSymbol,
|
|
252
|
+
completion_evidence: String,
|
|
253
|
+
duration_ms: Float,
|
|
254
|
+
error: String,
|
|
255
|
+
method_: String,
|
|
256
|
+
target_description: String
|
|
257
|
+
).returns(T.attached_class)
|
|
258
|
+
end
|
|
259
|
+
def self.new(
|
|
260
|
+
instruction:,
|
|
261
|
+
# Applied means the requested page state was visibly verified. Failed means it was
|
|
262
|
+
# not verified. Skipped means it was not attempted.
|
|
263
|
+
status:,
|
|
264
|
+
# Visible page evidence used to verify an applied action.
|
|
265
|
+
completion_evidence: nil,
|
|
266
|
+
duration_ms: nil,
|
|
267
|
+
error: nil,
|
|
268
|
+
method_: nil,
|
|
269
|
+
target_description: nil
|
|
270
|
+
)
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
sig do
|
|
274
|
+
override.returns(
|
|
275
|
+
{
|
|
276
|
+
instruction: String,
|
|
277
|
+
status:
|
|
278
|
+
ContextDev::Models::WebExtractResponse::Metadata::ActionsApplied::Status::TaggedSymbol,
|
|
279
|
+
completion_evidence: String,
|
|
280
|
+
duration_ms: Float,
|
|
281
|
+
error: String,
|
|
282
|
+
method_: String,
|
|
283
|
+
target_description: String
|
|
284
|
+
}
|
|
285
|
+
)
|
|
286
|
+
end
|
|
287
|
+
def to_hash
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
# Applied means the requested page state was visibly verified. Failed means it was
|
|
291
|
+
# not verified. Skipped means it was not attempted.
|
|
292
|
+
module Status
|
|
293
|
+
extend ContextDev::Internal::Type::Enum
|
|
294
|
+
|
|
295
|
+
TaggedSymbol =
|
|
296
|
+
T.type_alias do
|
|
297
|
+
T.all(
|
|
298
|
+
Symbol,
|
|
299
|
+
ContextDev::Models::WebExtractResponse::Metadata::ActionsApplied::Status
|
|
300
|
+
)
|
|
301
|
+
end
|
|
302
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
303
|
+
|
|
304
|
+
APPLIED =
|
|
305
|
+
T.let(
|
|
306
|
+
:applied,
|
|
307
|
+
ContextDev::Models::WebExtractResponse::Metadata::ActionsApplied::Status::TaggedSymbol
|
|
308
|
+
)
|
|
309
|
+
FAILED =
|
|
310
|
+
T.let(
|
|
311
|
+
:failed,
|
|
312
|
+
ContextDev::Models::WebExtractResponse::Metadata::ActionsApplied::Status::TaggedSymbol
|
|
313
|
+
)
|
|
314
|
+
SKIPPED =
|
|
315
|
+
T.let(
|
|
316
|
+
:skipped,
|
|
317
|
+
ContextDev::Models::WebExtractResponse::Metadata::ActionsApplied::Status::TaggedSymbol
|
|
318
|
+
)
|
|
319
|
+
|
|
320
|
+
sig do
|
|
321
|
+
override.returns(
|
|
322
|
+
T::Array[
|
|
323
|
+
ContextDev::Models::WebExtractResponse::Metadata::ActionsApplied::Status::TaggedSymbol
|
|
324
|
+
]
|
|
325
|
+
)
|
|
326
|
+
end
|
|
327
|
+
def self.values
|
|
328
|
+
end
|
|
329
|
+
end
|
|
330
|
+
end
|
|
162
331
|
end
|
|
163
332
|
|
|
164
333
|
class KeyMetadata < ContextDev::Internal::Type::BaseModel
|
|
@@ -150,7 +150,9 @@ module ContextDev
|
|
|
150
150
|
sig { params(timeout_ms: Integer).void }
|
|
151
151
|
attr_writer :timeout_ms
|
|
152
152
|
|
|
153
|
-
# Regex pattern. Only URLs matching this pattern will be followed and scraped.
|
|
153
|
+
# Regex pattern. Only URLs matching this pattern will be followed and scraped. An
|
|
154
|
+
# automatic prefix scope in the form ^<starting URL> follows a redirect of the
|
|
155
|
+
# starting page.
|
|
154
156
|
sig { returns(T.nilable(String)) }
|
|
155
157
|
attr_reader :url_regex
|
|
156
158
|
|
|
@@ -165,8 +167,8 @@ module ContextDev
|
|
|
165
167
|
sig { params(use_main_content_only: T::Boolean).void }
|
|
166
168
|
attr_writer :use_main_content_only
|
|
167
169
|
|
|
168
|
-
#
|
|
169
|
-
#
|
|
170
|
+
# Browser wait time in milliseconds after initial page load for each crawled page.
|
|
171
|
+
# Defaults to 3500 (3.5 seconds). Min: 0. Max: 30000 (30 seconds).
|
|
170
172
|
sig { returns(T.nilable(Integer)) }
|
|
171
173
|
attr_reader :wait_for_ms
|
|
172
174
|
|
|
@@ -263,13 +265,15 @@ module ContextDev
|
|
|
263
265
|
# than this value, it will be aborted with a 408 status code. Maximum allowed
|
|
264
266
|
# value is 300000ms (5 minutes).
|
|
265
267
|
timeout_ms: nil,
|
|
266
|
-
# Regex pattern. Only URLs matching this pattern will be followed and scraped.
|
|
268
|
+
# Regex pattern. Only URLs matching this pattern will be followed and scraped. An
|
|
269
|
+
# automatic prefix scope in the form ^<starting URL> follows a redirect of the
|
|
270
|
+
# starting page.
|
|
267
271
|
url_regex: nil,
|
|
268
272
|
# Extract only the main content, stripping headers, footers, sidebars, and
|
|
269
273
|
# navigation
|
|
270
274
|
use_main_content_only: nil,
|
|
271
|
-
#
|
|
272
|
-
#
|
|
275
|
+
# Browser wait time in milliseconds after initial page load for each crawled page.
|
|
276
|
+
# Defaults to 3500 (3.5 seconds). Min: 0. Max: 30000 (30 seconds).
|
|
273
277
|
wait_for_ms: nil,
|
|
274
278
|
# Set to enabled to bypass shared caches and omit request and response content
|
|
275
279
|
# from retained usage logs. Requires zero data retention to be enabled for your
|