context.dev 2.10.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 +21 -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/brand_retrieve_response.rb +29 -1
- data/lib/context_dev/models/brand_retrieve_simplified_response.rb +30 -1
- data/lib/context_dev/models/news_search_params.rb +1 -0
- data/lib/context_dev/models/news_search_response.rb +68 -22
- 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_screenshot_params.rb +13 -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 +13 -8
- 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/brand_retrieve_response.rbi +80 -3
- data/rbi/context_dev/models/brand_retrieve_simplified_response.rbi +80 -3
- data/rbi/context_dev/models/news_search_params.rbi +5 -0
- data/rbi/context_dev/models/news_search_response.rbi +70 -4
- 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_screenshot_params.rbi +19 -0
- 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 +38 -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/brand_retrieve_response.rbs +33 -3
- data/sig/context_dev/models/brand_retrieve_simplified_response.rbs +33 -3
- 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_screenshot_params.rbs +7 -0
- 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 +2 -0
- metadata +2 -2
|
@@ -29,6 +29,28 @@ module ContextDev
|
|
|
29
29
|
sig { returns(String) }
|
|
30
30
|
attr_accessor :url
|
|
31
31
|
|
|
32
|
+
# One verified outcome per requested browser action, in request order.
|
|
33
|
+
sig do
|
|
34
|
+
returns(
|
|
35
|
+
T.nilable(
|
|
36
|
+
T::Array[
|
|
37
|
+
ContextDev::Models::WebWebScrapeImagesResponse::ActionsApplied
|
|
38
|
+
]
|
|
39
|
+
)
|
|
40
|
+
)
|
|
41
|
+
end
|
|
42
|
+
attr_reader :actions_applied
|
|
43
|
+
|
|
44
|
+
sig do
|
|
45
|
+
params(
|
|
46
|
+
actions_applied:
|
|
47
|
+
T::Array[
|
|
48
|
+
ContextDev::Models::WebWebScrapeImagesResponse::ActionsApplied::OrHash
|
|
49
|
+
]
|
|
50
|
+
).void
|
|
51
|
+
end
|
|
52
|
+
attr_writer :actions_applied
|
|
53
|
+
|
|
32
54
|
# Metadata about the API key used for the request. Included in every response
|
|
33
55
|
# whenever a valid API key is provided, even when the response status is not 200.
|
|
34
56
|
sig do
|
|
@@ -55,6 +77,10 @@ module ContextDev
|
|
|
55
77
|
success:
|
|
56
78
|
ContextDev::Models::WebWebScrapeImagesResponse::Success::OrBoolean,
|
|
57
79
|
url: String,
|
|
80
|
+
actions_applied:
|
|
81
|
+
T::Array[
|
|
82
|
+
ContextDev::Models::WebWebScrapeImagesResponse::ActionsApplied::OrHash
|
|
83
|
+
],
|
|
58
84
|
key_metadata:
|
|
59
85
|
ContextDev::Models::WebWebScrapeImagesResponse::KeyMetadata::OrHash
|
|
60
86
|
).returns(T.attached_class)
|
|
@@ -66,6 +92,8 @@ module ContextDev
|
|
|
66
92
|
success:,
|
|
67
93
|
# Page URL that was scraped.
|
|
68
94
|
url:,
|
|
95
|
+
# One verified outcome per requested browser action, in request order.
|
|
96
|
+
actions_applied: nil,
|
|
69
97
|
# Metadata about the API key used for the request. Included in every response
|
|
70
98
|
# whenever a valid API key is provided, even when the response status is not 200.
|
|
71
99
|
key_metadata: nil
|
|
@@ -80,6 +108,10 @@ module ContextDev
|
|
|
80
108
|
success:
|
|
81
109
|
ContextDev::Models::WebWebScrapeImagesResponse::Success::TaggedBoolean,
|
|
82
110
|
url: String,
|
|
111
|
+
actions_applied:
|
|
112
|
+
T::Array[
|
|
113
|
+
ContextDev::Models::WebWebScrapeImagesResponse::ActionsApplied
|
|
114
|
+
],
|
|
83
115
|
key_metadata:
|
|
84
116
|
ContextDev::Models::WebWebScrapeImagesResponse::KeyMetadata
|
|
85
117
|
}
|
|
@@ -484,6 +516,143 @@ module ContextDev
|
|
|
484
516
|
end
|
|
485
517
|
end
|
|
486
518
|
|
|
519
|
+
class ActionsApplied < ContextDev::Internal::Type::BaseModel
|
|
520
|
+
OrHash =
|
|
521
|
+
T.type_alias do
|
|
522
|
+
T.any(
|
|
523
|
+
ContextDev::Models::WebWebScrapeImagesResponse::ActionsApplied,
|
|
524
|
+
ContextDev::Internal::AnyHash
|
|
525
|
+
)
|
|
526
|
+
end
|
|
527
|
+
|
|
528
|
+
sig { returns(String) }
|
|
529
|
+
attr_accessor :instruction
|
|
530
|
+
|
|
531
|
+
# Applied means the requested page state was visibly verified. Failed means it was
|
|
532
|
+
# not verified. Skipped means it was not attempted.
|
|
533
|
+
sig do
|
|
534
|
+
returns(
|
|
535
|
+
ContextDev::Models::WebWebScrapeImagesResponse::ActionsApplied::Status::TaggedSymbol
|
|
536
|
+
)
|
|
537
|
+
end
|
|
538
|
+
attr_accessor :status
|
|
539
|
+
|
|
540
|
+
# Visible page evidence used to verify an applied action.
|
|
541
|
+
sig { returns(T.nilable(String)) }
|
|
542
|
+
attr_reader :completion_evidence
|
|
543
|
+
|
|
544
|
+
sig { params(completion_evidence: String).void }
|
|
545
|
+
attr_writer :completion_evidence
|
|
546
|
+
|
|
547
|
+
sig { returns(T.nilable(Float)) }
|
|
548
|
+
attr_reader :duration_ms
|
|
549
|
+
|
|
550
|
+
sig { params(duration_ms: Float).void }
|
|
551
|
+
attr_writer :duration_ms
|
|
552
|
+
|
|
553
|
+
sig { returns(T.nilable(String)) }
|
|
554
|
+
attr_reader :error
|
|
555
|
+
|
|
556
|
+
sig { params(error: String).void }
|
|
557
|
+
attr_writer :error
|
|
558
|
+
|
|
559
|
+
sig { returns(T.nilable(String)) }
|
|
560
|
+
attr_reader :method_
|
|
561
|
+
|
|
562
|
+
sig { params(method_: String).void }
|
|
563
|
+
attr_writer :method_
|
|
564
|
+
|
|
565
|
+
sig { returns(T.nilable(String)) }
|
|
566
|
+
attr_reader :target_description
|
|
567
|
+
|
|
568
|
+
sig { params(target_description: String).void }
|
|
569
|
+
attr_writer :target_description
|
|
570
|
+
|
|
571
|
+
sig do
|
|
572
|
+
params(
|
|
573
|
+
instruction: String,
|
|
574
|
+
status:
|
|
575
|
+
ContextDev::Models::WebWebScrapeImagesResponse::ActionsApplied::Status::OrSymbol,
|
|
576
|
+
completion_evidence: String,
|
|
577
|
+
duration_ms: Float,
|
|
578
|
+
error: String,
|
|
579
|
+
method_: String,
|
|
580
|
+
target_description: String
|
|
581
|
+
).returns(T.attached_class)
|
|
582
|
+
end
|
|
583
|
+
def self.new(
|
|
584
|
+
instruction:,
|
|
585
|
+
# Applied means the requested page state was visibly verified. Failed means it was
|
|
586
|
+
# not verified. Skipped means it was not attempted.
|
|
587
|
+
status:,
|
|
588
|
+
# Visible page evidence used to verify an applied action.
|
|
589
|
+
completion_evidence: nil,
|
|
590
|
+
duration_ms: nil,
|
|
591
|
+
error: nil,
|
|
592
|
+
method_: nil,
|
|
593
|
+
target_description: nil
|
|
594
|
+
)
|
|
595
|
+
end
|
|
596
|
+
|
|
597
|
+
sig do
|
|
598
|
+
override.returns(
|
|
599
|
+
{
|
|
600
|
+
instruction: String,
|
|
601
|
+
status:
|
|
602
|
+
ContextDev::Models::WebWebScrapeImagesResponse::ActionsApplied::Status::TaggedSymbol,
|
|
603
|
+
completion_evidence: String,
|
|
604
|
+
duration_ms: Float,
|
|
605
|
+
error: String,
|
|
606
|
+
method_: String,
|
|
607
|
+
target_description: String
|
|
608
|
+
}
|
|
609
|
+
)
|
|
610
|
+
end
|
|
611
|
+
def to_hash
|
|
612
|
+
end
|
|
613
|
+
|
|
614
|
+
# Applied means the requested page state was visibly verified. Failed means it was
|
|
615
|
+
# not verified. Skipped means it was not attempted.
|
|
616
|
+
module Status
|
|
617
|
+
extend ContextDev::Internal::Type::Enum
|
|
618
|
+
|
|
619
|
+
TaggedSymbol =
|
|
620
|
+
T.type_alias do
|
|
621
|
+
T.all(
|
|
622
|
+
Symbol,
|
|
623
|
+
ContextDev::Models::WebWebScrapeImagesResponse::ActionsApplied::Status
|
|
624
|
+
)
|
|
625
|
+
end
|
|
626
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
627
|
+
|
|
628
|
+
APPLIED =
|
|
629
|
+
T.let(
|
|
630
|
+
:applied,
|
|
631
|
+
ContextDev::Models::WebWebScrapeImagesResponse::ActionsApplied::Status::TaggedSymbol
|
|
632
|
+
)
|
|
633
|
+
FAILED =
|
|
634
|
+
T.let(
|
|
635
|
+
:failed,
|
|
636
|
+
ContextDev::Models::WebWebScrapeImagesResponse::ActionsApplied::Status::TaggedSymbol
|
|
637
|
+
)
|
|
638
|
+
SKIPPED =
|
|
639
|
+
T.let(
|
|
640
|
+
:skipped,
|
|
641
|
+
ContextDev::Models::WebWebScrapeImagesResponse::ActionsApplied::Status::TaggedSymbol
|
|
642
|
+
)
|
|
643
|
+
|
|
644
|
+
sig do
|
|
645
|
+
override.returns(
|
|
646
|
+
T::Array[
|
|
647
|
+
ContextDev::Models::WebWebScrapeImagesResponse::ActionsApplied::Status::TaggedSymbol
|
|
648
|
+
]
|
|
649
|
+
)
|
|
650
|
+
end
|
|
651
|
+
def self.values
|
|
652
|
+
end
|
|
653
|
+
end
|
|
654
|
+
end
|
|
655
|
+
|
|
487
656
|
class KeyMetadata < ContextDev::Internal::Type::BaseModel
|
|
488
657
|
OrHash =
|
|
489
658
|
T.type_alias do
|
|
@@ -25,7 +25,8 @@ module ContextDev
|
|
|
25
25
|
T::Array[
|
|
26
26
|
T.any(
|
|
27
27
|
ContextDev::WebWebScrapeMdParams::Action::Wait,
|
|
28
|
-
ContextDev::WebWebScrapeMdParams::Action::Perform
|
|
28
|
+
ContextDev::WebWebScrapeMdParams::Action::Perform,
|
|
29
|
+
ContextDev::WebWebScrapeMdParams::Action::Scroll
|
|
29
30
|
)
|
|
30
31
|
]
|
|
31
32
|
)
|
|
@@ -179,7 +180,8 @@ module ContextDev
|
|
|
179
180
|
T::Array[
|
|
180
181
|
T.any(
|
|
181
182
|
ContextDev::WebWebScrapeMdParams::Action::Wait::OrHash,
|
|
182
|
-
ContextDev::WebWebScrapeMdParams::Action::Perform::OrHash
|
|
183
|
+
ContextDev::WebWebScrapeMdParams::Action::Perform::OrHash,
|
|
184
|
+
ContextDev::WebWebScrapeMdParams::Action::Scroll::OrHash
|
|
183
185
|
)
|
|
184
186
|
]
|
|
185
187
|
),
|
|
@@ -281,7 +283,8 @@ module ContextDev
|
|
|
281
283
|
T::Array[
|
|
282
284
|
T.any(
|
|
283
285
|
ContextDev::WebWebScrapeMdParams::Action::Wait,
|
|
284
|
-
ContextDev::WebWebScrapeMdParams::Action::Perform
|
|
286
|
+
ContextDev::WebWebScrapeMdParams::Action::Perform,
|
|
287
|
+
ContextDev::WebWebScrapeMdParams::Action::Scroll
|
|
285
288
|
)
|
|
286
289
|
]
|
|
287
290
|
),
|
|
@@ -318,7 +321,8 @@ module ContextDev
|
|
|
318
321
|
T.type_alias do
|
|
319
322
|
T.any(
|
|
320
323
|
ContextDev::WebWebScrapeMdParams::Action::Wait,
|
|
321
|
-
ContextDev::WebWebScrapeMdParams::Action::Perform
|
|
324
|
+
ContextDev::WebWebScrapeMdParams::Action::Perform,
|
|
325
|
+
ContextDev::WebWebScrapeMdParams::Action::Scroll
|
|
322
326
|
)
|
|
323
327
|
end
|
|
324
328
|
|
|
@@ -374,6 +378,216 @@ module ContextDev
|
|
|
374
378
|
end
|
|
375
379
|
end
|
|
376
380
|
|
|
381
|
+
class Scroll < ContextDev::Internal::Type::BaseModel
|
|
382
|
+
OrHash =
|
|
383
|
+
T.type_alias do
|
|
384
|
+
T.any(
|
|
385
|
+
ContextDev::WebWebScrapeMdParams::Action::Scroll,
|
|
386
|
+
ContextDev::Internal::AnyHash
|
|
387
|
+
)
|
|
388
|
+
end
|
|
389
|
+
|
|
390
|
+
sig { returns(Symbol) }
|
|
391
|
+
attr_accessor :do_
|
|
392
|
+
|
|
393
|
+
# Pixels per scroll, one visible viewport, or the current scroll boundary.
|
|
394
|
+
# Defaults to viewport.
|
|
395
|
+
sig do
|
|
396
|
+
returns(
|
|
397
|
+
T.nilable(
|
|
398
|
+
T.any(
|
|
399
|
+
Integer,
|
|
400
|
+
ContextDev::WebWebScrapeMdParams::Action::Scroll::Amount::OrSymbol
|
|
401
|
+
)
|
|
402
|
+
)
|
|
403
|
+
)
|
|
404
|
+
end
|
|
405
|
+
attr_reader :amount
|
|
406
|
+
|
|
407
|
+
sig do
|
|
408
|
+
params(
|
|
409
|
+
amount:
|
|
410
|
+
T.any(
|
|
411
|
+
Integer,
|
|
412
|
+
ContextDev::WebWebScrapeMdParams::Action::Scroll::Amount::OrSymbol
|
|
413
|
+
)
|
|
414
|
+
).void
|
|
415
|
+
end
|
|
416
|
+
attr_writer :amount
|
|
417
|
+
|
|
418
|
+
# CSS selector for the first matching scroll container. Defaults to the page.
|
|
419
|
+
sig { returns(T.nilable(String)) }
|
|
420
|
+
attr_reader :container
|
|
421
|
+
|
|
422
|
+
sig { params(container: String).void }
|
|
423
|
+
attr_writer :container
|
|
424
|
+
|
|
425
|
+
# Direction to scroll. Defaults to down.
|
|
426
|
+
sig do
|
|
427
|
+
returns(
|
|
428
|
+
T.nilable(
|
|
429
|
+
ContextDev::WebWebScrapeMdParams::Action::Scroll::Direction::OrSymbol
|
|
430
|
+
)
|
|
431
|
+
)
|
|
432
|
+
end
|
|
433
|
+
attr_reader :direction
|
|
434
|
+
|
|
435
|
+
sig do
|
|
436
|
+
params(
|
|
437
|
+
direction:
|
|
438
|
+
ContextDev::WebWebScrapeMdParams::Action::Scroll::Direction::OrSymbol
|
|
439
|
+
).void
|
|
440
|
+
end
|
|
441
|
+
attr_writer :direction
|
|
442
|
+
|
|
443
|
+
# Maximum scroll iterations. Stops early when scrolling and scrollable extent stop
|
|
444
|
+
# changing. Defaults to 1.
|
|
445
|
+
sig { returns(T.nilable(Integer)) }
|
|
446
|
+
attr_reader :max_scrolls
|
|
447
|
+
|
|
448
|
+
sig { params(max_scrolls: Integer).void }
|
|
449
|
+
attr_writer :max_scrolls
|
|
450
|
+
|
|
451
|
+
# Scroll the page or a selected scrollable container, waiting adaptively for
|
|
452
|
+
# content and dimensions to settle after each iteration.
|
|
453
|
+
sig do
|
|
454
|
+
params(
|
|
455
|
+
amount:
|
|
456
|
+
T.any(
|
|
457
|
+
Integer,
|
|
458
|
+
ContextDev::WebWebScrapeMdParams::Action::Scroll::Amount::OrSymbol
|
|
459
|
+
),
|
|
460
|
+
container: String,
|
|
461
|
+
direction:
|
|
462
|
+
ContextDev::WebWebScrapeMdParams::Action::Scroll::Direction::OrSymbol,
|
|
463
|
+
max_scrolls: Integer,
|
|
464
|
+
do_: Symbol
|
|
465
|
+
).returns(T.attached_class)
|
|
466
|
+
end
|
|
467
|
+
def self.new(
|
|
468
|
+
# Pixels per scroll, one visible viewport, or the current scroll boundary.
|
|
469
|
+
# Defaults to viewport.
|
|
470
|
+
amount: nil,
|
|
471
|
+
# CSS selector for the first matching scroll container. Defaults to the page.
|
|
472
|
+
container: nil,
|
|
473
|
+
# Direction to scroll. Defaults to down.
|
|
474
|
+
direction: nil,
|
|
475
|
+
# Maximum scroll iterations. Stops early when scrolling and scrollable extent stop
|
|
476
|
+
# changing. Defaults to 1.
|
|
477
|
+
max_scrolls: nil,
|
|
478
|
+
do_: :scroll
|
|
479
|
+
)
|
|
480
|
+
end
|
|
481
|
+
|
|
482
|
+
sig do
|
|
483
|
+
override.returns(
|
|
484
|
+
{
|
|
485
|
+
do_: Symbol,
|
|
486
|
+
amount:
|
|
487
|
+
T.any(
|
|
488
|
+
Integer,
|
|
489
|
+
ContextDev::WebWebScrapeMdParams::Action::Scroll::Amount::OrSymbol
|
|
490
|
+
),
|
|
491
|
+
container: String,
|
|
492
|
+
direction:
|
|
493
|
+
ContextDev::WebWebScrapeMdParams::Action::Scroll::Direction::OrSymbol,
|
|
494
|
+
max_scrolls: Integer
|
|
495
|
+
}
|
|
496
|
+
)
|
|
497
|
+
end
|
|
498
|
+
def to_hash
|
|
499
|
+
end
|
|
500
|
+
|
|
501
|
+
# Pixels per scroll, one visible viewport, or the current scroll boundary.
|
|
502
|
+
# Defaults to viewport.
|
|
503
|
+
module Amount
|
|
504
|
+
extend ContextDev::Internal::Type::Union
|
|
505
|
+
|
|
506
|
+
Variants =
|
|
507
|
+
T.type_alias do
|
|
508
|
+
T.any(
|
|
509
|
+
Integer,
|
|
510
|
+
ContextDev::WebWebScrapeMdParams::Action::Scroll::Amount::TaggedSymbol
|
|
511
|
+
)
|
|
512
|
+
end
|
|
513
|
+
|
|
514
|
+
sig do
|
|
515
|
+
override.returns(
|
|
516
|
+
T::Array[
|
|
517
|
+
ContextDev::WebWebScrapeMdParams::Action::Scroll::Amount::Variants
|
|
518
|
+
]
|
|
519
|
+
)
|
|
520
|
+
end
|
|
521
|
+
def self.variants
|
|
522
|
+
end
|
|
523
|
+
|
|
524
|
+
TaggedSymbol =
|
|
525
|
+
T.type_alias do
|
|
526
|
+
T.all(
|
|
527
|
+
Symbol,
|
|
528
|
+
ContextDev::WebWebScrapeMdParams::Action::Scroll::Amount
|
|
529
|
+
)
|
|
530
|
+
end
|
|
531
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
532
|
+
|
|
533
|
+
VIEWPORT =
|
|
534
|
+
T.let(
|
|
535
|
+
:viewport,
|
|
536
|
+
ContextDev::WebWebScrapeMdParams::Action::Scroll::Amount::TaggedSymbol
|
|
537
|
+
)
|
|
538
|
+
MAX =
|
|
539
|
+
T.let(
|
|
540
|
+
:max,
|
|
541
|
+
ContextDev::WebWebScrapeMdParams::Action::Scroll::Amount::TaggedSymbol
|
|
542
|
+
)
|
|
543
|
+
end
|
|
544
|
+
|
|
545
|
+
# Direction to scroll. Defaults to down.
|
|
546
|
+
module Direction
|
|
547
|
+
extend ContextDev::Internal::Type::Enum
|
|
548
|
+
|
|
549
|
+
TaggedSymbol =
|
|
550
|
+
T.type_alias do
|
|
551
|
+
T.all(
|
|
552
|
+
Symbol,
|
|
553
|
+
ContextDev::WebWebScrapeMdParams::Action::Scroll::Direction
|
|
554
|
+
)
|
|
555
|
+
end
|
|
556
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
557
|
+
|
|
558
|
+
UP =
|
|
559
|
+
T.let(
|
|
560
|
+
:up,
|
|
561
|
+
ContextDev::WebWebScrapeMdParams::Action::Scroll::Direction::TaggedSymbol
|
|
562
|
+
)
|
|
563
|
+
DOWN =
|
|
564
|
+
T.let(
|
|
565
|
+
:down,
|
|
566
|
+
ContextDev::WebWebScrapeMdParams::Action::Scroll::Direction::TaggedSymbol
|
|
567
|
+
)
|
|
568
|
+
LEFT =
|
|
569
|
+
T.let(
|
|
570
|
+
:left,
|
|
571
|
+
ContextDev::WebWebScrapeMdParams::Action::Scroll::Direction::TaggedSymbol
|
|
572
|
+
)
|
|
573
|
+
RIGHT =
|
|
574
|
+
T.let(
|
|
575
|
+
:right,
|
|
576
|
+
ContextDev::WebWebScrapeMdParams::Action::Scroll::Direction::TaggedSymbol
|
|
577
|
+
)
|
|
578
|
+
|
|
579
|
+
sig do
|
|
580
|
+
override.returns(
|
|
581
|
+
T::Array[
|
|
582
|
+
ContextDev::WebWebScrapeMdParams::Action::Scroll::Direction::TaggedSymbol
|
|
583
|
+
]
|
|
584
|
+
)
|
|
585
|
+
end
|
|
586
|
+
def self.values
|
|
587
|
+
end
|
|
588
|
+
end
|
|
589
|
+
end
|
|
590
|
+
|
|
377
591
|
sig do
|
|
378
592
|
override.returns(
|
|
379
593
|
T::Array[ContextDev::WebWebScrapeMdParams::Action::Variants]
|
|
@@ -9,6 +9,14 @@ module ContextDev
|
|
|
9
9
|
params(
|
|
10
10
|
schema: T::Hash[Symbol, T.anything],
|
|
11
11
|
url: String,
|
|
12
|
+
actions:
|
|
13
|
+
T::Array[
|
|
14
|
+
T.any(
|
|
15
|
+
ContextDev::WebExtractParams::Action::Wait::OrHash,
|
|
16
|
+
ContextDev::WebExtractParams::Action::Perform::OrHash,
|
|
17
|
+
ContextDev::WebExtractParams::Action::Scroll::OrHash
|
|
18
|
+
)
|
|
19
|
+
],
|
|
12
20
|
fact_check: T::Boolean,
|
|
13
21
|
follow_subdomains: T::Boolean,
|
|
14
22
|
include_frames: T::Boolean,
|
|
@@ -26,13 +34,20 @@ module ContextDev
|
|
|
26
34
|
).returns(ContextDev::Models::WebExtractResponse)
|
|
27
35
|
end
|
|
28
36
|
def extract(
|
|
29
|
-
# JSON Schema for the returned data object.
|
|
30
|
-
#
|
|
31
|
-
#
|
|
37
|
+
# JSON Schema for the returned data object. Image fields such as `image_urls` or
|
|
38
|
+
# `product_photos` automatically make page image references available to
|
|
39
|
+
# extraction, so product data and photos can be returned in one call. TypeScript
|
|
40
|
+
# Zod users can pass a JSON Schema generated from a Zod object; Python users can
|
|
41
|
+
# pass the equivalent JSON Schema object.
|
|
32
42
|
schema:,
|
|
33
43
|
# The starting website URL to crawl and extract from. Must include http:// or
|
|
34
44
|
# https://.
|
|
35
45
|
url:,
|
|
46
|
+
# Optional browser actions executed in order on the requested page after it loads,
|
|
47
|
+
# before links are discovered or additional pages are crawled. Requires a paid
|
|
48
|
+
# plan. When actions are provided and stopAfterMs is omitted, the crawl budget
|
|
49
|
+
# defaults to 110000 ms.
|
|
50
|
+
actions: nil,
|
|
36
51
|
# When true, every returned value must be grounded in facts stated on the page;
|
|
37
52
|
# fields that cannot be supported by the page are returned as null/empty. When
|
|
38
53
|
# false (default), the model may make reasonable inferences and derivations from
|
|
@@ -61,7 +76,8 @@ module ContextDev
|
|
|
61
76
|
# exchange for more stable output on animated pages.
|
|
62
77
|
settle_animations: nil,
|
|
63
78
|
# Soft time budget for the crawl in milliseconds. Min: 10000 (10s). Max: 110000
|
|
64
|
-
# (110s).
|
|
79
|
+
# (110s). Defaults to 80000 (80s), or 110000 (110s) when browser actions are
|
|
80
|
+
# provided.
|
|
65
81
|
stop_after_ms: nil,
|
|
66
82
|
# Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
|
|
67
83
|
tags: nil,
|
|
@@ -190,6 +206,7 @@ module ContextDev
|
|
|
190
206
|
# Capture a screenshot of a website.
|
|
191
207
|
sig do
|
|
192
208
|
params(
|
|
209
|
+
clear_popups: T::Boolean,
|
|
193
210
|
color_scheme: ContextDev::WebScreenshotParams::ColorScheme::OrSymbol,
|
|
194
211
|
country: ContextDev::WebScreenshotParams::Country::OrSymbol,
|
|
195
212
|
direct_url: String,
|
|
@@ -209,6 +226,12 @@ module ContextDev
|
|
|
209
226
|
).returns(ContextDev::Models::WebScreenshotResponse)
|
|
210
227
|
end
|
|
211
228
|
def screenshot(
|
|
229
|
+
# Optional parameter for comprehensive popup cleanup. If 'true', the browser
|
|
230
|
+
# dismisses detected cookie/consent UI and clears other detected obstructive
|
|
231
|
+
# popups and overlays before capture. If 'false' or not provided, this parameter
|
|
232
|
+
# requests no cleanup; handleCookiePopup can still request cookie/consent handling
|
|
233
|
+
# independently.
|
|
234
|
+
clear_popups: nil,
|
|
212
235
|
# Optional parameter to choose the site's visual theme in the screenshot. Use
|
|
213
236
|
# 'light' or 'dark' when the site offers both appearances.
|
|
214
237
|
color_scheme: nil,
|
|
@@ -401,13 +424,15 @@ module ContextDev
|
|
|
401
424
|
# than this value, it will be aborted with a 408 status code. Maximum allowed
|
|
402
425
|
# value is 300000ms (5 minutes).
|
|
403
426
|
timeout_ms: nil,
|
|
404
|
-
# Regex pattern. Only URLs matching this pattern will be followed and scraped.
|
|
427
|
+
# Regex pattern. Only URLs matching this pattern will be followed and scraped. An
|
|
428
|
+
# automatic prefix scope in the form ^<starting URL> follows a redirect of the
|
|
429
|
+
# starting page.
|
|
405
430
|
url_regex: nil,
|
|
406
431
|
# Extract only the main content, stripping headers, footers, sidebars, and
|
|
407
432
|
# navigation
|
|
408
433
|
use_main_content_only: nil,
|
|
409
|
-
#
|
|
410
|
-
#
|
|
434
|
+
# Browser wait time in milliseconds after initial page load for each crawled page.
|
|
435
|
+
# Defaults to 3500 (3.5 seconds). Min: 0. Max: 30000 (30 seconds).
|
|
411
436
|
wait_for_ms: nil,
|
|
412
437
|
# Set to enabled to bypass shared caches and omit request and response content
|
|
413
438
|
# from retained usage logs. Requires zero data retention to be enabled for your
|
|
@@ -428,7 +453,8 @@ module ContextDev
|
|
|
428
453
|
T::Array[
|
|
429
454
|
T.any(
|
|
430
455
|
ContextDev::WebWebScrapeHTMLParams::Action::Wait::OrHash,
|
|
431
|
-
ContextDev::WebWebScrapeHTMLParams::Action::Perform::OrHash
|
|
456
|
+
ContextDev::WebWebScrapeHTMLParams::Action::Perform::OrHash,
|
|
457
|
+
ContextDev::WebWebScrapeHTMLParams::Action::Scroll::OrHash
|
|
432
458
|
)
|
|
433
459
|
]
|
|
434
460
|
),
|
|
@@ -519,7 +545,8 @@ module ContextDev
|
|
|
519
545
|
T::Array[
|
|
520
546
|
T.any(
|
|
521
547
|
ContextDev::WebWebScrapeImagesParams::Action::Wait::OrHash,
|
|
522
|
-
ContextDev::WebWebScrapeImagesParams::Action::Perform::OrHash
|
|
548
|
+
ContextDev::WebWebScrapeImagesParams::Action::Perform::OrHash,
|
|
549
|
+
ContextDev::WebWebScrapeImagesParams::Action::Scroll::OrHash
|
|
523
550
|
)
|
|
524
551
|
]
|
|
525
552
|
),
|
|
@@ -608,7 +635,8 @@ module ContextDev
|
|
|
608
635
|
T::Array[
|
|
609
636
|
T.any(
|
|
610
637
|
ContextDev::WebWebScrapeMdParams::Action::Wait::OrHash,
|
|
611
|
-
ContextDev::WebWebScrapeMdParams::Action::Perform::OrHash
|
|
638
|
+
ContextDev::WebWebScrapeMdParams::Action::Perform::OrHash,
|
|
639
|
+
ContextDev::WebWebScrapeMdParams::Action::Scroll::OrHash
|
|
612
640
|
)
|
|
613
641
|
]
|
|
614
642
|
),
|
|
@@ -78,12 +78,15 @@ module ContextDev
|
|
|
78
78
|
sku: String?,
|
|
79
79
|
tags: ::Array[String],
|
|
80
80
|
target_audience: ::Array[String],
|
|
81
|
+
availability: ContextDev::Models::AIExtractProductResponse::Product::availability?,
|
|
81
82
|
billing_frequency: ContextDev::Models::AIExtractProductResponse::Product::billing_frequency?,
|
|
82
83
|
category: String?,
|
|
83
84
|
currency: String?,
|
|
85
|
+
dimensions: ::Array[String],
|
|
84
86
|
image_url: String?,
|
|
85
87
|
price: Float?,
|
|
86
88
|
pricing_model: ContextDev::Models::AIExtractProductResponse::Product::pricing_model?,
|
|
89
|
+
regular_price: Float?,
|
|
87
90
|
url: String?
|
|
88
91
|
}
|
|
89
92
|
|
|
@@ -102,18 +105,26 @@ module ContextDev
|
|
|
102
105
|
|
|
103
106
|
attr_accessor target_audience: ::Array[String]
|
|
104
107
|
|
|
108
|
+
attr_accessor availability: ContextDev::Models::AIExtractProductResponse::Product::availability?
|
|
109
|
+
|
|
105
110
|
attr_accessor billing_frequency: ContextDev::Models::AIExtractProductResponse::Product::billing_frequency?
|
|
106
111
|
|
|
107
112
|
attr_accessor category: String?
|
|
108
113
|
|
|
109
114
|
attr_accessor currency: String?
|
|
110
115
|
|
|
116
|
+
attr_reader dimensions: ::Array[String]?
|
|
117
|
+
|
|
118
|
+
def dimensions=: (::Array[String]) -> ::Array[String]
|
|
119
|
+
|
|
111
120
|
attr_accessor image_url: String?
|
|
112
121
|
|
|
113
122
|
attr_accessor price: Float?
|
|
114
123
|
|
|
115
124
|
attr_accessor pricing_model: ContextDev::Models::AIExtractProductResponse::Product::pricing_model?
|
|
116
125
|
|
|
126
|
+
attr_accessor regular_price: Float?
|
|
127
|
+
|
|
117
128
|
attr_accessor url: String?
|
|
118
129
|
|
|
119
130
|
def initialize: (
|
|
@@ -124,12 +135,15 @@ module ContextDev
|
|
|
124
135
|
sku: String?,
|
|
125
136
|
tags: ::Array[String],
|
|
126
137
|
target_audience: ::Array[String],
|
|
138
|
+
?availability: ContextDev::Models::AIExtractProductResponse::Product::availability?,
|
|
127
139
|
?billing_frequency: ContextDev::Models::AIExtractProductResponse::Product::billing_frequency?,
|
|
128
140
|
?category: String?,
|
|
129
141
|
?currency: String?,
|
|
142
|
+
?dimensions: ::Array[String],
|
|
130
143
|
?image_url: String?,
|
|
131
144
|
?price: Float?,
|
|
132
145
|
?pricing_model: ContextDev::Models::AIExtractProductResponse::Product::pricing_model?,
|
|
146
|
+
?regular_price: Float?,
|
|
133
147
|
?url: String?
|
|
134
148
|
) -> void
|
|
135
149
|
|
|
@@ -141,15 +155,41 @@ module ContextDev
|
|
|
141
155
|
sku: String?,
|
|
142
156
|
tags: ::Array[String],
|
|
143
157
|
target_audience: ::Array[String],
|
|
158
|
+
availability: ContextDev::Models::AIExtractProductResponse::Product::availability?,
|
|
144
159
|
billing_frequency: ContextDev::Models::AIExtractProductResponse::Product::billing_frequency?,
|
|
145
160
|
category: String?,
|
|
146
161
|
currency: String?,
|
|
162
|
+
dimensions: ::Array[String],
|
|
147
163
|
image_url: String?,
|
|
148
164
|
price: Float?,
|
|
149
165
|
pricing_model: ContextDev::Models::AIExtractProductResponse::Product::pricing_model?,
|
|
166
|
+
regular_price: Float?,
|
|
150
167
|
url: String?
|
|
151
168
|
}
|
|
152
169
|
|
|
170
|
+
type availability =
|
|
171
|
+
:in_stock
|
|
172
|
+
| :out_of_stock
|
|
173
|
+
| :limited_availability
|
|
174
|
+
| :preorder
|
|
175
|
+
| :backorder
|
|
176
|
+
| :made_to_order
|
|
177
|
+
| :discontinued
|
|
178
|
+
|
|
179
|
+
module Availability
|
|
180
|
+
extend ContextDev::Internal::Type::Enum
|
|
181
|
+
|
|
182
|
+
IN_STOCK: :in_stock
|
|
183
|
+
OUT_OF_STOCK: :out_of_stock
|
|
184
|
+
LIMITED_AVAILABILITY: :limited_availability
|
|
185
|
+
PREORDER: :preorder
|
|
186
|
+
BACKORDER: :backorder
|
|
187
|
+
MADE_TO_ORDER: :made_to_order
|
|
188
|
+
DISCONTINUED: :discontinued
|
|
189
|
+
|
|
190
|
+
def self?.values: -> ::Array[ContextDev::Models::AIExtractProductResponse::Product::availability]
|
|
191
|
+
end
|
|
192
|
+
|
|
153
193
|
type billing_frequency = :monthly | :yearly | :one_time | :usage_based
|
|
154
194
|
|
|
155
195
|
module BillingFrequency
|