context.dev 2.4.0 → 2.5.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.
Files changed (133) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/README.md +1 -1
  4. data/lib/context_dev/models/ai_extract_product_params.rb +9 -1
  5. data/lib/context_dev/models/ai_extract_products_params.rb +18 -2
  6. data/lib/context_dev/models/brand_retrieve_params.rb +109 -22
  7. data/lib/context_dev/models/brand_retrieve_response.rb +4 -6
  8. data/lib/context_dev/models/brand_retrieve_simplified_params.rb +32 -3
  9. data/lib/context_dev/models/industry_retrieve_naics_params.rb +11 -1
  10. data/lib/context_dev/models/industry_retrieve_sic_params.rb +11 -1
  11. data/lib/context_dev/models/monitor_create_params.rb +6 -5
  12. data/lib/context_dev/models/monitor_create_response.rb +6 -5
  13. data/lib/context_dev/models/monitor_get_credit_usage_params.rb +30 -0
  14. data/lib/context_dev/models/monitor_get_credit_usage_response.rb +59 -0
  15. data/lib/context_dev/models/monitor_get_limits_params.rb +14 -0
  16. data/lib/context_dev/models/monitor_get_limits_response.rb +52 -0
  17. data/lib/context_dev/models/monitor_list_account_changes_params.rb +16 -7
  18. data/lib/context_dev/models/monitor_list_account_changes_response.rb +2 -1
  19. data/lib/context_dev/models/monitor_list_account_runs_params.rb +7 -10
  20. data/lib/context_dev/models/monitor_list_changes_params.rb +8 -4
  21. data/lib/context_dev/models/monitor_list_changes_response.rb +2 -1
  22. data/lib/context_dev/models/monitor_list_params.rb +18 -19
  23. data/lib/context_dev/models/monitor_list_response.rb +6 -5
  24. data/lib/context_dev/models/monitor_list_runs_params.rb +7 -10
  25. data/lib/context_dev/models/monitor_retrieve_change_response.rb +2 -1
  26. data/lib/context_dev/models/monitor_retrieve_response.rb +6 -5
  27. data/lib/context_dev/models/monitor_update_params.rb +6 -5
  28. data/lib/context_dev/models/monitor_update_response.rb +6 -5
  29. data/lib/context_dev/models/parse_handle_params.rb +199 -33
  30. data/lib/context_dev/models/utility_prefetch_params.rb +9 -1
  31. data/lib/context_dev/models/web_extract_competitors_params.rb +11 -1
  32. data/lib/context_dev/models/web_extract_fonts_params.rb +14 -4
  33. data/lib/context_dev/models/web_extract_params.rb +19 -1
  34. data/lib/context_dev/models/web_extract_styleguide_params.rb +14 -4
  35. data/lib/context_dev/models/web_screenshot_params.rb +69 -18
  36. data/lib/context_dev/models/web_screenshot_response.rb +3 -2
  37. data/lib/context_dev/models/web_search_params.rb +9 -1
  38. data/lib/context_dev/models/web_web_crawl_md_params.rb +34 -1
  39. data/lib/context_dev/models/web_web_scrape_html_params.rb +268 -29
  40. data/lib/context_dev/models/web_web_scrape_images_params.rb +208 -19
  41. data/lib/context_dev/models/web_web_scrape_md_params.rb +352 -38
  42. data/lib/context_dev/models/web_web_scrape_sitemap_params.rb +45 -1
  43. data/lib/context_dev/models.rb +4 -0
  44. data/lib/context_dev/resources/ai.rb +3 -1
  45. data/lib/context_dev/resources/brand.rb +6 -2
  46. data/lib/context_dev/resources/industry.rb +6 -2
  47. data/lib/context_dev/resources/monitors.rb +70 -32
  48. data/lib/context_dev/resources/parse.rb +15 -11
  49. data/lib/context_dev/resources/utility.rb +3 -1
  50. data/lib/context_dev/resources/web.rb +104 -55
  51. data/lib/context_dev/version.rb +1 -1
  52. data/lib/context_dev.rb +4 -0
  53. data/rbi/context_dev/models/ai_extract_product_params.rbi +11 -0
  54. data/rbi/context_dev/models/ai_extract_products_params.rbi +22 -0
  55. data/rbi/context_dev/models/brand_retrieve_params.rbi +175 -64
  56. data/rbi/context_dev/models/brand_retrieve_response.rbi +8 -11
  57. data/rbi/context_dev/models/brand_retrieve_simplified_params.rbi +68 -5
  58. data/rbi/context_dev/models/industry_retrieve_naics_params.rbi +15 -0
  59. data/rbi/context_dev/models/industry_retrieve_sic_params.rbi +15 -0
  60. data/rbi/context_dev/models/monitor_create_params.rbi +6 -4
  61. data/rbi/context_dev/models/monitor_create_response.rbi +6 -4
  62. data/rbi/context_dev/models/monitor_get_credit_usage_params.rbi +60 -0
  63. data/rbi/context_dev/models/monitor_get_credit_usage_response.rbi +111 -0
  64. data/rbi/context_dev/models/monitor_get_limits_params.rbi +30 -0
  65. data/rbi/context_dev/models/monitor_get_limits_response.rbi +105 -0
  66. data/rbi/context_dev/models/monitor_list_account_changes_params.rbi +16 -0
  67. data/rbi/context_dev/models/monitor_list_account_changes_response.rbi +2 -0
  68. data/rbi/context_dev/models/monitor_list_account_runs_params.rbi +7 -6
  69. data/rbi/context_dev/models/monitor_list_changes_params.rbi +8 -0
  70. data/rbi/context_dev/models/monitor_list_changes_response.rbi +2 -0
  71. data/rbi/context_dev/models/monitor_list_params.rbi +23 -31
  72. data/rbi/context_dev/models/monitor_list_response.rbi +6 -4
  73. data/rbi/context_dev/models/monitor_list_runs_params.rbi +7 -6
  74. data/rbi/context_dev/models/monitor_retrieve_change_response.rbi +2 -0
  75. data/rbi/context_dev/models/monitor_retrieve_response.rbi +6 -4
  76. data/rbi/context_dev/models/monitor_update_params.rbi +6 -4
  77. data/rbi/context_dev/models/monitor_update_response.rbi +6 -4
  78. data/rbi/context_dev/models/parse_handle_params.rbi +400 -46
  79. data/rbi/context_dev/models/utility_prefetch_params.rbi +11 -0
  80. data/rbi/context_dev/models/web_extract_competitors_params.rbi +15 -0
  81. data/rbi/context_dev/models/web_extract_fonts_params.rbi +19 -7
  82. data/rbi/context_dev/models/web_extract_params.rbi +26 -0
  83. data/rbi/context_dev/models/web_extract_styleguide_params.rbi +19 -7
  84. data/rbi/context_dev/models/web_screenshot_params.rbi +108 -37
  85. data/rbi/context_dev/models/web_screenshot_response.rbi +4 -2
  86. data/rbi/context_dev/models/web_search_params.rbi +11 -0
  87. data/rbi/context_dev/models/web_web_crawl_md_params.rbi +53 -0
  88. data/rbi/context_dev/models/web_web_scrape_html_params.rbi +554 -49
  89. data/rbi/context_dev/models/web_web_scrape_images_params.rbi +426 -30
  90. data/rbi/context_dev/models/web_web_scrape_md_params.rbi +742 -61
  91. data/rbi/context_dev/models/web_web_scrape_sitemap_params.rbi +82 -0
  92. data/rbi/context_dev/models.rbi +4 -0
  93. data/rbi/context_dev/resources/ai.rbi +3 -0
  94. data/rbi/context_dev/resources/brand.rbi +9 -1
  95. data/rbi/context_dev/resources/industry.rbi +10 -0
  96. data/rbi/context_dev/resources/monitors.rbi +55 -11
  97. data/rbi/context_dev/resources/parse.rbi +46 -19
  98. data/rbi/context_dev/resources/utility.rbi +3 -0
  99. data/rbi/context_dev/resources/web.rbi +224 -48
  100. data/sig/context_dev/models/ai_extract_product_params.rbs +12 -1
  101. data/sig/context_dev/models/ai_extract_products_params.rbs +14 -0
  102. data/sig/context_dev/models/brand_retrieve_params.rbs +97 -51
  103. data/sig/context_dev/models/brand_retrieve_response.rbs +2 -2
  104. data/sig/context_dev/models/brand_retrieve_simplified_params.rbs +34 -5
  105. data/sig/context_dev/models/industry_retrieve_naics_params.rbs +7 -0
  106. data/sig/context_dev/models/industry_retrieve_sic_params.rbs +7 -0
  107. data/sig/context_dev/models/monitor_get_credit_usage_params.rbs +32 -0
  108. data/sig/context_dev/models/monitor_get_credit_usage_response.rbs +52 -0
  109. data/sig/context_dev/models/monitor_get_limits_params.rbs +15 -0
  110. data/sig/context_dev/models/monitor_get_limits_response.rbs +43 -0
  111. data/sig/context_dev/models/monitor_list_params.rbs +8 -14
  112. data/sig/context_dev/models/parse_handle_params.rbs +124 -25
  113. data/sig/context_dev/models/utility_prefetch_params.rbs +7 -0
  114. data/sig/context_dev/models/web_extract_competitors_params.rbs +12 -1
  115. data/sig/context_dev/models/web_extract_fonts_params.rbs +10 -5
  116. data/sig/context_dev/models/web_extract_params.rbs +14 -0
  117. data/sig/context_dev/models/web_extract_styleguide_params.rbs +10 -5
  118. data/sig/context_dev/models/web_screenshot_params.rbs +41 -20
  119. data/sig/context_dev/models/web_search_params.rbs +7 -0
  120. data/sig/context_dev/models/web_web_crawl_md_params.rbs +28 -1
  121. data/sig/context_dev/models/web_web_scrape_html_params.rbs +175 -47
  122. data/sig/context_dev/models/web_web_scrape_images_params.rbs +128 -38
  123. data/sig/context_dev/models/web_web_scrape_md_params.rbs +229 -62
  124. data/sig/context_dev/models/web_web_scrape_sitemap_params.rbs +35 -1
  125. data/sig/context_dev/models.rbs +4 -0
  126. data/sig/context_dev/resources/ai.rbs +1 -0
  127. data/sig/context_dev/resources/brand.rbs +3 -1
  128. data/sig/context_dev/resources/industry.rbs +2 -0
  129. data/sig/context_dev/resources/monitors.rbs +12 -2
  130. data/sig/context_dev/resources/parse.rbs +8 -5
  131. data/sig/context_dev/resources/utility.rbs +1 -0
  132. data/sig/context_dev/resources/web.rbs +47 -26
  133. metadata +14 -2
