sz-apimatic-sdk 0.0.1

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 (95) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +153 -0
  4. data/bin/console +15 -0
  5. data/lib/seltz_api/api_helper.rb +10 -0
  6. data/lib/seltz_api/apis/agent_api.rb +140 -0
  7. data/lib/seltz_api/apis/answer_api.rb +61 -0
  8. data/lib/seltz_api/apis/base_api.rb +67 -0
  9. data/lib/seltz_api/apis/fetch_api.rb +48 -0
  10. data/lib/seltz_api/apis/monitors_api.rb +161 -0
  11. data/lib/seltz_api/apis/records_api.rb +97 -0
  12. data/lib/seltz_api/apis/runs_api.rb +109 -0
  13. data/lib/seltz_api/apis/search_api.rb +55 -0
  14. data/lib/seltz_api/client.rb +111 -0
  15. data/lib/seltz_api/configuration.rb +165 -0
  16. data/lib/seltz_api/exceptions/api_exception.rb +21 -0
  17. data/lib/seltz_api/exceptions/error_envelope_exception.rb +46 -0
  18. data/lib/seltz_api/http/api_response.rb +19 -0
  19. data/lib/seltz_api/http/auth/custom_header_authentication.rb +52 -0
  20. data/lib/seltz_api/http/http_call_back.rb +10 -0
  21. data/lib/seltz_api/http/http_method_enum.rb +10 -0
  22. data/lib/seltz_api/http/http_request.rb +10 -0
  23. data/lib/seltz_api/http/http_response.rb +10 -0
  24. data/lib/seltz_api/http/proxy_settings.rb +22 -0
  25. data/lib/seltz_api/logging/configuration/api_logging_configuration.rb +186 -0
  26. data/lib/seltz_api/logging/sdk_logger.rb +17 -0
  27. data/lib/seltz_api/models/agent_run.rb +161 -0
  28. data/lib/seltz_api/models/agent_run_citation.rb +85 -0
  29. data/lib/seltz_api/models/agent_run_grounding.rb +94 -0
  30. data/lib/seltz_api/models/agent_run_output.rb +131 -0
  31. data/lib/seltz_api/models/agent_run_output2.rb +131 -0
  32. data/lib/seltz_api/models/agent_run_request.rb +100 -0
  33. data/lib/seltz_api/models/agent_run_request2.rb +100 -0
  34. data/lib/seltz_api/models/agent_run_source.rb +86 -0
  35. data/lib/seltz_api/models/agent_run_status.rb +49 -0
  36. data/lib/seltz_api/models/agent_run_status2.rb +48 -0
  37. data/lib/seltz_api/models/agent_run_stop_reason.rb +53 -0
  38. data/lib/seltz_api/models/agent_run_stop_reason2.rb +52 -0
  39. data/lib/seltz_api/models/answer_http_request.rb +172 -0
  40. data/lib/seltz_api/models/answer_http_response.rb +93 -0
  41. data/lib/seltz_api/models/base_model.rb +110 -0
  42. data/lib/seltz_api/models/content_options.rb +99 -0
  43. data/lib/seltz_api/models/create_agent_run_request.rb +104 -0
  44. data/lib/seltz_api/models/create_monitor_request.rb +143 -0
  45. data/lib/seltz_api/models/create_monitor_response.rb +90 -0
  46. data/lib/seltz_api/models/document.rb +128 -0
  47. data/lib/seltz_api/models/envelope_error.rb +83 -0
  48. data/lib/seltz_api/models/envelope_error1.rb +82 -0
  49. data/lib/seltz_api/models/fetch_error.rb +107 -0
  50. data/lib/seltz_api/models/fetch_error1.rb +108 -0
  51. data/lib/seltz_api/models/fetch_request.rb +144 -0
  52. data/lib/seltz_api/models/fetch_response.rb +87 -0
  53. data/lib/seltz_api/models/fetch_result.rb +176 -0
  54. data/lib/seltz_api/models/fetch_status.rb +36 -0
  55. data/lib/seltz_api/models/fetch_status2.rb +40 -0
  56. data/lib/seltz_api/models/fields.rb +108 -0
  57. data/lib/seltz_api/models/fields2.rb +101 -0
  58. data/lib/seltz_api/models/get_monitor_response.rb +87 -0
  59. data/lib/seltz_api/models/get_run_response.rb +76 -0
  60. data/lib/seltz_api/models/http_citation.rb +86 -0
  61. data/lib/seltz_api/models/list_agent_runs_response.rb +96 -0
  62. data/lib/seltz_api/models/list_monitors_response.rb +97 -0
  63. data/lib/seltz_api/models/list_records_response.rb +96 -0
  64. data/lib/seltz_api/models/list_run_records_response.rb +96 -0
  65. data/lib/seltz_api/models/list_run_requests_response.rb +84 -0
  66. data/lib/seltz_api/models/list_runs_response.rb +96 -0
  67. data/lib/seltz_api/models/monitor.rb +157 -0
  68. data/lib/seltz_api/models/monitor_search_request.rb +110 -0
  69. data/lib/seltz_api/models/monitor_status.rb +47 -0
  70. data/lib/seltz_api/models/monitor_status2.rb +45 -0
  71. data/lib/seltz_api/models/payload.rb +74 -0
  72. data/lib/seltz_api/models/record.rb +116 -0
  73. data/lib/seltz_api/models/record_type.rb +26 -0
  74. data/lib/seltz_api/models/request_status.rb +36 -0
  75. data/lib/seltz_api/models/run.rb +200 -0
  76. data/lib/seltz_api/models/run_request.rb +127 -0
  77. data/lib/seltz_api/models/run_state.rb +40 -0
  78. data/lib/seltz_api/models/run_state2.rb +41 -0
  79. data/lib/seltz_api/models/run_status.rb +47 -0
  80. data/lib/seltz_api/models/schedule.rb +73 -0
  81. data/lib/seltz_api/models/search_record.rb +101 -0
  82. data/lib/seltz_api/models/search_request.rb +208 -0
  83. data/lib/seltz_api/models/search_request_ref.rb +87 -0
  84. data/lib/seltz_api/models/search_response.rb +85 -0
  85. data/lib/seltz_api/models/snippet.rb +76 -0
  86. data/lib/seltz_api/models/snippet_options.rb +151 -0
  87. data/lib/seltz_api/models/update_monitor_request.rb +153 -0
  88. data/lib/seltz_api/models/update_monitor_response.rb +77 -0
  89. data/lib/seltz_api/models/webhook.rb +113 -0
  90. data/lib/seltz_api/models/webhook1.rb +114 -0
  91. data/lib/seltz_api/utilities/date_time_helper.rb +11 -0
  92. data/lib/seltz_api/utilities/file_wrapper.rb +28 -0
  93. data/lib/seltz_api/utilities/union_type_lookup.rb +62 -0
  94. data/lib/seltz_api.rb +115 -0
  95. metadata +178 -0
