context.dev 2.20.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 +17 -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 +36 -30
- data/lib/context_dev/models/web_scrape_response.rb +114 -37
- 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 +15 -9
- 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 +55 -46
- data/rbi/context_dev/models/web_scrape_response.rbi +183 -69
- 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 +26 -17
- 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_response.rbs +81 -27
- data/sig/context_dev/models.rbs +2 -0
- data/sig/context_dev/resources/feedback.rbs +16 -0
- metadata +11 -2
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module ContextDev
|
|
4
|
+
module Models
|
|
5
|
+
class FeedbackSubmitResponse < ContextDev::Internal::Type::BaseModel
|
|
6
|
+
OrHash =
|
|
7
|
+
T.type_alias do
|
|
8
|
+
T.any(
|
|
9
|
+
ContextDev::Models::FeedbackSubmitResponse,
|
|
10
|
+
ContextDev::Internal::AnyHash
|
|
11
|
+
)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# True when feedback for this request_id was already recorded; the original
|
|
15
|
+
# feedback_id is returned.
|
|
16
|
+
sig { returns(T::Boolean) }
|
|
17
|
+
attr_accessor :already_submitted
|
|
18
|
+
|
|
19
|
+
# ID of the stored feedback.
|
|
20
|
+
sig { returns(String) }
|
|
21
|
+
attr_accessor :feedback_id
|
|
22
|
+
|
|
23
|
+
# Unique id of this API call, also sent in the X-Request-Id response header. Quote
|
|
24
|
+
# it when contacting support about a failed request.
|
|
25
|
+
sig { returns(String) }
|
|
26
|
+
attr_accessor :request_id
|
|
27
|
+
|
|
28
|
+
# Credit usage, included whenever a valid API key is provided.
|
|
29
|
+
sig do
|
|
30
|
+
returns(
|
|
31
|
+
T.nilable(ContextDev::Models::FeedbackSubmitResponse::KeyMetadata)
|
|
32
|
+
)
|
|
33
|
+
end
|
|
34
|
+
attr_reader :key_metadata
|
|
35
|
+
|
|
36
|
+
sig do
|
|
37
|
+
params(
|
|
38
|
+
key_metadata:
|
|
39
|
+
ContextDev::Models::FeedbackSubmitResponse::KeyMetadata::OrHash
|
|
40
|
+
).void
|
|
41
|
+
end
|
|
42
|
+
attr_writer :key_metadata
|
|
43
|
+
|
|
44
|
+
sig do
|
|
45
|
+
params(
|
|
46
|
+
already_submitted: T::Boolean,
|
|
47
|
+
feedback_id: String,
|
|
48
|
+
request_id: String,
|
|
49
|
+
key_metadata:
|
|
50
|
+
ContextDev::Models::FeedbackSubmitResponse::KeyMetadata::OrHash
|
|
51
|
+
).returns(T.attached_class)
|
|
52
|
+
end
|
|
53
|
+
def self.new(
|
|
54
|
+
# True when feedback for this request_id was already recorded; the original
|
|
55
|
+
# feedback_id is returned.
|
|
56
|
+
already_submitted:,
|
|
57
|
+
# ID of the stored feedback.
|
|
58
|
+
feedback_id:,
|
|
59
|
+
# Unique id of this API call, also sent in the X-Request-Id response header. Quote
|
|
60
|
+
# it when contacting support about a failed request.
|
|
61
|
+
request_id:,
|
|
62
|
+
# Credit usage, included whenever a valid API key is provided.
|
|
63
|
+
key_metadata: nil
|
|
64
|
+
)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
sig do
|
|
68
|
+
override.returns(
|
|
69
|
+
{
|
|
70
|
+
already_submitted: T::Boolean,
|
|
71
|
+
feedback_id: String,
|
|
72
|
+
request_id: String,
|
|
73
|
+
key_metadata:
|
|
74
|
+
ContextDev::Models::FeedbackSubmitResponse::KeyMetadata
|
|
75
|
+
}
|
|
76
|
+
)
|
|
77
|
+
end
|
|
78
|
+
def to_hash
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
class KeyMetadata < ContextDev::Internal::Type::BaseModel
|
|
82
|
+
OrHash =
|
|
83
|
+
T.type_alias do
|
|
84
|
+
T.any(
|
|
85
|
+
ContextDev::Models::FeedbackSubmitResponse::KeyMetadata,
|
|
86
|
+
ContextDev::Internal::AnyHash
|
|
87
|
+
)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Credits used by this request.
|
|
91
|
+
sig { returns(Integer) }
|
|
92
|
+
attr_accessor :credits_consumed
|
|
93
|
+
|
|
94
|
+
# Credits remaining for your organization.
|
|
95
|
+
sig { returns(Integer) }
|
|
96
|
+
attr_accessor :credits_remaining
|
|
97
|
+
|
|
98
|
+
# Credit usage, included whenever a valid API key is provided.
|
|
99
|
+
sig do
|
|
100
|
+
params(credits_consumed: Integer, credits_remaining: Integer).returns(
|
|
101
|
+
T.attached_class
|
|
102
|
+
)
|
|
103
|
+
end
|
|
104
|
+
def self.new(
|
|
105
|
+
# Credits used by this request.
|
|
106
|
+
credits_consumed:,
|
|
107
|
+
# Credits remaining for your organization.
|
|
108
|
+
credits_remaining:
|
|
109
|
+
)
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
sig do
|
|
113
|
+
override.returns(
|
|
114
|
+
{ credits_consumed: Integer, credits_remaining: Integer }
|
|
115
|
+
)
|
|
116
|
+
end
|
|
117
|
+
def to_hash
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
end
|
|
@@ -24,7 +24,9 @@ module ContextDev
|
|
|
24
24
|
sig { returns(T.nilable(String)) }
|
|
25
25
|
attr_accessor :cursor
|
|
26
26
|
|
|
27
|
-
# Optional result filters.
|
|
27
|
+
# Optional result filters. Use at most one of sourceDomain, sourceCountry,
|
|
28
|
+
# articleLanguage, or articleType. A date range may accompany that category;
|
|
29
|
+
# date.from must not exceed date.to.
|
|
28
30
|
sig { returns(T.nilable(ContextDev::NewsSearchParams::FilterBy)) }
|
|
29
31
|
attr_reader :filter_by
|
|
30
32
|
|
|
@@ -70,7 +72,9 @@ module ContextDev
|
|
|
70
72
|
search_by:,
|
|
71
73
|
# Opaque next_cursor from the previous response, or null for the first page.
|
|
72
74
|
cursor: nil,
|
|
73
|
-
# Optional result filters.
|
|
75
|
+
# Optional result filters. Use at most one of sourceDomain, sourceCountry,
|
|
76
|
+
# articleLanguage, or articleType. A date range may accompany that category;
|
|
77
|
+
# date.from must not exceed date.to.
|
|
74
78
|
filter_by: nil,
|
|
75
79
|
# Maximum results to return. Defaults to 10.
|
|
76
80
|
limit: nil,
|
|
@@ -812,7 +816,7 @@ module ContextDev
|
|
|
812
816
|
end
|
|
813
817
|
attr_writer :article_type
|
|
814
818
|
|
|
815
|
-
# Published-at window in epoch milliseconds.
|
|
819
|
+
# Published-at window in epoch milliseconds. from must be before or equal to to.
|
|
816
820
|
sig { returns(T.nilable(ContextDev::NewsSearchParams::FilterBy::Date)) }
|
|
817
821
|
attr_reader :date
|
|
818
822
|
|
|
@@ -852,7 +856,9 @@ module ContextDev
|
|
|
852
856
|
sig { params(source_domain: T::Array[String]).void }
|
|
853
857
|
attr_writer :source_domain
|
|
854
858
|
|
|
855
|
-
# Optional result filters.
|
|
859
|
+
# Optional result filters. Use at most one of sourceDomain, sourceCountry,
|
|
860
|
+
# articleLanguage, or articleType. A date range may accompany that category;
|
|
861
|
+
# date.from must not exceed date.to.
|
|
856
862
|
sig do
|
|
857
863
|
params(
|
|
858
864
|
article_language:
|
|
@@ -876,7 +882,7 @@ module ContextDev
|
|
|
876
882
|
article_language: nil,
|
|
877
883
|
# Article types to include. Up to 3.
|
|
878
884
|
article_type: nil,
|
|
879
|
-
# Published-at window in epoch milliseconds.
|
|
885
|
+
# Published-at window in epoch milliseconds. from must be before or equal to to.
|
|
880
886
|
date: nil,
|
|
881
887
|
# Publisher countries to include, as lowercase ISO 3166-1 alpha-2 codes. Up to 3.
|
|
882
888
|
source_country: nil,
|
|
@@ -1061,7 +1067,7 @@ module ContextDev
|
|
|
1061
1067
|
sig { params(to: Integer).void }
|
|
1062
1068
|
attr_writer :to
|
|
1063
1069
|
|
|
1064
|
-
# Published-at window in epoch milliseconds.
|
|
1070
|
+
# Published-at window in epoch milliseconds. from must be before or equal to to.
|
|
1065
1071
|
sig { params(from: Integer, to: Integer).returns(T.attached_class) }
|
|
1066
1072
|
def self.new(
|
|
1067
1073
|
# Inclusive start of the published-at window, in epoch milliseconds.
|
|
@@ -131,12 +131,16 @@ module ContextDev
|
|
|
131
131
|
attr_writer :tags
|
|
132
132
|
|
|
133
133
|
# Total deadline, including navigation, actions, waiting, and all outputs.
|
|
134
|
-
# Defaults to 60000 milliseconds with behavior fail.
|
|
135
|
-
#
|
|
136
|
-
#
|
|
137
|
-
#
|
|
138
|
-
#
|
|
139
|
-
# when
|
|
134
|
+
# Defaults to 60000 milliseconds with behavior fail. Individual outputs have
|
|
135
|
+
# internal deadlines that reserve time to return completed outputs; timed-out
|
|
136
|
+
# outputs have success: false and data: null under either behavior. The overall
|
|
137
|
+
# request deadline remains enforced: fail returns an error if that deadline is
|
|
138
|
+
# reached. Use return-partial to allow the current page state and available
|
|
139
|
+
# outputs when the page is still loading. Partial responses set isPartial. Failed
|
|
140
|
+
# retrievals and incomplete captures are not cached; valid captured pieces may be
|
|
141
|
+
# cached independently. Fixed waits must fit before a response reserve of up to
|
|
142
|
+
# 5000 milliseconds (at most one quarter of the timeout) when using
|
|
143
|
+
# return-partial.
|
|
140
144
|
sig { returns(T.nilable(ContextDev::WebScrapeParams::TimeoutOpts)) }
|
|
141
145
|
attr_reader :timeout_opts
|
|
142
146
|
|
|
@@ -148,8 +152,7 @@ module ContextDev
|
|
|
148
152
|
attr_writer :timeout_opts
|
|
149
153
|
|
|
150
154
|
# Zero data retention. Bypasses caches and uploads; excludes request/response
|
|
151
|
-
# content and tags from logs. Must be enabled for your organization.
|
|
152
|
-
# with the highlights output.
|
|
155
|
+
# content and tags from logs. Must be enabled for your organization.
|
|
153
156
|
sig { returns(T.nilable(ContextDev::WebScrapeParams::Zdr::OrSymbol)) }
|
|
154
157
|
attr_reader :zdr
|
|
155
158
|
|
|
@@ -207,16 +210,19 @@ module ContextDev
|
|
|
207
210
|
# Labels for tracking request usage. Not retained when zdr is enabled.
|
|
208
211
|
tags: nil,
|
|
209
212
|
# Total deadline, including navigation, actions, waiting, and all outputs.
|
|
210
|
-
# Defaults to 60000 milliseconds with behavior fail.
|
|
211
|
-
#
|
|
212
|
-
#
|
|
213
|
-
#
|
|
214
|
-
#
|
|
215
|
-
# when
|
|
213
|
+
# Defaults to 60000 milliseconds with behavior fail. Individual outputs have
|
|
214
|
+
# internal deadlines that reserve time to return completed outputs; timed-out
|
|
215
|
+
# outputs have success: false and data: null under either behavior. The overall
|
|
216
|
+
# request deadline remains enforced: fail returns an error if that deadline is
|
|
217
|
+
# reached. Use return-partial to allow the current page state and available
|
|
218
|
+
# outputs when the page is still loading. Partial responses set isPartial. Failed
|
|
219
|
+
# retrievals and incomplete captures are not cached; valid captured pieces may be
|
|
220
|
+
# cached independently. Fixed waits must fit before a response reserve of up to
|
|
221
|
+
# 5000 milliseconds (at most one quarter of the timeout) when using
|
|
222
|
+
# return-partial.
|
|
216
223
|
timeout_opts: nil,
|
|
217
224
|
# Zero data retention. Bypasses caches and uploads; excludes request/response
|
|
218
|
-
# content and tags from logs. Must be enabled for your organization.
|
|
219
|
-
# with the highlights output.
|
|
225
|
+
# content and tags from logs. Must be enabled for your organization.
|
|
220
226
|
zdr: nil,
|
|
221
227
|
request_options: {}
|
|
222
228
|
)
|
|
@@ -262,9 +268,9 @@ module ContextDev
|
|
|
262
268
|
sig { params(bytes: T::Boolean).void }
|
|
263
269
|
attr_writer :bytes
|
|
264
270
|
|
|
265
|
-
#
|
|
266
|
-
#
|
|
267
|
-
#
|
|
271
|
+
# Relevant Markdown excerpts for your question or topic, preserving code, lists,
|
|
272
|
+
# and tables, with headings included when needed for context. Adds 3 credits when
|
|
273
|
+
# passages are returned.
|
|
268
274
|
sig { returns(T.nilable(T::Boolean)) }
|
|
269
275
|
attr_reader :highlights
|
|
270
276
|
|
|
@@ -285,10 +291,8 @@ module ContextDev
|
|
|
285
291
|
sig { params(images: T::Boolean).void }
|
|
286
292
|
attr_writer :images
|
|
287
293
|
|
|
288
|
-
# Page data extracted
|
|
289
|
-
#
|
|
290
|
-
# Adds four credits when the page has text to extract; when shared content filters
|
|
291
|
-
# leave no text the result is an empty object and only the base price applies.
|
|
294
|
+
# Page data extracted using your schema. Adds 4 credits when extraction succeeds
|
|
295
|
+
# and its result is returned.
|
|
292
296
|
sig { returns(T.nilable(T::Boolean)) }
|
|
293
297
|
attr_reader :json
|
|
294
298
|
|
|
@@ -309,7 +313,8 @@ module ContextDev
|
|
|
309
313
|
sig { params(parse: T::Boolean).void }
|
|
310
314
|
attr_writer :parse
|
|
311
315
|
|
|
312
|
-
#
|
|
316
|
+
# Product details such as name, price, and availability. Adds 1 credit when its
|
|
317
|
+
# successful result is returned or the target page is missing.
|
|
313
318
|
sig { returns(T.nilable(T::Boolean)) }
|
|
314
319
|
attr_reader :product
|
|
315
320
|
|
|
@@ -340,24 +345,23 @@ module ContextDev
|
|
|
340
345
|
def self.new(
|
|
341
346
|
# The original HTTP response body.
|
|
342
347
|
bytes: nil,
|
|
343
|
-
#
|
|
344
|
-
#
|
|
345
|
-
#
|
|
348
|
+
# Relevant Markdown excerpts for your question or topic, preserving code, lists,
|
|
349
|
+
# and tables, with headings included when needed for context. Adds 3 credits when
|
|
350
|
+
# passages are returned.
|
|
346
351
|
highlights: nil,
|
|
347
352
|
# Rendered HTML.
|
|
348
353
|
html: nil,
|
|
349
354
|
# Images found on the page.
|
|
350
355
|
images: nil,
|
|
351
|
-
# Page data extracted
|
|
352
|
-
#
|
|
353
|
-
# Adds four credits when the page has text to extract; when shared content filters
|
|
354
|
-
# leave no text the result is an empty object and only the base price applies.
|
|
356
|
+
# Page data extracted using your schema. Adds 4 credits when extraction succeeds
|
|
357
|
+
# and its result is returned.
|
|
355
358
|
json: nil,
|
|
356
359
|
# Page content as Markdown.
|
|
357
360
|
markdown: nil,
|
|
358
361
|
# Fields selected by parseParams.rules.
|
|
359
362
|
parse: nil,
|
|
360
|
-
#
|
|
363
|
+
# Product details such as name, price, and availability. Adds 1 credit when its
|
|
364
|
+
# successful result is returned or the target page is missing.
|
|
361
365
|
product: nil,
|
|
362
366
|
# An inline image of the page.
|
|
363
367
|
screenshot: nil
|
|
@@ -993,9 +997,10 @@ module ContextDev
|
|
|
993
997
|
end
|
|
994
998
|
|
|
995
999
|
# Extract the product with a specialized model when the page has no structured
|
|
996
|
-
# product data. Adds six credits when the model
|
|
997
|
-
# fails,
|
|
998
|
-
# charge. Request deadlines and client
|
|
1000
|
+
# product data. Adds six credits when the model verdict is returned successfully.
|
|
1001
|
+
# If the fallback fails, the product output has success: false and data: null with
|
|
1002
|
+
# no fallback charge; other outputs remain available. Request deadlines and client
|
|
1003
|
+
# disconnects still apply.
|
|
999
1004
|
sig { returns(T.nilable(T::Boolean)) }
|
|
1000
1005
|
attr_reader :use_ai_fallback
|
|
1001
1006
|
|
|
@@ -1006,9 +1011,10 @@ module ContextDev
|
|
|
1006
1011
|
sig { params(use_ai_fallback: T::Boolean).returns(T.attached_class) }
|
|
1007
1012
|
def self.new(
|
|
1008
1013
|
# Extract the product with a specialized model when the page has no structured
|
|
1009
|
-
# product data. Adds six credits when the model
|
|
1010
|
-
# fails,
|
|
1011
|
-
# charge. Request deadlines and client
|
|
1014
|
+
# product data. Adds six credits when the model verdict is returned successfully.
|
|
1015
|
+
# If the fallback fails, the product output has success: false and data: null with
|
|
1016
|
+
# no fallback charge; other outputs remain available. Request deadlines and client
|
|
1017
|
+
# disconnects still apply.
|
|
1012
1018
|
use_ai_fallback: nil
|
|
1013
1019
|
)
|
|
1014
1020
|
end
|
|
@@ -2119,12 +2125,16 @@ module ContextDev
|
|
|
2119
2125
|
attr_writer :behavior
|
|
2120
2126
|
|
|
2121
2127
|
# Total deadline, including navigation, actions, waiting, and all outputs.
|
|
2122
|
-
# Defaults to 60000 milliseconds with behavior fail.
|
|
2123
|
-
#
|
|
2124
|
-
#
|
|
2125
|
-
#
|
|
2126
|
-
#
|
|
2127
|
-
# when
|
|
2128
|
+
# Defaults to 60000 milliseconds with behavior fail. Individual outputs have
|
|
2129
|
+
# internal deadlines that reserve time to return completed outputs; timed-out
|
|
2130
|
+
# outputs have success: false and data: null under either behavior. The overall
|
|
2131
|
+
# request deadline remains enforced: fail returns an error if that deadline is
|
|
2132
|
+
# reached. Use return-partial to allow the current page state and available
|
|
2133
|
+
# outputs when the page is still loading. Partial responses set isPartial. Failed
|
|
2134
|
+
# retrievals and incomplete captures are not cached; valid captured pieces may be
|
|
2135
|
+
# cached independently. Fixed waits must fit before a response reserve of up to
|
|
2136
|
+
# 5000 milliseconds (at most one quarter of the timeout) when using
|
|
2137
|
+
# return-partial.
|
|
2128
2138
|
sig do
|
|
2129
2139
|
params(
|
|
2130
2140
|
milliseconds: Integer,
|
|
@@ -2194,8 +2204,7 @@ module ContextDev
|
|
|
2194
2204
|
end
|
|
2195
2205
|
|
|
2196
2206
|
# Zero data retention. Bypasses caches and uploads; excludes request/response
|
|
2197
|
-
# content and tags from logs. Must be enabled for your organization.
|
|
2198
|
-
# with the highlights output.
|
|
2207
|
+
# content and tags from logs. Must be enabled for your organization.
|
|
2199
2208
|
module Zdr
|
|
2200
2209
|
extend ContextDev::Internal::Type::Enum
|
|
2201
2210
|
|