@@ -14,8 +14,15 @@ module ContextDev
14
14
  sig { returns(ContextDev::Internal::FileInput) }
15
15
  attr_accessor :body
16
16
 
17
- # Optional file extension hint. Case-insensitive; a leading dot is accepted (e.g.
18
- # ".pdf").
17
+ # Optional client identifier used for usage attribution.
18
+ sig { returns(T.nilable(String)) }
19
+ attr_reader :client
20
+
21
+ sig { params(client: String).void }
22
+ attr_writer :client
23
+
24
+ # Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv,
25
+ # md, py, rtf, jpg, png, or txt.
19
26
  sig do
20
27
  returns(T.nilable(ContextDev::ParseHandleParams::Extension::OrSymbol))
21
28
  end
@@ -29,34 +36,74 @@ module ContextDev
29
36
  attr_writer :extension
30
37
 
31
38
  # Include image references in Markdown output
32
- sig { returns(T.nilable(T::Boolean)) }
39
+ sig do
40
+ returns(
41
+ T.nilable(
42
+ T.any(
43
+ T::Boolean,
44
+ ContextDev::ParseHandleParams::IncludeImages::OrSymbol
45
+ )
46
+ )
47
+ )
48
+ end
33
49
  attr_reader :include_images
34
50
 
35
- sig { params(include_images: T::Boolean).void }
51
+ sig do
52
+ params(
53
+ include_images:
54
+ T.any(
55
+ T::Boolean,
56
+ ContextDev::ParseHandleParams::IncludeImages::OrSymbol
57
+ )
58
+ ).void
59
+ end
36
60
  attr_writer :include_images