@@ -0,0 +1,208 @@
1
+ # seltz_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SeltzApi
7
+ # SearchRequest Model.
8
+ class SearchRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # API key. On the HTTP surface, either this or the `x-api-key` header must
13
+ # be supplied; the header takes precedence.
14
+ # @return [String]
15
+ attr_accessor :api_key
16
+
17
+ # Exclude results from these domains
18
+ # @return [Array[String]]
19
+ attr_accessor :exclude_domains
20
+
21
+ # Exclude results from these domains
22
+ # @return [Fields2]
23
+ attr_accessor :fields
24
+
25
+ # Only include results published on or after this point. UTC throughout.
26
+ # A date "2025-10-28", a datetime "2025-10-28T23:00:00" or
27
+ # "2025-10-28T23:00:00Z", or an offset from "now", which is the time the
28
+ # request is served: "now" itself, or "now-" and one duration such as
29
+ # "now-7d" for the past week. A datetime written without a zone is read as
30
+ # UTC, and a date written without a time is the start of that day.
31
+ # Offset units are s = second, m = minute, h = hour, d = 24 h, w = 7 d,
32
+ # M = one calendar month and y = one calendar year. A unit and a count are
33
+ # both required, and the case carries meaning.
34
+ # A month and a year step the calendar rather than a fixed number of
35
+ # seconds, and the day of the month is clamped to the length of the target
36
+ # month. So "now-1M" from the 31st of March lands on the 28th or 29th of
37
+ # February.
38
+ # An offset is a filter, not a freshness guarantee: the corpus refreshes on
39
+ # its own cadence, so a window of an hour or two can return nothing.
40
+ # Only a single offset before "now" is accepted. Rounding, several terms in
41
+ # one value, a "+" offset, and any anchor other than "now" are rejected.
42
+ # @return [String]
43
+ attr_accessor :from_date
44
+
45
+ # Include only results from these domains (e.g., \["google.com",
46
+ # "example.com"\])
47
+ # @return [Array[String]]
48
+ attr_accessor :include_domains
49
+
50
+ # Maximum number of results to return. Defaults to 10. A larger value is
51
+ # served as 1000.
52
+ # @return [Integer]
53
+ attr_accessor :max_results
54
+
55
+ # The search query.
56
+ # @return [String]
57
+ attr_accessor :query
58
+
59
+ # Restricts the results to one vertical or data set.
60
+ # Currently available: "news", "wikipedia", "people", "companies".
61
+ # When omitted, the default scope is searched. A scope that does not exist,
62
+ # or that this key cannot reach, returns 404.
63
+ # @return [String]
64
+ attr_accessor :scope
65
+
66
+ # How much work goes into ordering the results. It does not change which
67
+ # corpus is searched -- that is `scope` -- so any scope can be requested in
68
+ # either tier.
69
+ # `"base"` returns first-stage ranking. `"pro"` adds a ranking stage for
70
+ # higher precision at the top of the list.
71
+ # Unset resolves to `"pro"`, so `"base"` is opt-out. A scope with no Pro
72
+ # configuration serves `"pro"` exactly as `"base"` rather than failing, so a
73
+ # caller may always ask for `"pro"`.
74
+ # The name is matched without regard to case, and surrounding whitespace is
75
+ # ignored, so "pro", "PRO" and " Pro " are one tier. A name that is neither
76
+ # is rejected rather than defaulted, because the value selects a price.
77
+ # @return [String]
78
+ attr_accessor :tier
79
+
80
+ # Only include results published on or before this point. UTC throughout.
81
+ # A date, a datetime, or an offset from "now", in the same spellings
82
+ # from_date takes. A date written without a time covers the whole of that
83
+ # day, ending at 23:59:59.999; an offset is an instant.
84
+ # @return [String]
85
+ attr_accessor :to_date
86
+
87
+ # A mapping from model property names to API property names.
88
+ def self.names
89
+ @_hash = {} if @_hash.nil?
90
+ @_hash['api_key'] = 'api_key'
91
+ @_hash['exclude_domains'] = 'exclude_domains'
92
+ @_hash['fields'] = 'fields'
93
+ @_hash['from_date'] = 'from_date'
94
+ @_hash['include_domains'] = 'include_domains'
95
+ @_hash['max_results'] = 'max_results'
96
+ @_hash['query'] = 'query'
97
+ @_hash['scope'] = 'scope'
98
+ @_hash['tier'] = 'tier'
99
+ @_hash['to_date'] = 'to_date'
100
+ @_hash
101
+ end
102
+
103
+ # An array for optional fields
104
+ def self.optionals
105
+ %w[
106
+ api_key
107
+ exclude_domains
108
+ fields
109
+ from_date
110
+ include_domains
111
+ max_results
112
+ query
113
+ scope
114
+ tier
115
+ to_date
116
+ ]
117
+ end
118
+
119
+ # An array for nullable fields
120
+ def self.nullables
121
+ %w[
122
+ api_key
123
+ fields
124
+ from_date
125
+ max_results
126
+ scope
127
+ tier
128
+ to_date
129
+ ]
130
+ end
131
+
132
+ def initialize(api_key: SKIP, exclude_domains:, fields: SKIP,
133
+ from_date: SKIP, include_domains:, max_results: SKIP,
134
+ query: SKIP, scope: SKIP, tier: SKIP, to_date: SKIP,
135
+ additional_properties: nil)
136
+ # Add additional model properties to the instance
137
+ additional_properties = {} if additional_properties.nil?
138
+
139
+ @api_key = api_key unless api_key == SKIP
140
+ @exclude_domains = exclude_domains unless exclude_domains == SKIP
141
+ @fields = fields unless fields == SKIP
142
+ @from_date = from_date unless from_date == SKIP
143
+ @include_domains = include_domains unless include_domains == SKIP
144
+ @max_results = max_results unless max_results == SKIP
145
+ @query = query unless query == SKIP
146
+ @scope = scope unless scope == SKIP
147
+ @tier = tier unless tier == SKIP
148
+ @to_date = to_date unless to_date == SKIP
149
+ @additional_properties = additional_properties
150
+ end
151
+
152
+ # Creates an instance of the object from a hash.
153
+ def self.from_hash(hash)
154
+ return nil unless hash
155
+
156
+ # Extract variables from the hash.
157
+ api_key = hash.key?('api_key') ? hash['api_key'] : SKIP
158
+ exclude_domains = hash['exclude_domains'] ||=
159
+ fields = Fields2.from_hash(hash['fields']) if hash['fields']
160
+ from_date = hash.key?('from_date') ? hash['from_date'] : SKIP
161
+ include_domains = hash['include_domains'] ||=
162
+ max_results = hash.key?('max_results') ? hash['max_results'] : SKIP
163
+ query = hash.key?('query') ? hash['query'] : SKIP
164
+ scope = hash.key?('scope') ? hash['scope'] : SKIP
165
+ tier = hash.key?('tier') ? hash['tier'] : SKIP
166
+ to_date = hash.key?('to_date') ? hash['to_date'] : SKIP
167
+
168
+ # Create a new hash for additional properties, removing known properties.
169
+ new_hash = hash.reject { |k, _| names.value?(k) }
170
+
171
+ additional_properties = APIHelper.get_additional_properties(
172
+ new_hash, proc { |value| value }
173
+ )
174
+
175
+ # Create object from extracted values.
176
+ SearchRequest.new(api_key: api_key,
177
+ exclude_domains: exclude_domains,
178
+ fields: fields,
179
+ from_date: from_date,
180
+ include_domains: include_domains,
181
+ max_results: max_results,
182
+ query: query,
183
+ scope: scope,
184
+ tier: tier,
185
+ to_date: to_date,
186
+ additional_properties: additional_properties)
187
+ end
188
+
189
+ # Provides a human-readable string representation of the object.
190
+ def to_s
191
+ class_name = self.class.name.split('::').last
192
+ "<#{class_name} api_key: #{@api_key}, exclude_domains: #{@exclude_domains}, fields:"\
193
+ " #{@fields}, from_date: #{@from_date}, include_domains: #{@include_domains}, max_results:"\
194
+ " #{@max_results}, query: #{@query}, scope: #{@scope}, tier: #{@tier}, to_date: #{@to_date},"\
195
+ " additional_properties: #{@additional_properties}>"
196
+ end
197
+
198
+ # Provides a debugging-friendly string with detailed object information.
199
+ def inspect
200
+ class_name = self.class.name.split('::').last
201
+ "<#{class_name} api_key: #{@api_key.inspect}, exclude_domains: #{@exclude_domains.inspect},"\
202
+ " fields: #{@fields.inspect}, from_date: #{@from_date.inspect}, include_domains:"\
203
+ " #{@include_domains.inspect}, max_results: #{@max_results.inspect}, query:"\
204
+ " #{@query.inspect}, scope: #{@scope.inspect}, tier: #{@tier.inspect}, to_date:"\
205
+ " #{@to_date.inspect}, additional_properties: #{@additional_properties}>"
206
+ end
207
+ end
208
+ end
@@ -0,0 +1,87 @@
1
+ # seltz_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SeltzApi
7
+ # SearchRequestRef Model.
8
+ class SearchRequestRef < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The request's query text, carried here so a record can be rendered without
13
+ # a second lookup.
14
+ # @return [String]
15
+ attr_accessor :query
16
+
17
+ # The request's query text, carried here so a record can be rendered without
18
+ # a second lookup.
19
+ # @return [String]
20
+ attr_accessor :request_id
21
+
22
+ # A mapping from model property names to API property names.
23
+ def self.names
24
+ @_hash = {} if @_hash.nil?
25
+ @_hash['query'] = 'query'
26
+ @_hash['request_id'] = 'request_id'
27
+ @_hash
28
+ end
29
+
30
+ # An array for optional fields
31
+ def self.optionals
32
+ %w[
33
+ query
34
+ request_id
35
+ ]
36
+ end
37
+
38
+ # An array for nullable fields
39
+ def self.nullables
40
+ []
41
+ end
42
+
43
+ def initialize(query: SKIP, request_id: SKIP, additional_properties: nil)
44
+ # Add additional model properties to the instance
45
+ additional_properties = {} if additional_properties.nil?
46
+
47
+ @query = query unless query == SKIP
48
+ @request_id = request_id unless request_id == SKIP
49
+ @additional_properties = additional_properties
50
+ end
51
+
52
+ # Creates an instance of the object from a hash.
53
+ def self.from_hash(hash)
54
+ return nil unless hash
55
+
56
+ # Extract variables from the hash.
57
+ query = hash.key?('query') ? hash['query'] : SKIP
58
+ request_id = hash.key?('request_id') ? hash['request_id'] : SKIP
59
+
60
+ # Create a new hash for additional properties, removing known properties.
61
+ new_hash = hash.reject { |k, _| names.value?(k) }
62
+
63
+ additional_properties = APIHelper.get_additional_properties(
64
+ new_hash, proc { |value| value }
65
+ )
66
+
67
+ # Create object from extracted values.
68
+ SearchRequestRef.new(query: query,
69
+ request_id: request_id,
70
+ additional_properties: additional_properties)
71
+ end
72
+
73
+ # Provides a human-readable string representation of the object.
74
+ def to_s
75
+ class_name = self.class.name.split('::').last
76
+ "<#{class_name} query: #{@query}, request_id: #{@request_id}, additional_properties:"\
77
+ " #{@additional_properties}>"
78
+ end
79
+
80
+ # Provides a debugging-friendly string with detailed object information.
81
+ def inspect
82
+ class_name = self.class.name.split('::').last
83
+ "<#{class_name} query: #{@query.inspect}, request_id: #{@request_id.inspect},"\
84
+ " additional_properties: #{@additional_properties}>"
85
+ end
86
+ end
87
+ end
@@ -0,0 +1,85 @@
1
+ # seltz_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SeltzApi
7
+ # SearchResponse Model.
8
+ class SearchResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Documents that are most relevant to the query
13
+ # @return [Array[Document]]
14
+ attr_accessor :documents
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['documents'] = 'documents'
20
+ @_hash
21
+ end
22
+
23
+ # An array for optional fields
24
+ def self.optionals
25
+ %w[
26
+ documents
27
+ ]
28
+ end
29
+
30
+ # An array for nullable fields
31
+ def self.nullables
32
+ []
33
+ end
34
+
35
+ def initialize(documents: SKIP, additional_properties: nil)
36
+ # Add additional model properties to the instance
37
+ additional_properties = {} if additional_properties.nil?
38
+
39
+ @documents = documents unless documents == SKIP
40
+ @additional_properties = additional_properties
41
+ end
42
+
43
+ # Creates an instance of the object from a hash.
44
+ def self.from_hash(hash)
45
+ return nil unless hash
46
+
47
+ # Extract variables from the hash.
48
+ # Parameter is an array, so we need to iterate through it
49
+ documents = nil
50
+ unless hash['documents'].nil?
51
+ documents = []
52
+ hash['documents'].each do |structure|
53
+ documents << (Document.from_hash(structure) if structure)
54
+ end
55
+ end
56
+
57
+ documents = SKIP unless hash.key?('documents')
58
+
59
+ # Create a new hash for additional properties, removing known properties.
60
+ new_hash = hash.reject { |k, _| names.value?(k) }
61
+
62
+ additional_properties = APIHelper.get_additional_properties(
63
+ new_hash, proc { |value| value }
64
+ )
65
+
66
+ # Create object from extracted values.
67
+ SearchResponse.new(documents: documents,
68
+ additional_properties: additional_properties)
69
+ end
70
+
71
+ # Provides a human-readable string representation of the object.
72
+ def to_s
73
+ class_name = self.class.name.split('::').last
74
+ "<#{class_name} documents: #{@documents}, additional_properties:"\
75
+ " #{@additional_properties}>"
76
+ end
77
+
78
+ # Provides a debugging-friendly string with detailed object information.
79
+ def inspect
80
+ class_name = self.class.name.split('::').last
81
+ "<#{class_name} documents: #{@documents.inspect}, additional_properties:"\
82
+ " #{@additional_properties}>"
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,76 @@
1
+ # seltz_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SeltzApi
7
+ # One passage selected from a document's body.
8
+ class Snippet < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :text
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['text'] = 'text'
20
+ @_hash
21
+ end
22
+
23
+ # An array for optional fields
24
+ def self.optionals
25
+ %w[
26
+ text
27
+ ]
28
+ end
29
+
30
+ # An array for nullable fields
31
+ def self.nullables
32
+ %w[
33
+ text
34
+ ]
35
+ end
36
+
37
+ def initialize(text: SKIP, additional_properties: nil)
38
+ # Add additional model properties to the instance
39
+ additional_properties = {} if additional_properties.nil?
40
+
41
+ @text = text unless text == SKIP
42
+ @additional_properties = additional_properties
43
+ end
44
+
45
+ # Creates an instance of the object from a hash.
46
+ def self.from_hash(hash)
47
+ return nil unless hash
48
+
49
+ # Extract variables from the hash.
50
+ text = hash.key?('text') ? hash['text'] : SKIP
51
+
52
+ # Create a new hash for additional properties, removing known properties.
53
+ new_hash = hash.reject { |k, _| names.value?(k) }
54
+
55
+ additional_properties = APIHelper.get_additional_properties(
56
+ new_hash, proc { |value| value }
57
+ )
58
+
59
+ # Create object from extracted values.
60
+ Snippet.new(text: text,
61
+ additional_properties: additional_properties)
62
+ end
63
+
64
+ # Provides a human-readable string representation of the object.
65
+ def to_s
66
+ class_name = self.class.name.split('::').last
67
+ "<#{class_name} text: #{@text}, additional_properties: #{@additional_properties}>"
68
+ end
69
+
70
+ # Provides a debugging-friendly string with detailed object information.
71
+ def inspect
72
+ class_name = self.class.name.split('::').last
73
+ "<#{class_name} text: #{@text.inspect}, additional_properties: #{@additional_properties}>"
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,151 @@
1
+ # seltz_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SeltzApi
7
+ # Tuning for snippet selection. Each option is an upper bound; the response
8
+ # carries at most what is specified here. The service may hold callers to a
9
+ # tighter bound than the ranges below. A larger request is then served at that
10
+ # bound rather than refused, which still carries at most what was specified.
11
+ # Only a value outside the range below is rejected.
12
+ class SnippetOptions < BaseModel
13
+ SKIP = Object.new
14
+ private_constant :SKIP
15
+
16
+ # Maximum snippets returned across all documents. Accepted range 1-512.
17
+ # No default. Left unset, no response-wide ceiling applies at all, which is
18
+ # the
19
+ # recommended setting: `max_snippets_per_result` already bounds every
20
+ # document, so the
21
+ # response is bounded without one.
22
+ # This budget is spent one snippet per document at a time, so every document
23
+ # gets its best
24
+ # snippet before any document gets a second. This value is potentially
25
+ # raised to ensure each
26
+ # document can be given at least one snippet.
27
+ # @return [Integer]
28
+ attr_accessor :max_snippets
29
+
30
+ # Maximum snippets from any single document.
31
+ # Defaults to 16, accepted range 1-256.
32
+ # @return [Integer]
33
+ attr_accessor :max_snippets_per_result
34
+
35
+ # Ceiling on tokens across all snippets in the response.
36
+ # Defaults to 8192, accepted range 512-65536.
37
+ # Spent in the same order as `max_snippets`, one snippet per document at a
38
+ # time, but unlike
39
+ # `max_snippets` this ceiling is not raised to fit `max_results`. Set it low
40
+ # against many
41
+ # results and the budget runs out partway through a round: the documents it
42
+ # does not reach
43
+ # are still returned, with no snippets at all. If every result needs a
44
+ # snippet, raise this
45
+ # or lower `max_results`.
46
+ # @return [Integer]
47
+ attr_accessor :max_tokens
48
+
49
+ # Ceiling on tokens of snippets from any single document.
50
+ # Defaults to 4096, accepted range 128-32768.
51
+ # @return [Integer]
52
+ attr_accessor :max_tokens_per_result
53
+
54
+ # A mapping from model property names to API property names.
55
+ def self.names
56
+ @_hash = {} if @_hash.nil?
57
+ @_hash['max_snippets'] = 'max_snippets'
58
+ @_hash['max_snippets_per_result'] = 'max_snippets_per_result'
59
+ @_hash['max_tokens'] = 'max_tokens'
60
+ @_hash['max_tokens_per_result'] = 'max_tokens_per_result'
61
+ @_hash
62
+ end
63
+
64
+ # An array for optional fields
65
+ def self.optionals
66
+ %w[
67
+ max_snippets
68
+ max_snippets_per_result
69
+ max_tokens
70
+ max_tokens_per_result
71
+ ]
72
+ end
73
+
74
+ # An array for nullable fields
75
+ def self.nullables
76
+ %w[
77
+ max_snippets
78
+ max_snippets_per_result
79
+ max_tokens
80
+ max_tokens_per_result
81
+ ]
82
+ end
83
+
84
+ def initialize(max_snippets: SKIP, max_snippets_per_result: SKIP,
85
+ max_tokens: SKIP, max_tokens_per_result: SKIP,
86
+ additional_properties: nil)
87
+ # Add additional model properties to the instance
88
+ additional_properties = {} if additional_properties.nil?
89
+
90
+ @max_snippets = max_snippets unless max_snippets == SKIP
91
+ @max_snippets_per_result = max_snippets_per_result unless max_snippets_per_result == SKIP
92
+ @max_tokens = max_tokens unless max_tokens == SKIP
93
+ @max_tokens_per_result = max_tokens_per_result unless max_tokens_per_result == SKIP
94
+ @additional_properties = additional_properties
95
+ end
96
+
97
+ # Creates an instance of the object from a hash.
98
+ def self.from_hash(hash)
99
+ return nil unless hash
100
+
101
+ # Extract variables from the hash.
102
+ max_snippets = hash.key?('max_snippets') ? hash['max_snippets'] : SKIP
103
+ max_snippets_per_result =
104
+ hash.key?('max_snippets_per_result') ? hash['max_snippets_per_result'] : SKIP
105
+ max_tokens = hash.key?('max_tokens') ? hash['max_tokens'] : SKIP
106
+ max_tokens_per_result =
107
+ hash.key?('max_tokens_per_result') ? hash['max_tokens_per_result'] : SKIP
108
+
109
+ # Create a new hash for additional properties, removing known properties.
110
+ new_hash = hash.reject { |k, _| names.value?(k) }
111
+
112
+ additional_properties = APIHelper.get_additional_properties(
113
+ new_hash, proc { |value| value }
114
+ )
115
+
116
+ # Create object from extracted values.
117
+ SnippetOptions.new(max_snippets: max_snippets,
118
+ max_snippets_per_result: max_snippets_per_result,
119
+ max_tokens: max_tokens,
120
+ max_tokens_per_result: max_tokens_per_result,
121
+ additional_properties: additional_properties)
122
+ end
123
+
124
+ # Validates an instance of the object from a given value.
125
+ # @param [SnippetOptions | Hash] The value against the validation is performed.
126
+ def self.validate(value)
127
+ return true if value.instance_of? self
128
+
129
+ return false unless value.instance_of? Hash
130
+
131
+ true
132
+ end
133
+
134
+ # Provides a human-readable string representation of the object.
135
+ def to_s
136
+ class_name = self.class.name.split('::').last
137
+ "<#{class_name} max_snippets: #{@max_snippets}, max_snippets_per_result:"\
138
+ " #{@max_snippets_per_result}, max_tokens: #{@max_tokens}, max_tokens_per_result:"\
139
+ " #{@max_tokens_per_result}, additional_properties: #{@additional_properties}>"
140
+ end
141
+
142
+ # Provides a debugging-friendly string with detailed object information.
143
+ def inspect
144
+ class_name = self.class.name.split('::').last
145
+ "<#{class_name} max_snippets: #{@max_snippets.inspect}, max_snippets_per_result:"\
146
+ " #{@max_snippets_per_result.inspect}, max_tokens: #{@max_tokens.inspect},"\
147
+ " max_tokens_per_result: #{@max_tokens_per_result.inspect}, additional_properties:"\
148
+ " #{@additional_properties}>"
149
+ end
150
+ end
151
+ end