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,100 @@
1
+ # seltz_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SeltzApi
7
+ # The request the run was created with.
8
+ class AgentRunRequest2 < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The effort level the run executes at: the request's `effort`, or the
13
+ # default level when it named none.
14
+ # @return [String]
15
+ attr_accessor :effort
16
+
17
+ # The request's `output_schema`, when one was given. On gRPC the object is
18
+ # JSON-encoded.
19
+ # @return [Object]
20
+ attr_accessor :output_schema
21
+
22
+ # The natural-language question.
23
+ # @return [String]
24
+ attr_accessor :query
25
+
26
+ # A mapping from model property names to API property names.
27
+ def self.names
28
+ @_hash = {} if @_hash.nil?
29
+ @_hash['effort'] = 'effort'
30
+ @_hash['output_schema'] = 'output_schema'
31
+ @_hash['query'] = 'query'
32
+ @_hash
33
+ end
34
+
35
+ # An array for optional fields
36
+ def self.optionals
37
+ %w[
38
+ effort
39
+ output_schema
40
+ query
41
+ ]
42
+ end
43
+
44
+ # An array for nullable fields
45
+ def self.nullables
46
+ %w[
47
+ effort
48
+ output_schema
49
+ ]
50
+ end
51
+
52
+ def initialize(effort: SKIP, output_schema: SKIP, query: SKIP,
53
+ additional_properties: nil)
54
+ # Add additional model properties to the instance
55
+ additional_properties = {} if additional_properties.nil?
56
+
57
+ @effort = effort unless effort == SKIP
58
+ @output_schema = output_schema unless output_schema == SKIP
59
+ @query = query unless query == SKIP
60
+ @additional_properties = additional_properties
61
+ end
62
+
63
+ # Creates an instance of the object from a hash.
64
+ def self.from_hash(hash)
65
+ return nil unless hash
66
+
67
+ # Extract variables from the hash.
68
+ effort = hash.key?('effort') ? hash['effort'] : SKIP
69
+ output_schema = hash.key?('output_schema') ? hash['output_schema'] : SKIP
70
+ query = hash.key?('query') ? hash['query'] : SKIP
71
+
72
+ # Create a new hash for additional properties, removing known properties.
73
+ new_hash = hash.reject { |k, _| names.value?(k) }
74
+
75
+ additional_properties = APIHelper.get_additional_properties(
76
+ new_hash, proc { |value| value }
77
+ )
78
+
79
+ # Create object from extracted values.
80
+ AgentRunRequest2.new(effort: effort,
81
+ output_schema: output_schema,
82
+ query: query,
83
+ additional_properties: additional_properties)
84
+ end
85
+
86
+ # Provides a human-readable string representation of the object.
87
+ def to_s
88
+ class_name = self.class.name.split('::').last
89
+ "<#{class_name} effort: #{@effort}, output_schema: #{@output_schema}, query: #{@query},"\
90
+ " additional_properties: #{@additional_properties}>"
91
+ end
92
+
93
+ # Provides a debugging-friendly string with detailed object information.
94
+ def inspect
95
+ class_name = self.class.name.split('::').last
96
+ "<#{class_name} effort: #{@effort.inspect}, output_schema: #{@output_schema.inspect},"\
97
+ " query: #{@query.inspect}, additional_properties: #{@additional_properties}>"
98
+ end
99
+ end
100
+ end
@@ -0,0 +1,86 @@
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 source a run cited.
8
+ class AgentRunSource < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Identifier within the run, cited as `\[id\]` in `text` and as `source_id`
13
+ # in `grounding`.
14
+ # @return [Integer]
15
+ attr_accessor :id
16
+
17
+ # URL of the source document.
18
+ # @return [String]
19
+ attr_accessor :url
20
+
21
+ # A mapping from model property names to API property names.
22
+ def self.names
23
+ @_hash = {} if @_hash.nil?
24
+ @_hash['id'] = 'id'
25
+ @_hash['url'] = 'url'
26
+ @_hash
27
+ end
28
+
29
+ # An array for optional fields
30
+ def self.optionals
31
+ %w[
32
+ id
33
+ url
34
+ ]
35
+ end
36
+
37
+ # An array for nullable fields
38
+ def self.nullables
39
+ []
40
+ end
41
+
42
+ def initialize(id: 0, url: SKIP, additional_properties: nil)
43
+ # Add additional model properties to the instance
44
+ additional_properties = {} if additional_properties.nil?
45
+
46
+ @id = id unless id == SKIP
47
+ @url = url unless url == SKIP
48
+ @additional_properties = additional_properties
49
+ end
50
+
51
+ # Creates an instance of the object from a hash.
52
+ def self.from_hash(hash)
53
+ return nil unless hash
54
+
55
+ # Extract variables from the hash.
56
+ id = hash['id'] ||= 0
57
+ url = hash.key?('url') ? hash['url'] : SKIP
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
+ AgentRunSource.new(id: id,
68
+ url: url,
69
+ additional_properties: additional_properties)
70
+ end
71
+
72
+ # Provides a human-readable string representation of the object.
73
+ def to_s
74
+ class_name = self.class.name.split('::').last
75
+ "<#{class_name} id: #{@id}, url: #{@url}, additional_properties:"\
76
+ " #{@additional_properties}>"
77
+ end
78
+
79
+ # Provides a debugging-friendly string with detailed object information.
80
+ def inspect
81
+ class_name = self.class.name.split('::').last
82
+ "<#{class_name} id: #{@id.inspect}, url: #{@url.inspect}, additional_properties:"\
83
+ " #{@additional_properties}>"
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,49 @@
1
+ # seltz_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SeltzApi
7
+ # Where a run is in its lifecycle: pending → running → completed / failed /
8
+ # cancelled.
9
+ class AgentRunStatus
10
+ AGENT_RUN_STATUS = [
11
+ # TODO: Write general description for PENDING
12
+ PENDING = 'pending'.freeze,
13
+
14
+ # TODO: Write general description for RUNNING
15
+ RUNNING = 'running'.freeze,
16
+
17
+ # TODO: Write general description for COMPLETED
18
+ COMPLETED = 'completed'.freeze,
19
+
20
+ # TODO: Write general description for FAILED
21
+ FAILED = 'failed'.freeze,
22
+
23
+ # TODO: Write general description for CANCELLED
24
+ CANCELLED = 'cancelled'.freeze
25
+ ].freeze
26
+
27
+ def self.validate(value)
28
+ return false if value.nil?
29
+
30
+ AGENT_RUN_STATUS.include?(value)
31
+ end
32
+
33
+ def self.from_value(value, default_value = PENDING)
34
+ return default_value if value.nil?
35
+
36
+ str = value.to_s.strip
37
+
38
+ case str.downcase
39
+ when 'pending' then PENDING
40
+ when 'running' then RUNNING
41
+ when 'completed' then COMPLETED
42
+ when 'failed' then FAILED
43
+ when 'cancelled' then CANCELLED
44
+ else
45
+ default_value
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,48 @@
1
+ # seltz_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SeltzApi
7
+ # Where the run is in its lifecycle.
8
+ class AgentRunStatus2
9
+ AGENT_RUN_STATUS2 = [
10
+ # TODO: Write general description for PENDING
11
+ PENDING = 'pending'.freeze,
12
+
13
+ # TODO: Write general description for RUNNING
14
+ RUNNING = 'running'.freeze,
15
+
16
+ # TODO: Write general description for COMPLETED
17
+ COMPLETED = 'completed'.freeze,
18
+
19
+ # TODO: Write general description for FAILED
20
+ FAILED = 'failed'.freeze,
21
+
22
+ # TODO: Write general description for CANCELLED
23
+ CANCELLED = 'cancelled'.freeze
24
+ ].freeze
25
+
26
+ def self.validate(value)
27
+ return false if value.nil?
28
+
29
+ AGENT_RUN_STATUS2.include?(value)
30
+ end
31
+
32
+ def self.from_value(value, default_value = PENDING)
33
+ return default_value if value.nil?
34
+
35
+ str = value.to_s.strip
36
+
37
+ case str.downcase
38
+ when 'pending' then PENDING
39
+ when 'running' then RUNNING
40
+ when 'completed' then COMPLETED
41
+ when 'failed' then FAILED
42
+ when 'cancelled' then CANCELLED
43
+ else
44
+ default_value
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,53 @@
1
+ # seltz_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SeltzApi
7
+ # Why a run stopped. `budget_reached` pairs with `completed` when the output
8
+ # so far is usable and with `failed` when it is not.
9
+ class AgentRunStopReason
10
+ AGENT_RUN_STOP_REASON = [
11
+ # TODO: Write general description for FINISHED
12
+ FINISHED = 'finished'.freeze,
13
+
14
+ # TODO: Write general description for BUDGET_REACHED
15
+ BUDGET_REACHED = 'budget_reached'.freeze,
16
+
17
+ # TODO: Write general description for TIMEOUT
18
+ TIMEOUT = 'timeout'.freeze,
19
+
20
+ # TODO: Write general description for CANCELLED
21
+ CANCELLED = 'cancelled'.freeze,
22
+
23
+ # TODO: Write general description for INVALID_OUTPUT
24
+ INVALID_OUTPUT = 'invalid_output'.freeze,
25
+
26
+ # TODO: Write general description for INTERNAL_ERROR
27
+ INTERNAL_ERROR = 'internal_error'.freeze
28
+ ].freeze
29
+
30
+ def self.validate(value)
31
+ return false if value.nil?
32
+
33
+ AGENT_RUN_STOP_REASON.include?(value)
34
+ end
35
+
36
+ def self.from_value(value, default_value = FINISHED)
37
+ return default_value if value.nil?
38
+
39
+ str = value.to_s.strip
40
+
41
+ case str.downcase
42
+ when 'finished' then FINISHED
43
+ when 'budget_reached' then BUDGET_REACHED
44
+ when 'timeout' then TIMEOUT
45
+ when 'cancelled' then CANCELLED
46
+ when 'invalid_output' then INVALID_OUTPUT
47
+ when 'internal_error' then INTERNAL_ERROR
48
+ else
49
+ default_value
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,52 @@
1
+ # seltz_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SeltzApi
7
+ # Why the run stopped. Set once the run reaches a terminal state.
8
+ class AgentRunStopReason2
9
+ AGENT_RUN_STOP_REASON2 = [
10
+ # TODO: Write general description for FINISHED
11
+ FINISHED = 'finished'.freeze,
12
+
13
+ # TODO: Write general description for BUDGET_REACHED
14
+ BUDGET_REACHED = 'budget_reached'.freeze,
15
+
16
+ # TODO: Write general description for TIMEOUT
17
+ TIMEOUT = 'timeout'.freeze,
18
+
19
+ # TODO: Write general description for CANCELLED
20
+ CANCELLED = 'cancelled'.freeze,
21
+
22
+ # TODO: Write general description for INVALID_OUTPUT
23
+ INVALID_OUTPUT = 'invalid_output'.freeze,
24
+
25
+ # TODO: Write general description for INTERNAL_ERROR
26
+ INTERNAL_ERROR = 'internal_error'.freeze
27
+ ].freeze
28
+
29
+ def self.validate(value)
30
+ return false if value.nil?
31
+
32
+ AGENT_RUN_STOP_REASON2.include?(value)
33
+ end
34
+
35
+ def self.from_value(value, default_value = FINISHED)
36
+ return default_value if value.nil?
37
+
38
+ str = value.to_s.strip
39
+
40
+ case str.downcase
41
+ when 'finished' then FINISHED
42
+ when 'budget_reached' then BUDGET_REACHED
43
+ when 'timeout' then TIMEOUT
44
+ when 'cancelled' then CANCELLED
45
+ when 'invalid_output' then INVALID_OUTPUT
46
+ when 'internal_error' then INTERNAL_ERROR
47
+ else
48
+ default_value
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,172 @@
1
+ # seltz_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SeltzApi
7
+ # JSON request body for `POST /v1/answer`.
8
+ class AnswerHttpRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # API key. Either this or the `x-api-key` header must be supplied;
13
+ # the header takes precedence.
14
+ # @return [String]
15
+ attr_accessor :api_key
16
+
17
+ # When true, citations carry the document content text. Default false.
18
+ # @return [TrueClass | FalseClass]
19
+ attr_accessor :include_content
20
+
21
+ # Selects the answer tier, which determines behavior and billing.
22
+ # Omitted resolves to the default tier. Independent of `scope`; the
23
+ # response shape is unchanged.
24
+ # @return [String]
25
+ attr_accessor :model
26
+
27
+ # The natural-language question.
28
+ # @return [String]
29
+ attr_accessor :query
30
+
31
+ # Optional `OpenAI` `response_format` object (`{"type": "text" |
32
+ # "json_object" | "json_schema", ...}`), accepted as raw JSON exactly
33
+ # like `/v1/chat/completions`. Under a structured type no inline
34
+ # citations are added, so the answer stays schema-valid; a malformed
35
+ # value is a `400` before billing. Omitted leaves the answer as Markdown
36
+ # prose.
37
+ # Applies at every tier.
38
+ # @return [Object]
39
+ attr_accessor :response_format
40
+
41
+ # Restricts the grounding search to one scope.
42
+ # Currently available:
43
+ # - `news`
44
+ # - `wikipedia`
45
+ # - `people`
46
+ # - `companies`
47
+ # Omitted, empty or whitespace-only searches the default scope.
48
+ # @return [String]
49
+ attr_accessor :scope
50
+
51
+ # When true, stream the answer as OpenAI-mimic SSE chunks. Default false.
52
+ # @return [TrueClass | FalseClass]
53
+ attr_accessor :stream
54
+
55
+ # Steers how the answer is presented — tone, voice, format. It is
56
+ # subordinate to the grounding and citation rules, which stay in force.
57
+ # That precedence is instructional, not a sandbox. Omitted, empty or
58
+ # whitespace-only leaves the presentation unchanged. Applies at every
59
+ # tier and composes with `response_format`. At most 8 KiB of UTF-8; a
60
+ # longer value is a `400` before billing.
61
+ # @return [String]
62
+ attr_accessor :system_prompt
63
+
64
+ # A mapping from model property names to API property names.
65
+ def self.names
66
+ @_hash = {} if @_hash.nil?
67
+ @_hash['api_key'] = 'api_key'
68
+ @_hash['include_content'] = 'include_content'
69
+ @_hash['model'] = 'model'
70
+ @_hash['query'] = 'query'
71
+ @_hash['response_format'] = 'response_format'
72
+ @_hash['scope'] = 'scope'
73
+ @_hash['stream'] = 'stream'
74
+ @_hash['system_prompt'] = 'system_prompt'
75
+ @_hash
76
+ end
77
+
78
+ # An array for optional fields
79
+ def self.optionals
80
+ %w[
81
+ api_key
82
+ include_content
83
+ model
84
+ response_format
85
+ scope
86
+ stream
87
+ system_prompt
88
+ ]
89
+ end
90
+
91
+ # An array for nullable fields
92
+ def self.nullables
93
+ %w[
94
+ api_key
95
+ model
96
+ scope
97
+ system_prompt
98
+ ]
99
+ end
100
+
101
+ def initialize(query:, api_key: SKIP, include_content: SKIP, model: SKIP,
102
+ response_format: SKIP, scope: SKIP, stream: SKIP,
103
+ system_prompt: SKIP, additional_properties: nil)
104
+ # Add additional model properties to the instance
105
+ additional_properties = {} if additional_properties.nil?
106
+
107
+ @api_key = api_key unless api_key == SKIP
108
+ @include_content = include_content unless include_content == SKIP
109
+ @model = model unless model == SKIP
110
+ @query = query
111
+ @response_format = response_format unless response_format == SKIP
112
+ @scope = scope unless scope == SKIP
113
+ @stream = stream unless stream == SKIP
114
+ @system_prompt = system_prompt unless system_prompt == SKIP
115
+ @additional_properties = additional_properties
116
+ end
117
+
118
+ # Creates an instance of the object from a hash.
119
+ def self.from_hash(hash)
120
+ return nil unless hash
121
+
122
+ # Extract variables from the hash.
123
+ query = hash.key?('query') ? hash['query'] : nil
124
+ api_key = hash.key?('api_key') ? hash['api_key'] : SKIP
125
+ include_content =
126
+ hash.key?('include_content') ? hash['include_content'] : SKIP
127
+ model = hash.key?('model') ? hash['model'] : SKIP
128
+ response_format =
129
+ hash.key?('response_format') ? hash['response_format'] : SKIP
130
+ scope = hash.key?('scope') ? hash['scope'] : SKIP
131
+ stream = hash.key?('stream') ? hash['stream'] : SKIP
132
+ system_prompt = hash.key?('system_prompt') ? hash['system_prompt'] : SKIP
133
+
134
+ # Create a new hash for additional properties, removing known properties.
135
+ new_hash = hash.reject { |k, _| names.value?(k) }
136
+
137
+ additional_properties = APIHelper.get_additional_properties(
138
+ new_hash, proc { |value| value }
139
+ )
140
+
141
+ # Create object from extracted values.
142
+ AnswerHttpRequest.new(query: query,
143
+ api_key: api_key,
144
+ include_content: include_content,
145
+ model: model,
146
+ response_format: response_format,
147
+ scope: scope,
148
+ stream: stream,
149
+ system_prompt: system_prompt,
150
+ additional_properties: additional_properties)
151
+ end
152
+
153
+ # Provides a human-readable string representation of the object.
154
+ def to_s
155
+ class_name = self.class.name.split('::').last
156
+ "<#{class_name} api_key: #{@api_key}, include_content: #{@include_content}, model:"\
157
+ " #{@model}, query: #{@query}, response_format: #{@response_format}, scope: #{@scope},"\
158
+ " stream: #{@stream}, system_prompt: #{@system_prompt}, additional_properties:"\
159
+ " #{@additional_properties}>"
160
+ end
161
+
162
+ # Provides a debugging-friendly string with detailed object information.
163
+ def inspect
164
+ class_name = self.class.name.split('::').last
165
+ "<#{class_name} api_key: #{@api_key.inspect}, include_content: #{@include_content.inspect},"\
166
+ " model: #{@model.inspect}, query: #{@query.inspect}, response_format:"\
167
+ " #{@response_format.inspect}, scope: #{@scope.inspect}, stream: #{@stream.inspect},"\
168
+ " system_prompt: #{@system_prompt.inspect}, additional_properties:"\
169
+ " #{@additional_properties}>"
170
+ end
171
+ end
172
+ end
@@ -0,0 +1,93 @@
1
+ # seltz_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module SeltzApi
7
+ # Buffered JSON response body for `POST /v1/answer`.
8
+ class AnswerHttpResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Markdown answer text. Inline citations follow the form
13
+ # `text ([Source Name](url))`.
14
+ # @return [String]
15
+ attr_accessor :answer
16
+
17
+ # The sources the answer was grounded in. Every source the answer was
18
+ # given is returned, whether or not the text cites it.
19
+ # @return [Array[HttpCitation]]
20
+ attr_accessor :citations
21
+
22
+ # A mapping from model property names to API property names.
23
+ def self.names
24
+ @_hash = {} if @_hash.nil?
25
+ @_hash['answer'] = 'answer'
26
+ @_hash['citations'] = 'citations'
27
+ @_hash
28
+ end
29
+
30
+ # An array for optional fields
31
+ def self.optionals
32
+ []
33
+ end
34
+
35
+ # An array for nullable fields
36
+ def self.nullables
37
+ []
38
+ end
39
+
40
+ def initialize(answer:, citations:, additional_properties: nil)
41
+ # Add additional model properties to the instance
42
+ additional_properties = {} if additional_properties.nil?
43
+
44
+ @answer = answer
45
+ @citations = citations
46
+ @additional_properties = additional_properties
47
+ end
48
+
49
+ # Creates an instance of the object from a hash.
50
+ def self.from_hash(hash)
51
+ return nil unless hash
52
+
53
+ # Extract variables from the hash.
54
+ answer = hash.key?('answer') ? hash['answer'] : nil
55
+ # Parameter is an array, so we need to iterate through it
56
+ citations = nil
57
+ unless hash['citations'].nil?
58
+ citations = []
59
+ hash['citations'].each do |structure|
60
+ citations << (HttpCitation.from_hash(structure) if structure)
61
+ end
62
+ end
63
+
64
+ citations = nil unless hash.key?('citations')
65
+
66
+ # Create a new hash for additional properties, removing known properties.
67
+ new_hash = hash.reject { |k, _| names.value?(k) }
68
+
69
+ additional_properties = APIHelper.get_additional_properties(
70
+ new_hash, proc { |value| value }
71
+ )
72
+
73
+ # Create object from extracted values.
74
+ AnswerHttpResponse.new(answer: answer,
75
+ citations: citations,
76
+ additional_properties: additional_properties)
77
+ end
78
+
79
+ # Provides a human-readable string representation of the object.
80
+ def to_s
81
+ class_name = self.class.name.split('::').last
82
+ "<#{class_name} answer: #{@answer}, citations: #{@citations}, additional_properties:"\
83
+ " #{@additional_properties}>"
84
+ end
85
+
86
+ # Provides a debugging-friendly string with detailed object information.
87
+ def inspect
88
+ class_name = self.class.name.split('::').last
89
+ "<#{class_name} answer: #{@answer.inspect}, citations: #{@citations.inspect},"\
90
+ " additional_properties: #{@additional_properties}>"
91
+ end
92
+ end
93
+ end