37
61
 
38
62
  # Preserve hyperlinks in Markdown output
39
- sig { returns(T.nilable(T::Boolean)) }
63
+ sig do
64
+ returns(
65
+ T.nilable(
66
+ T.any(
67
+ T::Boolean,
68
+ ContextDev::ParseHandleParams::IncludeLinks::OrSymbol
69
+ )
70
+ )
71
+ )
72
+ end
40
73
  attr_reader :include_links
41
74
 
42
- sig { params(include_links: T::Boolean).void }
75
+ sig do
76
+ params(
77
+ include_links:
78
+ T.any(
79
+ T::Boolean,
80
+ ContextDev::ParseHandleParams::IncludeLinks::OrSymbol
81
+ )
82
+ ).void
83
+ end
43
84
  attr_writer :include_links
44
85
 
45
- # Gates all OCR. When true, PDFs get embedded-image OCR (recognized text inserted
46
- # at each image's position in page reading order, preserving the text layer;
47
- # pdf.start/pdf.end limit the page range), scanned PDFs with no text layer get
48
- # full-document OCR, and raster images get their visible text transcribed. When
49
- # false, no OCR runs: scanned PDFs may yield no content and images return only
50
- # format/dimension metadata. Calls where OCR actually runs cost 5 credits instead
51
- # of 1.
52
- sig { returns(T.nilable(T::Boolean)) }
86
+ # When true for PDF inputs, detect and OCR images embedded in the selected pages,
87
+ # inserting recognized text at each image's position in page reading order while
88
+ # preserving the PDF text layer. pdf.start/pdf.end limit the inclusive page range.
89
+ # When false, all OCR is disabled, including the automatic scanned-PDF fallback.
90
+ sig do
91
+ returns(
92
+ T.nilable(
93
+ T.any(T::Boolean, ContextDev::ParseHandleParams::Ocr::OrSymbol)
94
+ )
95
+ )
96
+ end
53
97
  attr_reader :ocr
54
98
 
55
- sig { params(ocr: T::Boolean).void }
99
+ sig do
100
+ params(
101
+ ocr: T.any(T::Boolean, ContextDev::ParseHandleParams::Ocr::OrSymbol)
102
+ ).void
103
+ end
56
104
  attr_writer :ocr
