context.dev 1.20.1 → 1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3ab6a6538a4daaf8da84619991d0ab42b69981fddc96323e3525f040b19f4e26
4
- data.tar.gz: 8844bde32208534b85cf200b78984579a53eb7580e65003a024c85038699daaa
3
+ metadata.gz: 07c029ca2179a5702e57c1770842bbca532868ee3c9c70316c5eb7e6be31d194
4
+ data.tar.gz: a010b812638e6fe9907811b9dc26e9c8d95bda8b98321669b015409be72437bd
5
5
  SHA512:
6
- metadata.gz: 86b2070b828fe249ccfa9e10fd50ac470473ac89b59023f88404eed9d51a66b1a2d1578425151327d8ce83ae9f78933e80875a41add0e0d4a0462697c6a8cd97
7
- data.tar.gz: bd7f7c59e2a4a31a81801c6d6b80ebe0b49faa48455f86d83a228b5210ad17caaad4a861291f8e0e441288227bfbeae8cbfee7f92416f15bb0e8b9f18f515b60
6
+ metadata.gz: 7d0670b26708d40b8d81280ec687971211d1c751b4690fb9eafeaf193a60b74f71f82628c874263255e17c6bc632bd62b5afb13b6d30039664a2c33bc9777543
7
+ data.tar.gz: 7a32179cbdc288d15e7d138083cb8d26eddddc80525a5125ff40e61183a60b1fdefa766a850837abd2dc83980219ac514718367b1e34de82c4f96e50d5aca779
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.21.0 (2026-05-16)
4
+
5
+ Full Changelog: [v1.20.1...v1.21.0](https://github.com/context-dot-dev/context-ruby-sdk/compare/v1.20.1...v1.21.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** manual updates ([b6c283e](https://github.com/context-dot-dev/context-ruby-sdk/commit/b6c283ee6c514421e07fb0b6d61aace62df318d1))
10
+
3
11
  ## 1.20.1 (2026-05-14)
4
12
 
5
13
  Full Changelog: [v1.20.0...v1.20.1](https://github.com/context-dot-dev/context-ruby-sdk/compare/v1.20.0...v1.20.1)
data/README.md CHANGED
@@ -26,7 +26,7 @@ To use this gem, install via Bundler by adding the following to your application
26
26
  <!-- x-release-please-start-version -->
27
27
 
28
28
  ```ruby
29
- gem "context.dev", "~> 1.20.1"
29
+ gem "context.dev", "~> 1.21.0"
30
30
  ```
31
31
 
32
32
  <!-- x-release-please-end -->
@@ -0,0 +1,218 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ContextDev
4
+ module Models
5
+ # @see ContextDev::Resources::Web#search
6
+ class WebSearchParams < ContextDev::Internal::Type::BaseModel
7
+ extend ContextDev::Internal::Type::RequestParameters::Converter
8
+ include ContextDev::Internal::Type::RequestParameters
9
+
10
+ # @!attribute query
11
+ # Natural-language search query.
12
+ #
13
+ # @return [String]
14
+ required :query, String
15
+
16
+ # @!attribute exclude_domains
17
+ # Blocklist — drop results from these domains. Example: ["pinterest.com",
18
+ # "reddit.com"].
19
+ #
20
+ # @return [Array<String>, nil]
21
+ optional :exclude_domains, ContextDev::Internal::Type::ArrayOf[String], api_name: :excludeDomains
22
+
23
+ # @!attribute freshness
24
+ # Restrict results to content published within this window.
25
+ #
26
+ # @return [Symbol, ContextDev::Models::WebSearchParams::Freshness, nil]
27
+ optional :freshness, enum: -> { ContextDev::WebSearchParams::Freshness }
28
+
29
+ # @!attribute include_domains
30
+ # Allowlist — only return results from these domains. Example: ["arxiv.org",
31
+ # "github.com"].
32
+ #
33
+ # @return [Array<String>, nil]
34
+ optional :include_domains, ContextDev::Internal::Type::ArrayOf[String], api_name: :includeDomains
35
+
36
+ # @!attribute markdown_options
37
+ # Inline Markdown scraping for each result. Set `enabled: true` to activate.
38
+ #
39
+ # @return [ContextDev::Models::WebSearchParams::MarkdownOptions, nil]
40
+ optional :markdown_options,
41
+ -> { ContextDev::WebSearchParams::MarkdownOptions },
42
+ api_name: :markdownOptions
43
+
44
+ # @!attribute query_fanout
45
+ # Expand the query into multiple parallel variants for broader recall.
46
+ #
47
+ # @return [Boolean, nil]
48
+ optional :query_fanout, ContextDev::Internal::Type::Boolean, api_name: :queryFanout
49
+
50
+ # @!attribute timeout_ms
51
+ # Optional timeout in milliseconds for the request. If the request takes longer
52
+ # than this value, it will be aborted with a 408 status code. Maximum allowed
53
+ # value is 300000ms (5 minutes).
54
+ #
55
+ # @return [Integer, nil]
56
+ optional :timeout_ms, Integer, api_name: :timeoutMS
57
+
58
+ # @!method initialize(query:, exclude_domains: nil, freshness: nil, include_domains: nil, markdown_options: nil, query_fanout: nil, timeout_ms: nil, request_options: {})
59
+ # Some parameter documentations has been truncated, see
60
+ # {ContextDev::Models::WebSearchParams} for more details.
61
+ #
62
+ # @param query [String] Natural-language search query.
63
+ #
64
+ # @param exclude_domains [Array<String>] Blocklist — drop results from these domains. Example: ["pinterest.com", "reddit.
65
+ #
66
+ # @param freshness [Symbol, ContextDev::Models::WebSearchParams::Freshness] Restrict results to content published within this window.
67
+ #
68
+ # @param include_domains [Array<String>] Allowlist — only return results from these domains. Example: ["arxiv.org", "gith
69
+ #
70
+ # @param markdown_options [ContextDev::Models::WebSearchParams::MarkdownOptions] Inline Markdown scraping for each result. Set `enabled: true` to activate.
71
+ #
72
+ # @param query_fanout [Boolean] Expand the query into multiple parallel variants for broader recall.
73
+ #
74
+ # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th
75
+ #
76
+ # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}]
77
+
78
+ # Restrict results to content published within this window.
79
+ module Freshness
80
+ extend ContextDev::Internal::Type::Enum
81
+
82
+ LAST_24_HOURS = :last_24_hours
83
+ LAST_WEEK = :last_week
84
+ LAST_MONTH = :last_month
85
+ LAST_YEAR = :last_year
86
+
87
+ # @!method self.values
88
+ # @return [Array<Symbol>]
89
+ end
90
+
91
+ class MarkdownOptions < ContextDev::Internal::Type::BaseModel
92
+ # @!attribute enabled
93
+ # Scrape each result to Markdown. Off by default to keep search cheap and fast.
94
+ #
95
+ # @return [Boolean, nil]
96
+ optional :enabled, ContextDev::Internal::Type::Boolean
97
+
98
+ # @!attribute include_frames
99
+ # Render iframe contents into the Markdown.
100
+ #
101
+ # @return [Boolean, nil]
102
+ optional :include_frames, ContextDev::Internal::Type::Boolean, api_name: :includeFrames
103
+
104
+ # @!attribute include_images
105
+ # Emit image references in the Markdown.
106
+ #
107
+ # @return [Boolean, nil]
108
+ optional :include_images, ContextDev::Internal::Type::Boolean, api_name: :includeImages
109
+
110
+ # @!attribute include_links
111
+ # Keep hyperlinks in the Markdown.
112
+ #
113
+ # @return [Boolean, nil]
114
+ optional :include_links, ContextDev::Internal::Type::Boolean, api_name: :includeLinks
115
+
116
+ # @!attribute max_age_ms
117
+ # Cache TTL in ms for scraped Markdown keyed by URL + options. Default 1 day, max
118
+ # 30 days. Set to 0 to force a fresh scrape.
119
+ #
120
+ # @return [Integer, nil]
121
+ optional :max_age_ms, Integer, api_name: :maxAgeMs
122
+
123
+ # @!attribute pdf
124
+ # PDF handling. Use start/end to bound text extraction and OCR to a page range.
125
+ #
126
+ # @return [ContextDev::Models::WebSearchParams::MarkdownOptions::Pdf, nil]
127
+ optional :pdf, -> { ContextDev::WebSearchParams::MarkdownOptions::Pdf }
128
+
129
+ # @!attribute shorten_base64_images
130
+ # Truncate inline base64 image payloads to keep responses small.
131
+ #
132
+ # @return [Boolean, nil]
133
+ optional :shorten_base64_images, ContextDev::Internal::Type::Boolean, api_name: :shortenBase64Images
134
+
135
+ # @!attribute timeout_ms
136
+ # Optional timeout in milliseconds for the request. If the request takes longer
137
+ # than this value, it will be aborted with a 408 status code. Maximum allowed
138
+ # value is 300000ms (5 minutes).
139
+ #
140
+ # @return [Integer, nil]
141
+ optional :timeout_ms, Integer, api_name: :timeoutMS
142
+
143
+ # @!attribute use_main_content_only
144
+ # Strip nav, header, footer, and sidebar — keep only the primary article content.
145
+ #
146
+ # @return [Boolean, nil]
147
+ optional :use_main_content_only, ContextDev::Internal::Type::Boolean, api_name: :useMainContentOnly
148
+
149
+ # @!attribute wait_for_ms
150
+ # Extra wait after page load before rendering, in ms (0–30000). Useful for
151
+ # JS-heavy pages.
152
+ #
153
+ # @return [Integer, nil]
154
+ optional :wait_for_ms, Integer, api_name: :waitForMs
155
+
156
+ # @!method initialize(enabled: nil, include_frames: nil, include_images: nil, include_links: nil, max_age_ms: nil, pdf: nil, shorten_base64_images: nil, timeout_ms: nil, use_main_content_only: nil, wait_for_ms: nil)
157
+ # Some parameter documentations has been truncated, see
158
+ # {ContextDev::Models::WebSearchParams::MarkdownOptions} for more details.
159
+ #
160
+ # Inline Markdown scraping for each result. Set `enabled: true` to activate.
161
+ #
162
+ # @param enabled [Boolean] Scrape each result to Markdown. Off by default to keep search cheap and fast.
163
+ #
164
+ # @param include_frames [Boolean] Render iframe contents into the Markdown.
165
+ #
166
+ # @param include_images [Boolean] Emit image references in the Markdown.
167
+ #
168
+ # @param include_links [Boolean] Keep hyperlinks in the Markdown.
169
+ #
170
+ # @param max_age_ms [Integer] Cache TTL in ms for scraped Markdown keyed by URL + options. Default 1 day, max
171
+ #
172
+ # @param pdf [ContextDev::Models::WebSearchParams::MarkdownOptions::Pdf] PDF handling. Use start/end to bound text extraction and OCR to a page range.
173
+ #
174
+ # @param shorten_base64_images [Boolean] Truncate inline base64 image payloads to keep responses small.
175
+ #
176
+ # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th
177
+ #
178
+ # @param use_main_content_only [Boolean] Strip nav, header, footer, and sidebar — keep only the primary article content.
179
+ #
180
+ # @param wait_for_ms [Integer] Extra wait after page load before rendering, in ms (0–30000). Useful for JS-heav
181
+
182
+ # @see ContextDev::Models::WebSearchParams::MarkdownOptions#pdf
183
+ class Pdf < ContextDev::Internal::Type::BaseModel
184
+ # @!attribute end_
185
+ # Last PDF page to parse (1-based, inclusive). Defaults to the final page. Must
186
+ # be >= start.
187
+ #
188
+ # @return [Integer, nil]
189
+ optional :end_, Integer, api_name: :end
190
+
191
+ # @!attribute should_parse
192
+ # Parse PDF URLs. When false, PDF results are skipped with WEBSITE_ACCESS_ERROR.
193
+ #
194
+ # @return [Boolean, nil]
195
+ optional :should_parse, ContextDev::Internal::Type::Boolean, api_name: :shouldParse
196
+
197
+ # @!attribute start
198
+ # First PDF page to parse (1-based, inclusive). Defaults to page 1.
199
+ #
200
+ # @return [Integer, nil]
201
+ optional :start, Integer
202
+
203
+ # @!method initialize(end_: nil, should_parse: nil, start: nil)
204
+ # Some parameter documentations has been truncated, see
205
+ # {ContextDev::Models::WebSearchParams::MarkdownOptions::Pdf} for more details.
206
+ #
207
+ # PDF handling. Use start/end to bound text extraction and OCR to a page range.
208
+ #
209
+ # @param end_ [Integer] Last PDF page to parse (1-based, inclusive). Defaults to the final page. Must be
210
+ #
211
+ # @param should_parse [Boolean] Parse PDF URLs. When false, PDF results are skipped with WEBSITE_ACCESS_ERROR.
212
+ #
213
+ # @param start [Integer] First PDF page to parse (1-based, inclusive). Defaults to page 1.
214
+ end
215
+ end
216
+ end
217
+ end
218
+ end
@@ -0,0 +1,124 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ContextDev
4
+ module Models
5
+ # @see ContextDev::Resources::Web#search
6
+ class WebSearchResponse < ContextDev::Internal::Type::BaseModel
7
+ # @!attribute query
8
+ # Echo of the original query (useful when fanout was enabled).
9
+ #
10
+ # @return [String]
11
+ required :query, String
12
+
13
+ # @!attribute results
14
+ #
15
+ # @return [Array<ContextDev::Models::WebSearchResponse::Result>]
16
+ required :results,
17
+ -> { ContextDev::Internal::Type::ArrayOf[ContextDev::Models::WebSearchResponse::Result] }
18
+
19
+ # @!method initialize(query:, results:)
20
+ # @param query [String] Echo of the original query (useful when fanout was enabled).
21
+ #
22
+ # @param results [Array<ContextDev::Models::WebSearchResponse::Result>]
23
+
24
+ class Result < ContextDev::Internal::Type::BaseModel
25
+ # @!attribute description
26
+ # Snippet excerpt from the page.
27
+ #
28
+ # @return [String]
29
+ required :description, String
30
+
31
+ # @!attribute markdown
32
+ # Markdown scrape status and content for this result.
33
+ #
34
+ # @return [ContextDev::Models::WebSearchResponse::Result::Markdown]
35
+ required :markdown, -> { ContextDev::Models::WebSearchResponse::Result::Markdown }
36
+
37
+ # @!attribute relevance
38
+ # Model-judged relevance to the original query.
39
+ #
40
+ # @return [Symbol, ContextDev::Models::WebSearchResponse::Result::Relevance]
41
+ required :relevance, enum: -> { ContextDev::Models::WebSearchResponse::Result::Relevance }
42
+
43
+ # @!attribute title
44
+ # Page title.
45
+ #
46
+ # @return [String]
47
+ required :title, String
48
+
49
+ # @!attribute url
50
+ # Canonical result URL.
51
+ #
52
+ # @return [String]
53
+ required :url, String
54
+
55
+ # @!method initialize(description:, markdown:, relevance:, title:, url:)
56
+ # @param description [String] Snippet excerpt from the page.
57
+ #
58
+ # @param markdown [ContextDev::Models::WebSearchResponse::Result::Markdown] Markdown scrape status and content for this result.
59
+ #
60
+ # @param relevance [Symbol, ContextDev::Models::WebSearchResponse::Result::Relevance] Model-judged relevance to the original query.
61
+ #
62
+ # @param title [String] Page title.
63
+ #
64
+ # @param url [String] Canonical result URL.
65
+
66
+ # @see ContextDev::Models::WebSearchResponse::Result#markdown
67
+ class Markdown < ContextDev::Internal::Type::BaseModel
68
+ # @!attribute code
69
+ # Per-result scrape outcome. Inspect this before reading `markdown`.
70
+ #
71
+ # @return [Symbol, ContextDev::Models::WebSearchResponse::Result::Markdown::Code]
72
+ required :code, enum: -> { ContextDev::Models::WebSearchResponse::Result::Markdown::Code }
73
+
74
+ # @!attribute markdown
75
+ # GFM Markdown of the page. Null unless markdownOptions.enabled is true and
76
+ # scraping succeeded.
77
+ #
78
+ # @return [String, nil]
79
+ required :markdown, String, nil?: true
80
+
81
+ # @!method initialize(code:, markdown:)
82
+ # Some parameter documentations has been truncated, see
83
+ # {ContextDev::Models::WebSearchResponse::Result::Markdown} for more details.
84
+ #
85
+ # Markdown scrape status and content for this result.
86
+ #
87
+ # @param code [Symbol, ContextDev::Models::WebSearchResponse::Result::Markdown::Code] Per-result scrape outcome. Inspect this before reading `markdown`.
88
+ #
89
+ # @param markdown [String, nil] GFM Markdown of the page. Null unless markdownOptions.enabled is true and scrapi
90
+
91
+ # Per-result scrape outcome. Inspect this before reading `markdown`.
92
+ #
93
+ # @see ContextDev::Models::WebSearchResponse::Result::Markdown#code
94
+ module Code
95
+ extend ContextDev::Internal::Type::Enum
96
+
97
+ SUCCESS = :SUCCESS
98
+ NOT_REQUESTED = :NOT_REQUESTED
99
+ TIMEOUT = :TIMEOUT
100
+ WEBSITE_ACCESS_ERROR = :WEBSITE_ACCESS_ERROR
101
+ ERROR = :ERROR
102
+
103
+ # @!method self.values
104
+ # @return [Array<Symbol>]
105
+ end
106
+ end
107
+
108
+ # Model-judged relevance to the original query.
109
+ #
110
+ # @see ContextDev::Models::WebSearchResponse::Result#relevance
111
+ module Relevance
112
+ extend ContextDev::Internal::Type::Enum
113
+
114
+ HIGH = :high
115
+ MEDIUM = :medium
116
+ LOW = :low
117
+
118
+ # @!method self.values
119
+ # @return [Array<Symbol>]
120
+ end
121
+ end
122
+ end
123
+ end
124
+ end
@@ -73,6 +73,8 @@ module ContextDev
73
73
 
74
74
  WebScreenshotParams = ContextDev::Models::WebScreenshotParams
75
75
 
76
+ WebSearchParams = ContextDev::Models::WebSearchParams
77
+
76
78
  WebWebCrawlMdParams = ContextDev::Models::WebWebCrawlMdParams
77
79
 
78
80
  WebWebScrapeHTMLParams = ContextDev::Models::WebWebScrapeHTMLParams
@@ -114,6 +114,43 @@ module ContextDev
114
114
  )
115
115
  end
116
116
 
117
+ # Some parameter documentations has been truncated, see
118
+ # {ContextDev::Models::WebSearchParams} for more details.
119
+ #
120
+ # Search the web and optionally scrape each result to Markdown in one round-trip.
121
+ #
122
+ # @overload search(query:, exclude_domains: nil, freshness: nil, include_domains: nil, markdown_options: nil, query_fanout: nil, timeout_ms: nil, request_options: {})
123
+ #
124
+ # @param query [String] Natural-language search query.
125
+ #
126
+ # @param exclude_domains [Array<String>] Blocklist — drop results from these domains. Example: ["pinterest.com", "reddit.
127
+ #
128
+ # @param freshness [Symbol, ContextDev::Models::WebSearchParams::Freshness] Restrict results to content published within this window.
129
+ #
130
+ # @param include_domains [Array<String>] Allowlist — only return results from these domains. Example: ["arxiv.org", "gith
131
+ #
132
+ # @param markdown_options [ContextDev::Models::WebSearchParams::MarkdownOptions] Inline Markdown scraping for each result. Set `enabled: true` to activate.
133
+ #
134
+ # @param query_fanout [Boolean] Expand the query into multiple parallel variants for broader recall.
135
+ #
136
+ # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th
137
+ #
138
+ # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil]
139
+ #
140
+ # @return [ContextDev::Models::WebSearchResponse]
141
+ #
142
+ # @see ContextDev::Models::WebSearchParams
143
+ def search(params)
144
+ parsed, options = ContextDev::WebSearchParams.dump_request(params)
145
+ @client.request(
146
+ method: :post,
147
+ path: "web/search",
148
+ body: parsed,
149
+ model: ContextDev::Models::WebSearchResponse,
150
+ options: options
151
+ )
152
+ end
153
+
117
154
  # Some parameter documentations has been truncated, see
118
155
  # {ContextDev::Models::WebWebCrawlMdParams} for more details.
119
156
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ContextDev
4
- VERSION = "1.20.1"
4
+ VERSION = "1.21.0"
5
5
  end
data/lib/context_dev.rb CHANGED
@@ -86,6 +86,8 @@ require_relative "context_dev/models/web_extract_styleguide_params"
86
86
  require_relative "context_dev/models/web_extract_styleguide_response"
87
87
  require_relative "context_dev/models/web_screenshot_params"
88
88
  require_relative "context_dev/models/web_screenshot_response"
89
+ require_relative "context_dev/models/web_search_params"
90
+ require_relative "context_dev/models/web_search_response"
89
91
  require_relative "context_dev/models/web_web_crawl_md_params"
90
92
  require_relative "context_dev/models/web_web_crawl_md_response"
91
93
  require_relative "context_dev/models/web_web_scrape_html_params"