context.dev 2.1.0 → 2.3.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 +23 -0
- data/README.md +1 -1
- data/lib/context_dev/client.rb +7 -2
- data/lib/context_dev/internal/type/base_model.rb +5 -5
- data/lib/context_dev/models/monitor_create_params.rb +44 -14
- data/lib/context_dev/models/monitor_create_response.rb +112 -15
- data/lib/context_dev/models/monitor_list_account_runs_response.rb +23 -1
- data/lib/context_dev/models/monitor_list_response.rb +116 -15
- data/lib/context_dev/models/monitor_list_runs_response.rb +23 -1
- data/lib/context_dev/models/monitor_retrieve_change_response.rb +10 -10
- data/lib/context_dev/models/monitor_retrieve_response.rb +113 -15
- data/lib/context_dev/models/monitor_update_params.rb +44 -14
- data/lib/context_dev/models/monitor_update_response.rb +112 -15
- data/lib/context_dev/models/parse_handle_params.rb +110 -0
- data/lib/context_dev/models/parse_handle_response.rb +132 -0
- data/lib/context_dev/models/web_web_crawl_md_params.rb +16 -6
- data/lib/context_dev/models/web_web_scrape_html_params.rb +16 -6
- data/lib/context_dev/models/web_web_scrape_md_params.rb +16 -6
- data/lib/context_dev/models/web_web_scrape_md_response.rb +11 -1
- data/lib/context_dev/models/webhook_delivery.rb +109 -0
- data/lib/context_dev/models.rb +4 -0
- data/lib/context_dev/resources/monitors.rb +3 -2
- data/lib/context_dev/resources/parse.rb +63 -0
- data/lib/context_dev/resources/web.rb +19 -4
- data/lib/context_dev/version.rb +1 -1
- data/lib/context_dev.rb +4 -0
- data/rbi/context_dev/client.rbi +6 -2
- data/rbi/context_dev/models/monitor_create_params.rbi +106 -16
- data/rbi/context_dev/models/monitor_create_response.rbi +255 -17
- data/rbi/context_dev/models/monitor_list_account_runs_response.rbi +39 -3
- data/rbi/context_dev/models/monitor_list_response.rbi +256 -16
- data/rbi/context_dev/models/monitor_list_runs_response.rbi +39 -3
- data/rbi/context_dev/models/monitor_retrieve_change_response.rbi +12 -15
- data/rbi/context_dev/models/monitor_retrieve_response.rbi +255 -17
- data/rbi/context_dev/models/monitor_update_params.rbi +106 -16
- data/rbi/context_dev/models/monitor_update_response.rbi +255 -17
- data/rbi/context_dev/models/parse_handle_params.rbi +163 -0
- data/rbi/context_dev/models/parse_handle_response.rbi +377 -0
- data/rbi/context_dev/models/web_web_crawl_md_params.rbi +26 -7
- data/rbi/context_dev/models/web_web_scrape_html_params.rbi +26 -7
- data/rbi/context_dev/models/web_web_scrape_md_params.rbi +26 -7
- data/rbi/context_dev/models/web_web_scrape_md_response.rbi +12 -0
- data/rbi/context_dev/models/webhook_delivery.rbi +172 -0
- data/rbi/context_dev/models.rbi +4 -0
- data/rbi/context_dev/resources/monitors.rbi +3 -2
- data/rbi/context_dev/resources/parse.rbi +65 -0
- data/rbi/context_dev/resources/web.rbi +22 -7
- data/sig/context_dev/client.rbs +2 -0
- data/sig/context_dev/models/monitor_create_params.rbs +32 -3
- data/sig/context_dev/models/monitor_create_response.rbs +85 -6
- data/sig/context_dev/models/monitor_list_account_runs_response.rbs +21 -3
- data/sig/context_dev/models/monitor_list_response.rbs +85 -6
- data/sig/context_dev/models/monitor_list_runs_response.rbs +21 -3
- data/sig/context_dev/models/monitor_retrieve_change_response.rbs +8 -10
- data/sig/context_dev/models/monitor_retrieve_response.rbs +85 -6
- data/sig/context_dev/models/monitor_update_params.rbs +32 -3
- data/sig/context_dev/models/monitor_update_response.rbs +85 -6
- data/sig/context_dev/models/parse_handle_params.rbs +96 -0
- data/sig/context_dev/models/parse_handle_response.rbs +159 -0
- data/sig/context_dev/models/web_web_crawl_md_params.rbs +13 -2
- data/sig/context_dev/models/web_web_scrape_html_params.rbs +13 -2
- data/sig/context_dev/models/web_web_scrape_md_params.rbs +13 -2
- data/sig/context_dev/models/web_web_scrape_md_response.rbs +5 -0
- data/sig/context_dev/models/webhook_delivery.rbs +81 -0
- data/sig/context_dev/models.rbs +4 -0
- data/sig/context_dev/resources/parse.rbs +22 -0
- metadata +14 -2
|
@@ -128,6 +128,26 @@ module ContextDev
|
|
|
128
128
|
end
|
|
129
129
|
attr_writer :webhook
|
|
130
130
|
|
|
131
|
+
# Present while webhook deliveries are failing consecutively; null when deliveries
|
|
132
|
+
# are healthy or no webhook is configured. Cleared on the next successful delivery
|
|
133
|
+
# and when the webhook URL changes.
|
|
134
|
+
sig do
|
|
135
|
+
returns(
|
|
136
|
+
T.nilable(ContextDev::Models::MonitorUpdateResponse::WebhookFailure)
|
|
137
|
+
)
|
|
138
|
+
end
|
|
139
|
+
attr_reader :webhook_failure
|
|
140
|
+
|
|
141
|
+
sig do
|
|
142
|
+
params(
|
|
143
|
+
webhook_failure:
|
|
144
|
+
T.nilable(
|
|
145
|
+
ContextDev::Models::MonitorUpdateResponse::WebhookFailure::OrHash
|
|
146
|
+
)
|
|
147
|
+
).void
|
|
148
|
+
end
|
|
149
|
+
attr_writer :webhook_failure
|
|
150
|
+
|
|
131
151
|
# A web monitor. `mode` is the constant `web`; behavior is described by `target`
|
|
132
152
|
# (page/sitemap/extract) and `change_detection` (exact/semantic).
|
|
133
153
|
sig do
|
|
@@ -169,6 +189,10 @@ module ContextDev
|
|
|
169
189
|
webhook:
|
|
170
190
|
T.nilable(
|
|
171
191
|
ContextDev::Models::MonitorUpdateResponse::Webhook::OrHash
|
|
192
|
+
),
|
|
193
|
+
webhook_failure:
|
|
194
|
+
T.nilable(
|
|
195
|
+
ContextDev::Models::MonitorUpdateResponse::WebhookFailure::OrHash
|
|
172
196
|
)
|
|
173
197
|
).returns(T.attached_class)
|
|
174
198
|
end
|
|
@@ -207,7 +231,11 @@ module ContextDev
|
|
|
207
231
|
next_run_at: nil,
|
|
208
232
|
# User-defined tags for grouping and filtering monitors and their changes.
|
|
209
233
|
tags: nil,
|
|
210
|
-
webhook: nil
|
|
234
|
+
webhook: nil,
|
|
235
|
+
# Present while webhook deliveries are failing consecutively; null when deliveries
|
|
236
|
+
# are healthy or no webhook is configured. Cleared on the next successful delivery
|
|
237
|
+
# and when the webhook URL changes.
|
|
238
|
+
webhook_failure: nil
|
|
211
239
|
)
|
|
212
240
|
end
|
|
213
241
|
|
|
@@ -236,7 +264,11 @@ module ContextDev
|
|
|
236
264
|
next_run_at: T.nilable(Time),
|
|
237
265
|
tags: T::Array[String],
|
|
238
266
|
webhook:
|
|
239
|
-
T.nilable(ContextDev::Models::MonitorUpdateResponse::Webhook)
|
|
267
|
+
T.nilable(ContextDev::Models::MonitorUpdateResponse::Webhook),
|
|
268
|
+
webhook_failure:
|
|
269
|
+
T.nilable(
|
|
270
|
+
ContextDev::Models::MonitorUpdateResponse::WebhookFailure
|
|
271
|
+
)
|
|
240
272
|
}
|
|
241
273
|
)
|
|
242
274
|
end
|
|
@@ -296,9 +328,9 @@ module ContextDev
|
|
|
296
328
|
sig { params(confidence_threshold: Float).void }
|
|
297
329
|
attr_writer :confidence_threshold
|
|
298
330
|
|
|
299
|
-
# Detect meaning-level changes to
|
|
300
|
-
# paraphrase-only differences.
|
|
301
|
-
# target's `
|
|
331
|
+
# Detect meaning-level changes to tracked page content, ignoring cosmetic or
|
|
332
|
+
# paraphrase-only differences. Which changes are meaningful is judged against the
|
|
333
|
+
# extract target's `instructions` (and `schema`, when provided).
|
|
302
334
|
sig do
|
|
303
335
|
params(confidence_threshold: Float, type: Symbol).returns(
|
|
304
336
|
T.attached_class
|
|
@@ -708,9 +740,14 @@ module ContextDev
|
|
|
708
740
|
sig { params(max_pages: Integer).void }
|
|
709
741
|
attr_writer :max_pages
|
|
710
742
|
|
|
711
|
-
# JSON Schema describing the data you care about. It
|
|
712
|
-
# selected for tracking
|
|
713
|
-
#
|
|
743
|
+
# JSON Schema describing the data you care about. It is used three ways: it guides
|
|
744
|
+
# which pages are selected for tracking, it gives the change judge extra context
|
|
745
|
+
# on which changes matter (alongside `instructions`), and it defines the shape of
|
|
746
|
+
# the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most
|
|
747
|
+
# about once a day). It is not a response format for changes: change events and
|
|
748
|
+
# webhook payloads always contain diffs, summaries, and evidence excerpts — never
|
|
749
|
+
# data in this schema's shape. If omitted, a default summary + key-points schema
|
|
750
|
+
# is used.
|
|
714
751
|
sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
|
|
715
752
|
attr_reader :schema
|
|
716
753
|
|
|
@@ -720,8 +757,8 @@ module ContextDev
|
|
|
720
757
|
# Watch the monitor-relevant pages of a site for meaningful changes. A crawl
|
|
721
758
|
# guided by `schema`/`instructions` selects up to `max_pages` relevant pages to
|
|
722
759
|
# track; each run re-checks exactly those pages, and confirmed content changes are
|
|
723
|
-
# judged against the monitor's instructions
|
|
724
|
-
# a periodic re-discovery crawl.
|
|
760
|
+
# judged for relevance against the monitor's `instructions` (and `schema`, when
|
|
761
|
+
# provided). The tracked page set is refreshed by a periodic re-discovery crawl.
|
|
725
762
|
sig do
|
|
726
763
|
params(
|
|
727
764
|
instructions: String,
|
|
@@ -744,9 +781,14 @@ module ContextDev
|
|
|
744
781
|
max_depth: nil,
|
|
745
782
|
# Maximum number of pages to track.
|
|
746
783
|
max_pages: nil,
|
|
747
|
-
# JSON Schema describing the data you care about. It
|
|
748
|
-
# selected for tracking
|
|
749
|
-
#
|
|
784
|
+
# JSON Schema describing the data you care about. It is used three ways: it guides
|
|
785
|
+
# which pages are selected for tracking, it gives the change judge extra context
|
|
786
|
+
# on which changes matter (alongside `instructions`), and it defines the shape of
|
|
787
|
+
# the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most
|
|
788
|
+
# about once a day). It is not a response format for changes: change events and
|
|
789
|
+
# webhook payloads always contain diffs, summaries, and evidence excerpts — never
|
|
790
|
+
# data in this schema's shape. If omitted, a default summary + key-points schema
|
|
791
|
+
# is used.
|
|
750
792
|
schema: nil,
|
|
751
793
|
type: :extract
|
|
752
794
|
)
|
|
@@ -983,10 +1025,35 @@ module ContextDev
|
|
|
983
1025
|
)
|
|
984
1026
|
end
|
|
985
1027
|
|
|
986
|
-
# Webhook URL
|
|
1028
|
+
# Webhook URL events are delivered to.
|
|
987
1029
|
sig { returns(String) }
|
|
988
1030
|
attr_accessor :url
|
|
989
1031
|
|
|
1032
|
+
# Events delivered to this endpoint. `change.detected` fires only when a run
|
|
1033
|
+
# detects a change; `run.completed` fires on every completed run — including runs
|
|
1034
|
+
# that detected no change — and embeds the change when one was detected. Defaults
|
|
1035
|
+
# to `["change.detected"]` when omitted.
|
|
1036
|
+
sig do
|
|
1037
|
+
returns(
|
|
1038
|
+
T.nilable(
|
|
1039
|
+
T::Array[
|
|
1040
|
+
ContextDev::Models::MonitorUpdateResponse::Webhook::Event::TaggedSymbol
|
|
1041
|
+
]
|
|
1042
|
+
)
|
|
1043
|
+
)
|
|
1044
|
+
end
|
|
1045
|
+
attr_reader :events
|
|
1046
|
+
|
|
1047
|
+
sig do
|
|
1048
|
+
params(
|
|
1049
|
+
events:
|
|
1050
|
+
T::Array[
|
|
1051
|
+
ContextDev::Models::MonitorUpdateResponse::Webhook::Event::OrSymbol
|
|
1052
|
+
]
|
|
1053
|
+
).void
|
|
1054
|
+
end
|
|
1055
|
+
attr_writer :events
|
|
1056
|
+
|
|
990
1057
|
# Signing secret used to verify webhook authenticity. Each delivery includes an
|
|
991
1058
|
# `X-Context-Signature: t=<unix>,v1=<hmac>` header, where the HMAC is SHA-256 over
|
|
992
1059
|
# `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time
|
|
@@ -998,10 +1065,24 @@ module ContextDev
|
|
|
998
1065
|
sig { params(secret: String).void }
|
|
999
1066
|
attr_writer :secret
|
|
1000
1067
|
|
|
1001
|
-
sig
|
|
1068
|
+
sig do
|
|
1069
|
+
params(
|
|
1070
|
+
url: String,
|
|
1071
|
+
events:
|
|
1072
|
+
T::Array[
|
|
1073
|
+
ContextDev::Models::MonitorUpdateResponse::Webhook::Event::OrSymbol
|
|
1074
|
+
],
|
|
1075
|
+
secret: String
|
|
1076
|
+
).returns(T.attached_class)
|
|
1077
|
+
end
|
|
1002
1078
|
def self.new(
|
|
1003
|
-
# Webhook URL
|
|
1079
|
+
# Webhook URL events are delivered to.
|
|
1004
1080
|
url:,
|
|
1081
|
+
# Events delivered to this endpoint. `change.detected` fires only when a run
|
|
1082
|
+
# detects a change; `run.completed` fires on every completed run — including runs
|
|
1083
|
+
# that detected no change — and embeds the change when one was detected. Defaults
|
|
1084
|
+
# to `["change.detected"]` when omitted.
|
|
1085
|
+
events: nil,
|
|
1005
1086
|
# Signing secret used to verify webhook authenticity. Each delivery includes an
|
|
1006
1087
|
# `X-Context-Signature: t=<unix>,v1=<hmac>` header, where the HMAC is SHA-256 over
|
|
1007
1088
|
# `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time
|
|
@@ -1011,9 +1092,166 @@ module ContextDev
|
|
|
1011
1092
|
)
|
|
1012
1093
|
end
|
|
1013
1094
|
|
|
1014
|
-
sig
|
|
1095
|
+
sig do
|
|
1096
|
+
override.returns(
|
|
1097
|
+
{
|
|
1098
|
+
url: String,
|
|
1099
|
+
events:
|
|
1100
|
+
T::Array[
|
|
1101
|
+
ContextDev::Models::MonitorUpdateResponse::Webhook::Event::TaggedSymbol
|
|
1102
|
+
],
|
|
1103
|
+
secret: String
|
|
1104
|
+
}
|
|
1105
|
+
)
|
|
1106
|
+
end
|
|
1107
|
+
def to_hash
|
|
1108
|
+
end
|
|
1109
|
+
|
|
1110
|
+
module Event
|
|
1111
|
+
extend ContextDev::Internal::Type::Enum
|
|
1112
|
+
|
|
1113
|
+
TaggedSymbol =
|
|
1114
|
+
T.type_alias do
|
|
1115
|
+
T.all(
|
|
1116
|
+
Symbol,
|
|
1117
|
+
ContextDev::Models::MonitorUpdateResponse::Webhook::Event
|
|
1118
|
+
)
|
|
1119
|
+
end
|
|
1120
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
1121
|
+
|
|
1122
|
+
CHANGE_DETECTED =
|
|
1123
|
+
T.let(
|
|
1124
|
+
:"change.detected",
|
|
1125
|
+
ContextDev::Models::MonitorUpdateResponse::Webhook::Event::TaggedSymbol
|
|
1126
|
+
)
|
|
1127
|
+
RUN_COMPLETED =
|
|
1128
|
+
T.let(
|
|
1129
|
+
:"run.completed",
|
|
1130
|
+
ContextDev::Models::MonitorUpdateResponse::Webhook::Event::TaggedSymbol
|
|
1131
|
+
)
|
|
1132
|
+
|
|
1133
|
+
sig do
|
|
1134
|
+
override.returns(
|
|
1135
|
+
T::Array[
|
|
1136
|
+
ContextDev::Models::MonitorUpdateResponse::Webhook::Event::TaggedSymbol
|
|
1137
|
+
]
|
|
1138
|
+
)
|
|
1139
|
+
end
|
|
1140
|
+
def self.values
|
|
1141
|
+
end
|
|
1142
|
+
end
|
|
1143
|
+
end
|
|
1144
|
+
|
|
1145
|
+
class WebhookFailure < ContextDev::Internal::Type::BaseModel
|
|
1146
|
+
OrHash =
|
|
1147
|
+
T.type_alias do
|
|
1148
|
+
T.any(
|
|
1149
|
+
ContextDev::Models::MonitorUpdateResponse::WebhookFailure,
|
|
1150
|
+
ContextDev::Internal::AnyHash
|
|
1151
|
+
)
|
|
1152
|
+
end
|
|
1153
|
+
|
|
1154
|
+
# Number of consecutive delivery attempts that did not succeed.
|
|
1155
|
+
sig { returns(Integer) }
|
|
1156
|
+
attr_accessor :consecutive_failures
|
|
1157
|
+
|
|
1158
|
+
sig { returns(Time) }
|
|
1159
|
+
attr_accessor :last_failed_at
|
|
1160
|
+
|
|
1161
|
+
# Human-readable description of the most recent failure.
|
|
1162
|
+
sig { returns(String) }
|
|
1163
|
+
attr_accessor :last_message
|
|
1164
|
+
|
|
1165
|
+
# Outcome of the most recent failed delivery. rejected means a non-2xx response;
|
|
1166
|
+
# failed means no HTTP response was received; skipped_unsafe_url means the URL
|
|
1167
|
+
# failed the public-endpoint safety check.
|
|
1168
|
+
sig do
|
|
1169
|
+
returns(
|
|
1170
|
+
ContextDev::Models::MonitorUpdateResponse::WebhookFailure::LastStatus::TaggedSymbol
|
|
1171
|
+
)
|
|
1172
|
+
end
|
|
1173
|
+
attr_accessor :last_status
|
|
1174
|
+
|
|
1175
|
+
# Present while webhook deliveries are failing consecutively; null when deliveries
|
|
1176
|
+
# are healthy or no webhook is configured. Cleared on the next successful delivery
|
|
1177
|
+
# and when the webhook URL changes.
|
|
1178
|
+
sig do
|
|
1179
|
+
params(
|
|
1180
|
+
consecutive_failures: Integer,
|
|
1181
|
+
last_failed_at: Time,
|
|
1182
|
+
last_message: String,
|
|
1183
|
+
last_status:
|
|
1184
|
+
ContextDev::Models::MonitorUpdateResponse::WebhookFailure::LastStatus::OrSymbol
|
|
1185
|
+
).returns(T.attached_class)
|
|
1186
|
+
end
|
|
1187
|
+
def self.new(
|
|
1188
|
+
# Number of consecutive delivery attempts that did not succeed.
|
|
1189
|
+
consecutive_failures:,
|
|
1190
|
+
last_failed_at:,
|
|
1191
|
+
# Human-readable description of the most recent failure.
|
|
1192
|
+
last_message:,
|
|
1193
|
+
# Outcome of the most recent failed delivery. rejected means a non-2xx response;
|
|
1194
|
+
# failed means no HTTP response was received; skipped_unsafe_url means the URL
|
|
1195
|
+
# failed the public-endpoint safety check.
|
|
1196
|
+
last_status:
|
|
1197
|
+
)
|
|
1198
|
+
end
|
|
1199
|
+
|
|
1200
|
+
sig do
|
|
1201
|
+
override.returns(
|
|
1202
|
+
{
|
|
1203
|
+
consecutive_failures: Integer,
|
|
1204
|
+
last_failed_at: Time,
|
|
1205
|
+
last_message: String,
|
|
1206
|
+
last_status:
|
|
1207
|
+
ContextDev::Models::MonitorUpdateResponse::WebhookFailure::LastStatus::TaggedSymbol
|
|
1208
|
+
}
|
|
1209
|
+
)
|
|
1210
|
+
end
|
|
1015
1211
|
def to_hash
|
|
1016
1212
|
end
|
|
1213
|
+
|
|
1214
|
+
# Outcome of the most recent failed delivery. rejected means a non-2xx response;
|
|
1215
|
+
# failed means no HTTP response was received; skipped_unsafe_url means the URL
|
|
1216
|
+
# failed the public-endpoint safety check.
|
|
1217
|
+
module LastStatus
|
|
1218
|
+
extend ContextDev::Internal::Type::Enum
|
|
1219
|
+
|
|
1220
|
+
TaggedSymbol =
|
|
1221
|
+
T.type_alias do
|
|
1222
|
+
T.all(
|
|
1223
|
+
Symbol,
|
|
1224
|
+
ContextDev::Models::MonitorUpdateResponse::WebhookFailure::LastStatus
|
|
1225
|
+
)
|
|
1226
|
+
end
|
|
1227
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
1228
|
+
|
|
1229
|
+
REJECTED =
|
|
1230
|
+
T.let(
|
|
1231
|
+
:rejected,
|
|
1232
|
+
ContextDev::Models::MonitorUpdateResponse::WebhookFailure::LastStatus::TaggedSymbol
|
|
1233
|
+
)
|
|
1234
|
+
FAILED =
|
|
1235
|
+
T.let(
|
|
1236
|
+
:failed,
|
|
1237
|
+
ContextDev::Models::MonitorUpdateResponse::WebhookFailure::LastStatus::TaggedSymbol
|
|
1238
|
+
)
|
|
1239
|
+
SKIPPED_UNSAFE_URL =
|
|
1240
|
+
T.let(
|
|
1241
|
+
:skipped_unsafe_url,
|
|
1242
|
+
ContextDev::Models::MonitorUpdateResponse::WebhookFailure::LastStatus::TaggedSymbol
|
|
1243
|
+
)
|
|
1244
|
+
|
|
1245
|
+
sig do
|
|
1246
|
+
override.returns(
|
|
1247
|
+
T::Array[
|
|
1248
|
+
ContextDev::Models::MonitorUpdateResponse::WebhookFailure::LastStatus::TaggedSymbol
|
|
1249
|
+
]
|
|
1250
|
+
)
|
|
1251
|
+
end
|
|
1252
|
+
def self.values
|
|
1253
|
+
end
|
|
1254
|
+
end
|
|
1017
1255
|
end
|
|
1018
1256
|
end
|
|
1019
1257
|
end
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module ContextDev
|
|
4
|
+
module Models
|
|
5
|
+
class ParseHandleParams < ContextDev::Internal::Type::BaseModel
|
|
6
|
+
extend ContextDev::Internal::Type::RequestParameters::Converter
|
|
7
|
+
include ContextDev::Internal::Type::RequestParameters
|
|
8
|
+
|
|
9
|
+
OrHash =
|
|
10
|
+
T.type_alias do
|
|
11
|
+
T.any(ContextDev::ParseHandleParams, ContextDev::Internal::AnyHash)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
sig { returns(ContextDev::Internal::FileInput) }
|
|
15
|
+
attr_accessor :body
|
|
16
|
+
|
|
17
|
+
# Optional HTTP(S) source document URL used to resolve relative links and image
|
|
18
|
+
# references. Relative references remain relative when omitted.
|
|
19
|
+
sig { returns(T.nilable(String)) }
|
|
20
|
+
attr_reader :base_url
|
|
21
|
+
|
|
22
|
+
sig { params(base_url: String).void }
|
|
23
|
+
attr_writer :base_url
|
|
24
|
+
|
|
25
|
+
# Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv,
|
|
26
|
+
# md, py, rtf, jpg, png, or txt.
|
|
27
|
+
sig { returns(T.nilable(String)) }
|
|
28
|
+
attr_reader :extension
|
|
29
|
+
|
|
30
|
+
sig { params(extension: String).void }
|
|
31
|
+
attr_writer :extension
|
|
32
|
+
|
|
33
|
+
# Optional filename hint used to infer the extension when extension is omitted.
|
|
34
|
+
sig { returns(T.nilable(String)) }
|
|
35
|
+
attr_reader :filename
|
|
36
|
+
|
|
37
|
+
sig { params(filename: String).void }
|
|
38
|
+
attr_writer :filename
|
|
39
|
+
|
|
40
|
+
# Include image references in Markdown output
|
|
41
|
+
sig { returns(T.nilable(T::Boolean)) }
|
|
42
|
+
attr_reader :include_images
|
|
43
|
+
|
|
44
|
+
sig { params(include_images: T::Boolean).void }
|
|
45
|
+
attr_writer :include_images
|
|
46
|
+
|
|
47
|
+
# Preserve hyperlinks in Markdown output
|
|
48
|
+
sig { returns(T.nilable(T::Boolean)) }
|
|
49
|
+
attr_reader :include_links
|
|
50
|
+
|
|
51
|
+
sig { params(include_links: T::Boolean).void }
|
|
52
|
+
attr_writer :include_links
|
|
53
|
+
|
|
54
|
+
# When true for PDF inputs, detect and OCR images embedded in the selected pages,
|
|
55
|
+
# inserting recognized text at each image's position in page reading order while
|
|
56
|
+
# preserving the PDF text layer. pdfStart/pdfEnd limit the inclusive page range.
|
|
57
|
+
# This is separate from automatic scanned-PDF OCR fallback.
|
|
58
|
+
sig { returns(T.nilable(T::Boolean)) }
|
|
59
|
+
attr_reader :ocr
|
|
60
|
+
|
|
61
|
+
sig { params(ocr: T::Boolean).void }
|
|
62
|
+
attr_writer :ocr
|
|
63
|
+
|
|
64
|
+
# Last 1-based PDF page to parse. When omitted, parsing ends at the last page.
|
|
65
|
+
# Must be greater than or equal to pdfStart when both are provided.
|
|
66
|
+
sig { returns(T.nilable(Integer)) }
|
|
67
|
+
attr_reader :pdf_end
|
|
68
|
+
|
|
69
|
+
sig { params(pdf_end: Integer).void }
|
|
70
|
+
attr_writer :pdf_end
|
|
71
|
+
|
|
72
|
+
# First 1-based PDF page to parse. When omitted, parsing starts at the first page.
|
|
73
|
+
sig { returns(T.nilable(Integer)) }
|
|
74
|
+
attr_reader :pdf_start
|
|
75
|
+
|
|
76
|
+
sig { params(pdf_start: Integer).void }
|
|
77
|
+
attr_writer :pdf_start
|
|
78
|
+
|
|
79
|
+
# Shorten base64-encoded image data in the Markdown output
|
|
80
|
+
sig { returns(T.nilable(T::Boolean)) }
|
|
81
|
+
attr_reader :shorten_base64_images
|
|
82
|
+
|
|
83
|
+
sig { params(shorten_base64_images: T::Boolean).void }
|
|
84
|
+
attr_writer :shorten_base64_images
|
|
85
|
+
|
|
86
|
+
# Extract only the main content from HTML-like inputs
|
|
87
|
+
sig { returns(T.nilable(T::Boolean)) }
|
|
88
|
+
attr_reader :use_main_content_only
|
|
89
|
+
|
|
90
|
+
sig { params(use_main_content_only: T::Boolean).void }
|
|
91
|
+
attr_writer :use_main_content_only
|
|
92
|
+
|
|
93
|
+
sig do
|
|
94
|
+
params(
|
|
95
|
+
body: ContextDev::Internal::FileInput,
|
|
96
|
+
base_url: String,
|
|
97
|
+
extension: String,
|
|
98
|
+
filename: String,
|
|
99
|
+
include_images: T::Boolean,
|
|
100
|
+
include_links: T::Boolean,
|
|
101
|
+
ocr: T::Boolean,
|
|
102
|
+
pdf_end: Integer,
|
|
103
|
+
pdf_start: Integer,
|
|
104
|
+
shorten_base64_images: T::Boolean,
|
|
105
|
+
use_main_content_only: T::Boolean,
|
|
106
|
+
request_options: ContextDev::RequestOptions::OrHash
|
|
107
|
+
).returns(T.attached_class)
|
|
108
|
+
end
|
|
109
|
+
def self.new(
|
|
110
|
+
body:,
|
|
111
|
+
# Optional HTTP(S) source document URL used to resolve relative links and image
|
|
112
|
+
# references. Relative references remain relative when omitted.
|
|
113
|
+
base_url: nil,
|
|
114
|
+
# Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv,
|
|
115
|
+
# md, py, rtf, jpg, png, or txt.
|
|
116
|
+
extension: nil,
|
|
117
|
+
# Optional filename hint used to infer the extension when extension is omitted.
|
|
118
|
+
filename: nil,
|
|
119
|
+
# Include image references in Markdown output
|
|
120
|
+
include_images: nil,
|
|
121
|
+
# Preserve hyperlinks in Markdown output
|
|
122
|
+
include_links: nil,
|
|
123
|
+
# When true for PDF inputs, detect and OCR images embedded in the selected pages,
|
|
124
|
+
# inserting recognized text at each image's position in page reading order while
|
|
125
|
+
# preserving the PDF text layer. pdfStart/pdfEnd limit the inclusive page range.
|
|
126
|
+
# This is separate from automatic scanned-PDF OCR fallback.
|
|
127
|
+
ocr: nil,
|
|
128
|
+
# Last 1-based PDF page to parse. When omitted, parsing ends at the last page.
|
|
129
|
+
# Must be greater than or equal to pdfStart when both are provided.
|
|
130
|
+
pdf_end: nil,
|
|
131
|
+
# First 1-based PDF page to parse. When omitted, parsing starts at the first page.
|
|
132
|
+
pdf_start: nil,
|
|
133
|
+
# Shorten base64-encoded image data in the Markdown output
|
|
134
|
+
shorten_base64_images: nil,
|
|
135
|
+
# Extract only the main content from HTML-like inputs
|
|
136
|
+
use_main_content_only: nil,
|
|
137
|
+
request_options: {}
|
|
138
|
+
)
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
sig do
|
|
142
|
+
override.returns(
|
|
143
|
+
{
|
|
144
|
+
body: ContextDev::Internal::FileInput,
|
|
145
|
+
base_url: String,
|
|
146
|
+
extension: String,
|
|
147
|
+
filename: String,
|
|
148
|
+
include_images: T::Boolean,
|
|
149
|
+
include_links: T::Boolean,
|
|
150
|
+
ocr: T::Boolean,
|
|
151
|
+
pdf_end: Integer,
|
|
152
|
+
pdf_start: Integer,
|
|
153
|
+
shorten_base64_images: T::Boolean,
|
|
154
|
+
use_main_content_only: T::Boolean,
|
|
155
|
+
request_options: ContextDev::RequestOptions
|
|
156
|
+
}
|
|
157
|
+
)
|
|
158
|
+
end
|
|
159
|
+
def to_hash
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
end
|