57
105
 
58
- # PDF page-range controls. Use start/end to limit parsing (and OCR when ocr=true)
59
- # to an inclusive 1-based page range.
106
+ # PDF page-range options as a JSON object, e.g. {"start": 2, "end": 5}.
60
107
  sig { returns(T.nilable(ContextDev::ParseHandleParams::Pdf)) }
61
108
  attr_reader :pdf
62
109
 
@@ -64,56 +111,135 @@ module ContextDev
64
111
  attr_writer :pdf
65
112
 
66
113
  # Shorten base64-encoded image data in the Markdown output
67
- sig { returns(T.nilable(T::Boolean)) }
114
+ sig do
115
+ returns(
116
+ T.nilable(
117
+ T.any(
118
+ T::Boolean,
119
+ ContextDev::ParseHandleParams::ShortenBase64Images::OrSymbol
120
+ )
121
+ )
122
+ )
123
+ end
68
124
  attr_reader :shorten_base64_images
69
125
 
70
- sig { params(shorten_base64_images: T::Boolean).void }
126
+ sig do
127
+ params(
128
+ shorten_base64_images:
129
+ T.any(
130
+ T::Boolean,
131
+ ContextDev::ParseHandleParams::ShortenBase64Images::OrSymbol
132
+ )
133
+ ).void
134
+ end
71
135
  attr_writer :shorten_base64_images
72
136
 
137
+ # Optional comma-separated caller-defined tags for tracking this request. Tags are
138
+ # recorded on the request's usage log and can be used to filter usage on the
139
+ # dashboard usage page. Up to 20 tags, each 1-50 characters.
140
+ sig { returns(T.nilable(T::Array[String])) }
141
+ attr_reader :tags
142
+
143
+ sig { params(tags: T::Array[String]).void }
144
+ attr_writer :tags
145
+
73
146
  # Extract only the main content from HTML-like inputs
74
- sig { returns(T.nilable(T::Boolean)) }
147
+ sig do
148
+ returns(
149
+ T.nilable(
150
+ T.any(
151
+ T::Boolean,
152
+ ContextDev::ParseHandleParams::UseMainContentOnly::OrSymbol
153
+ )
154
+ )
155
+ )
156
+ end
75
157
  attr_reader :use_main_content_only
76
158
 
77
- sig { params(use_main_content_only: T::Boolean).void }
159
+ sig do
160
+ params(
161
+ use_main_content_only:
162
+ T.any(
163
+ T::Boolean,
164
+ ContextDev::ParseHandleParams::UseMainContentOnly::OrSymbol
165
+ )
166
+ ).void
167
+ end
78
168
  attr_writer :use_main_content_only
79
169
 
170
+ # Set to enabled to bypass shared caches and omit request and response content
171
+ # from retained usage logs. Requires zero data retention to be enabled for your
172
+ # organization (contact support@context.dev), otherwise the request fails with
173
+ # ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.
174
+ sig { returns(T.nilable(ContextDev::ParseHandleParams::Zdr::OrSymbol)) }
175
+ attr_reader :zdr
176
+
177
+ sig { params(zdr: ContextDev::ParseHandleParams::Zdr::OrSymbol).void }
178
+ attr_writer :zdr
179
+
80
180
  sig do
81
181
  params(
82
182
  body: ContextDev::Internal::FileInput,
183
+ client: String,
83
184
  extension: ContextDev::ParseHandleParams::Extension::OrSymbol,
84
- include_images: T::Boolean,
85
- include_links: T::Boolean,
86
- ocr: T::Boolean,
185
+ include_images:
186
+ T.any(
187
+ T::Boolean,
188
+ ContextDev::ParseHandleParams::IncludeImages::OrSymbol
189
+ ),
190
+ include_links:
191
+ T.any(
192
+ T::Boolean,
193
+ ContextDev::ParseHandleParams::IncludeLinks::OrSymbol
194
+ ),
195
+ ocr: T.any(T::Boolean, ContextDev::ParseHandleParams::Ocr::OrSymbol),
87
196
  pdf: ContextDev::ParseHandleParams::Pdf::OrHash,
88
- shorten_base64_images: T::Boolean,
89
- use_main_content_only: T::Boolean,
197
+ shorten_base64_images:
198
+ T.any(
199
+ T::Boolean,
200
+ ContextDev::ParseHandleParams::ShortenBase64Images::OrSymbol
201
+ ),
202
+ tags: T::Array[String],
203
+ use_main_content_only:
204
+ T.any(
205
+ T::Boolean,
206
+ ContextDev::ParseHandleParams::UseMainContentOnly::OrSymbol
207
+ ),
208
+ zdr: ContextDev::ParseHandleParams::Zdr::OrSymbol,
90
209
  request_options: ContextDev::RequestOptions::OrHash
91
210
  ).returns(T.attached_class)
92
211
  end
93
212
  def self.new(
94
213
  body:,
95
- # Optional file extension hint. Case-insensitive; a leading dot is accepted (e.g.
96
- # ".pdf").
214
+ # Optional client identifier used for usage attribution.
215
+ client: nil,
216
+ # Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv,
217
+ # md, py, rtf, jpg, png, or txt.
97
218
  extension: nil,
98
219
  # Include image references in Markdown output
99
220
  include_images: nil,
100
221
  # Preserve hyperlinks in Markdown output
101
222
  include_links: nil,
102
- # Gates all OCR. When true, PDFs get embedded-image OCR (recognized text inserted
103
- # at each image's position in page reading order, preserving the text layer;
104
- # pdf.start/pdf.end limit the page range), scanned PDFs with no text layer get
105
- # full-document OCR, and raster images get their visible text transcribed. When
106
- # false, no OCR runs: scanned PDFs may yield no content and images return only
107
- # format/dimension metadata. Calls where OCR actually runs cost 5 credits instead
108
- # of 1.
223
+ # When true for PDF inputs, detect and OCR images embedded in the selected pages,
224
+ # inserting recognized text at each image's position in page reading order while
225
+ # preserving the PDF text layer. pdf.start/pdf.end limit the inclusive page range.
226
+ # When false, all OCR is disabled, including the automatic scanned-PDF fallback.
109
227
  ocr: nil,
110
- # PDF page-range controls. Use start/end to limit parsing (and OCR when ocr=true)
111
- # to an inclusive 1-based page range.
228
+ # PDF page-range options as a JSON object, e.g. {"start": 2, "end": 5}.
112
229
  pdf: nil,
113
230
  # Shorten base64-encoded image data in the Markdown output
114
231
  shorten_base64_images: nil,
232
+ # Optional comma-separated caller-defined tags for tracking this request. Tags are
233
+ # recorded on the request's usage log and can be used to filter usage on the
234
+ # dashboard usage page. Up to 20 tags, each 1-50 characters.
235
+ tags: nil,
115
236
  # Extract only the main content from HTML-like inputs
116
237
  use_main_content_only: nil,
238
+ # Set to enabled to bypass shared caches and omit request and response content
239
+ # from retained usage logs. Requires zero data retention to be enabled for your
240
+ # organization (contact support@context.dev), otherwise the request fails with
241
+ # ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.
242
+ zdr: nil,
117
243
  request_options: {}
118
244
  )
119
245
  end
@@ -122,13 +248,33 @@ module ContextDev
122
248
  override.returns(
123
249
  {
124
250
  body: ContextDev::Internal::FileInput,
251
+ client: String,
125
252
  extension: ContextDev::ParseHandleParams::Extension::OrSymbol,
126
- include_images: T::Boolean,
127
- include_links: T::Boolean,
128
- ocr: T::Boolean,
253
+ include_images:
254
+ T.any(
255
+ T::Boolean,
256
+ ContextDev::ParseHandleParams::IncludeImages::OrSymbol
257
+ ),
258
+ include_links:
259
+ T.any(
260
+ T::Boolean,
261
+ ContextDev::ParseHandleParams::IncludeLinks::OrSymbol
262
+ ),
263
+ ocr:
264
+ T.any(T::Boolean, ContextDev::ParseHandleParams::Ocr::OrSymbol),
129
265
  pdf: ContextDev::ParseHandleParams::Pdf,
130
- shorten_base64_images: T::Boolean,
131
- use_main_content_only: T::Boolean,
266
+ shorten_base64_images:
267
+ T.any(
268
+ T::Boolean,
269
+ ContextDev::ParseHandleParams::ShortenBase64Images::OrSymbol
270
+ ),
271
+ tags: T::Array[String],
272
+ use_main_content_only:
273
+ T.any(
274
+ T::Boolean,
275
+ ContextDev::ParseHandleParams::UseMainContentOnly::OrSymbol
276
+ ),
277
+ zdr: ContextDev::ParseHandleParams::Zdr::OrSymbol,
132
278
  request_options: ContextDev::RequestOptions
133
279
  }
134
280
  )
@@ -136,8 +282,8 @@ module ContextDev
136
282
  def to_hash
137
283
  end
138
284
 
139
- # Optional file extension hint. Case-insensitive; a leading dot is accepted (e.g.
140
- # ".pdf").
285
+ # Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv,
286
+ # md, py, rtf, jpg, png, or txt.
141
287
  module Extension
142
288
  extend ContextDev::Internal::Type::Enum
143
289
 
@@ -294,6 +440,110 @@ module ContextDev
294
440
  end
295
441
  end
296
442
 
443
+ # Include image references in Markdown output
444
+ module IncludeImages
445
+ extend ContextDev::Internal::Type::Union
446
+
447
+ Variants =
448
+ T.type_alias do
449
+ T.any(
450
+ T::Boolean,
451
+ ContextDev::ParseHandleParams::IncludeImages::TaggedSymbol
452
+ )
453
+ end
454
+
455
+ sig do
456
+ override.returns(
457
+ T::Array[ContextDev::ParseHandleParams::IncludeImages::Variants]
458
+ )
459
+ end
460
+ def self.variants
461
+ end
462
+
463
+ TaggedSymbol =
464
+ T.type_alias do
465
+ T.all(Symbol, ContextDev::ParseHandleParams::IncludeImages)
466
+ end
467
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
468
+
469
+ TRUE =
470
+ T.let(
471
+ :true,
472
+ ContextDev::ParseHandleParams::IncludeImages::TaggedSymbol
473
+ )
474
+ FALSE =
475
+ T.let(
476
+ :false,
477
+ ContextDev::ParseHandleParams::IncludeImages::TaggedSymbol
478
+ )
479
+ end
480
+
481
+ # Preserve hyperlinks in Markdown output
482
+ module IncludeLinks
483
+ extend ContextDev::Internal::Type::Union
484
+
485
+ Variants =
486
+ T.type_alias do
487
+ T.any(
488
+ T::Boolean,
489
+ ContextDev::ParseHandleParams::IncludeLinks::TaggedSymbol
490
+ )
491
+ end
492
+
493
+ sig do
494
+ override.returns(
495
+ T::Array[ContextDev::ParseHandleParams::IncludeLinks::Variants]
496
+ )
497
+ end
498
+ def self.variants
499
+ end
500
+
501
+ TaggedSymbol =
502
+ T.type_alias do
503
+ T.all(Symbol, ContextDev::ParseHandleParams::IncludeLinks)
504
+ end
505
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
506
+
507
+ TRUE =
508
+ T.let(
509
+ :true,
510
+ ContextDev::ParseHandleParams::IncludeLinks::TaggedSymbol
511
+ )
512
+ FALSE =
513
+ T.let(
514
+ :false,
515
+ ContextDev::ParseHandleParams::IncludeLinks::TaggedSymbol
516
+ )
517
+ end
518
+
519
+ # When true for PDF inputs, detect and OCR images embedded in the selected pages,
520
+ # inserting recognized text at each image's position in page reading order while
521
+ # preserving the PDF text layer. pdf.start/pdf.end limit the inclusive page range.
522
+ # When false, all OCR is disabled, including the automatic scanned-PDF fallback.
523
+ module Ocr
524
+ extend ContextDev::Internal::Type::Union
525
+
526
+ Variants =
527
+ T.type_alias do
528
+ T.any(T::Boolean, ContextDev::ParseHandleParams::Ocr::TaggedSymbol)
529
+ end
530
+
531
+ sig do
532
+ override.returns(
533
+ T::Array[ContextDev::ParseHandleParams::Ocr::Variants]
534
+ )
535
+ end
536
+ def self.variants
537
+ end
538
+
539
+ TaggedSymbol =
540
+ T.type_alias { T.all(Symbol, ContextDev::ParseHandleParams::Ocr) }
541
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
542
+
543
+ TRUE = T.let(:true, ContextDev::ParseHandleParams::Ocr::TaggedSymbol)
544
+ FALSE = T.let(:false, ContextDev::ParseHandleParams::Ocr::TaggedSymbol)
545
+ end
546
+
297
547
  class Pdf < ContextDev::Internal::Type::BaseModel
298
548
  OrHash =
299
549
  T.type_alias do
@@ -318,8 +568,7 @@ module ContextDev
318
568
  sig { params(start: Integer).void }
319
569
  attr_writer :start
320
570
 
321
- # PDF page-range controls. Use start/end to limit parsing (and OCR when ocr=true)
322
- # to an inclusive 1-based page range.
571
+ # PDF page-range options as a JSON object, e.g. {"start": 2, "end": 5}.
323
572
  sig { params(end_: Integer, start: Integer).returns(T.attached_class) }
324
573
  def self.new(
325
574
  # Last 1-based PDF page to parse. When omitted, parsing ends at the last page.
@@ -334,6 +583,111 @@ module ContextDev
334
583
  def to_hash
335
584
  end
336
585
  end
586
+
587
+ # Shorten base64-encoded image data in the Markdown output
588
+ module ShortenBase64Images
589
+ extend ContextDev::Internal::Type::Union
590
+
591
+ Variants =
592
+ T.type_alias do
593
+ T.any(
594
+ T::Boolean,
595
+ ContextDev::ParseHandleParams::ShortenBase64Images::TaggedSymbol
596
+ )
597
+ end
598
+
599
+ sig do
600
+ override.returns(
601
+ T::Array[
602
+ ContextDev::ParseHandleParams::ShortenBase64Images::Variants
603
+ ]
604
+ )
605
+ end
606
+ def self.variants
607
+ end
608
+
609
+ TaggedSymbol =
610
+ T.type_alias do
611
+ T.all(Symbol, ContextDev::ParseHandleParams::ShortenBase64Images)
612
+ end
613
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
614
+
615
+ TRUE =
616
+ T.let(
617
+ :true,
618
+ ContextDev::ParseHandleParams::ShortenBase64Images::TaggedSymbol
619
+ )
620
+ FALSE =
621
+ T.let(
622
+ :false,
623
+ ContextDev::ParseHandleParams::ShortenBase64Images::TaggedSymbol
624
+ )
625
+ end
626
+
627
+ # Extract only the main content from HTML-like inputs
628
+ module UseMainContentOnly
629
+ extend ContextDev::Internal::Type::Union
630
+
631
+ Variants =
632
+ T.type_alias do
633
+ T.any(
634
+ T::Boolean,
635
+ ContextDev::ParseHandleParams::UseMainContentOnly::TaggedSymbol
636
+ )
637
+ end
638
+
639
+ sig do
640
+ override.returns(
641
+ T::Array[
642
+ ContextDev::ParseHandleParams::UseMainContentOnly::Variants
643
+ ]
644
+ )
645
+ end
646
+ def self.variants
647
+ end
648
+
649
+ TaggedSymbol =
650
+ T.type_alias do
651
+ T.all(Symbol, ContextDev::ParseHandleParams::UseMainContentOnly)
652
+ end
653
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
654
+
655
+ TRUE =
656
+ T.let(
657
+ :true,
658
+ ContextDev::ParseHandleParams::UseMainContentOnly::TaggedSymbol
659
+ )
660
+ FALSE =
661
+ T.let(
662
+ :false,
663
+ ContextDev::ParseHandleParams::UseMainContentOnly::TaggedSymbol
664
+ )
665
+ end
666
+
667
+ # Set to enabled to bypass shared caches and omit request and response content
668
+ # from retained usage logs. Requires zero data retention to be enabled for your
669
+ # organization (contact support@context.dev), otherwise the request fails with
670
+ # ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.
671
+ module Zdr
672
+ extend ContextDev::Internal::Type::Enum
673
+
674
+ TaggedSymbol =
675
+ T.type_alias { T.all(Symbol, ContextDev::ParseHandleParams::Zdr) }
676
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
677
+
678
+ ENABLED =
679
+ T.let(:enabled, ContextDev::ParseHandleParams::Zdr::TaggedSymbol)
680
+ DISABLED =
681
+ T.let(:disabled, ContextDev::ParseHandleParams::Zdr::TaggedSymbol)
682
+
683
+ sig do
684
+ override.returns(
685
+ T::Array[ContextDev::ParseHandleParams::Zdr::TaggedSymbol]
686
+ )
687
+ end
688
+ def self.values
689
+ end
690
+ end
337
691
  end
338
692
  end
339
693
  end
@@ -29,6 +29,13 @@ module ContextDev
29
29
  sig { returns(ContextDev::UtilityPrefetchParams::Type::OrSymbol) }
30
30
  attr_accessor :type
31
31
 
32
+ # Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
33
+ sig { returns(T.nilable(T::Array[String])) }
34
+ attr_reader :tags
35
+
36
+ sig { params(tags: T::Array[String]).void }
37
+ attr_writer :tags
38
+
32
39
  # Optional timeout in milliseconds for the request. If the request takes longer
33
40
  # than this value, it will be aborted with a 408 status code. Maximum allowed
34
41
  # value is 300000ms (5 minutes).
@@ -46,6 +53,7 @@ module ContextDev
46
53
  ContextDev::UtilityPrefetchParams::Identifier::UtilityPrefetchEmailIdentifier::OrHash
47
54
  ),
48
55
  type: ContextDev::UtilityPrefetchParams::Type::OrSymbol,
56
+ tags: T::Array[String],
49
57
  timeout_ms: Integer,
50
58
  request_options: ContextDev::RequestOptions::OrHash
51
59
  ).returns(T.attached_class)
@@ -55,6 +63,8 @@ module ContextDev
55
63
  identifier:,
56
64
  # What to prefetch. Currently only 'brand' is supported.
57
65
  type:,
66
+ # Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
67
+ tags: nil,
58
68
  # Optional timeout in milliseconds for the request. If the request takes longer
59
69
  # than this value, it will be aborted with a 408 status code. Maximum allowed
60
70
  # value is 300000ms (5 minutes).
@@ -72,6 +82,7 @@ module ContextDev
72
82
  ContextDev::UtilityPrefetchParams::Identifier::UtilityPrefetchEmailIdentifier
73
83
  ),
74
84
  type: ContextDev::UtilityPrefetchParams::Type::OrSymbol,
85
+ tags: T::Array[String],
75
86
  timeout_ms: Integer,
76
87
  request_options: ContextDev::RequestOptions
77
88
  }
@@ -26,6 +26,15 @@ module ContextDev
26
26
  sig { params(num_competitors: Integer).void }
27
27
  attr_writer :num_competitors
28
28
 
29
+ # Optional comma-separated caller-defined tags for tracking this request. Tags are
30
+ # recorded on the request's usage log and can be used to filter usage on the
31
+ # dashboard usage page. Up to 20 tags, each 1-50 characters.
32
+ sig { returns(T.nilable(T::Array[String])) }
33
+ attr_reader :tags
34
+
35
+ sig { params(tags: T::Array[String]).void }
36
+ attr_writer :tags
37
+
29
38
  # Optional timeout in milliseconds for the request. If the request takes longer
30
39
  # than this value, it will be aborted with a 408 status code. Maximum allowed
31
40
  # value is 300000ms (5 minutes).
@@ -39,6 +48,7 @@ module ContextDev
39
48
  params(
40
49
  domain: String,
41
50
  num_competitors: Integer,
51
+ tags: T::Array[String],
42
52
  timeout_ms: Integer,
43
53
  request_options: ContextDev::RequestOptions::OrHash
44
54
  ).returns(T.attached_class)
@@ -49,6 +59,10 @@ module ContextDev
49
59
  domain:,
50
60
  # Exact number of direct competitors to return. Defaults to 5.
51
61
  num_competitors: nil,
62
+ # Optional comma-separated caller-defined tags for tracking this request. Tags are
63
+ # recorded on the request's usage log and can be used to filter usage on the
64
+ # dashboard usage page. Up to 20 tags, each 1-50 characters.
65
+ tags: nil,
52
66
  # Optional timeout in milliseconds for the request. If the request takes longer
53
67
  # than this value, it will be aborted with a 408 status code. Maximum allowed
54
68
  # value is 300000ms (5 minutes).
@@ -62,6 +76,7 @@ module ContextDev
62
76
  {
63
77
  domain: String,
64
78
  num_competitors: Integer,
79
+ tags: T::Array[String],
65
80
  timeout_ms: Integer,
66
81
  request_options: ContextDev::RequestOptions
67
82
  }
@@ -32,15 +32,21 @@ module ContextDev
32
32
  sig { params(domain: String).void }
33
33
  attr_writer :domain
34
34
 
35
- # Maximum age in milliseconds for cached data before the API performs a hard
35
+ # Maximum age in milliseconds for cached brand data before the API performs a hard
36
36
  # refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms)
37
37
  # are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1
38
38
  # year.
39
39
  sig { returns(T.nilable(Integer)) }
40
- attr_reader :max_age_ms
40
+ attr_accessor :max_age_ms
41
41
 
42
- sig { params(max_age_ms: Integer).void }
43
- attr_writer :max_age_ms
42
+ # Optional comma-separated caller-defined tags for tracking this request. Tags are
43
+ # recorded on the request's usage log and can be used to filter usage on the
44
+ # dashboard usage page. Up to 20 tags, each 1-50 characters.
45
+ sig { returns(T.nilable(T::Array[String])) }
46
+ attr_reader :tags
47
+
48
+ sig { params(tags: T::Array[String]).void }
49
+ attr_writer :tags
44
50
 
45
51
  # Optional timeout in milliseconds for the request. If the request takes longer
46
52
  # than this value, it will be aborted with a 408 status code. Maximum allowed
@@ -55,7 +61,8 @@ module ContextDev
55
61
  params(
56
62
  direct_url: String,
57
63
  domain: String,
58
- max_age_ms: Integer,
64
+ max_age_ms: T.nilable(Integer),
65
+ tags: T::Array[String],
59
66
  timeout_ms: Integer,
60
67
  request_options: ContextDev::RequestOptions::OrHash
61
68
  ).returns(T.attached_class)
@@ -69,11 +76,15 @@ module ContextDev
69
76
  # domain will be automatically normalized and validated. You must provide either
70
77
  # 'domain' or 'directUrl', but not both.
71
78
  domain: nil,
72
- # Maximum age in milliseconds for cached data before the API performs a hard
79
+ # Maximum age in milliseconds for cached brand data before the API performs a hard
73
80
  # refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms)
74
81
  # are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1
75
82
  # year.
76
83
  max_age_ms: nil,
84
+ # Optional comma-separated caller-defined tags for tracking this request. Tags are
85
+ # recorded on the request's usage log and can be used to filter usage on the
86
+ # dashboard usage page. Up to 20 tags, each 1-50 characters.
87
+ tags: nil,
77
88
  # Optional timeout in milliseconds for the request. If the request takes longer
78
89
  # than this value, it will be aborted with a 408 status code. Maximum allowed
79
90
  # value is 300000ms (5 minutes).
@@ -87,7 +98,8 @@ module ContextDev
87
98
  {
88
99
  direct_url: String,
89
100
  domain: String,
90
- max_age_ms: Integer,
101
+ max_age_ms: T.nilable(Integer),
102
+ tags: T::Array[String],
91
103
  timeout_ms: Integer,
92
104
  request_options: ContextDev::RequestOptions
93
105
  }