telnyx 5.100.0 → 5.102.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/README.md +1 -1
  4. data/lib/telnyx/models/ai/chat_create_completion_params.rb +36 -1
  5. data/lib/telnyx/models/ai/openai/chat_create_completion_params.rb +458 -0
  6. data/lib/telnyx/models/ai/openai/chat_create_completion_response.rb +12 -0
  7. data/lib/telnyx/models/ai/openai_list_models_params.rb +16 -0
  8. data/lib/telnyx/models/ai/openai_list_models_response.rb +52 -0
  9. data/lib/telnyx/resources/ai/chat.rb +9 -2
  10. data/lib/telnyx/resources/ai/openai/chat.rb +96 -0
  11. data/lib/telnyx/resources/ai/openai.rb +26 -0
  12. data/lib/telnyx/resources/ai.rb +7 -5
  13. data/lib/telnyx/resources/messaging_10dlc/brand/external_vetting.rb +5 -1
  14. data/lib/telnyx/version.rb +1 -1
  15. data/lib/telnyx.rb +5 -0
  16. data/rbi/telnyx/models/ai/chat_create_completion_params.rbi +58 -0
  17. data/rbi/telnyx/models/ai/openai/chat_create_completion_params.rbi +963 -0
  18. data/rbi/telnyx/models/ai/openai/chat_create_completion_response.rbi +15 -0
  19. data/rbi/telnyx/models/ai/openai_list_models_params.rbi +29 -0
  20. data/rbi/telnyx/models/ai/openai_list_models_response.rbi +96 -0
  21. data/rbi/telnyx/resources/ai/chat.rbi +11 -1
  22. data/rbi/telnyx/resources/ai/openai/chat.rbi +147 -0
  23. data/rbi/telnyx/resources/ai/openai.rbi +16 -0
  24. data/rbi/telnyx/resources/ai.rbi +5 -5
  25. data/rbi/telnyx/resources/messaging_10dlc/brand/external_vetting.rbi +5 -1
  26. data/sig/telnyx/models/ai/chat_create_completion_params.rbs +26 -0
  27. data/sig/telnyx/models/ai/openai/chat_create_completion_params.rbs +434 -0
  28. data/sig/telnyx/models/ai/openai/chat_create_completion_response.rbs +11 -0
  29. data/sig/telnyx/models/ai/openai_list_models_params.rbs +17 -0
  30. data/sig/telnyx/models/ai/openai_list_models_response.rbs +58 -0
  31. data/sig/telnyx/resources/ai/chat.rbs +2 -0
  32. data/sig/telnyx/resources/ai/openai/chat.rbs +41 -0
  33. data/sig/telnyx/resources/ai/openai.rbs +6 -0
  34. metadata +17 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f543aaa2a4a47c27cf247a82e0429a022bf94d6f58102f18b4cc50c7f9d9a1f4
4
- data.tar.gz: f1091cc87e194f413294bde65188a2908f1292396c5c72e569514994d9e719ea
3
+ metadata.gz: a3ac66f76ef028ca75bf4d57a3b9a108507b27fca075213e318cb7b69701b13c
4
+ data.tar.gz: '01193490b16b460e0a9666de198ca6c54ea3e62d62d531723ca4657d67cfb4a0'
5
5
  SHA512:
6
- metadata.gz: 75071192dfd36a1c38a93d98d681396c5c5016b9924c88de59a0a3ffe7cf90fe480e5cea5d1e17db3eb260d657009f79e248a4269d43974d0d8c21b6f54428c9
7
- data.tar.gz: 903ad16758edf55aae4d797807df0533d87acc9235e7ab08f388d9e2cfa6ea548807bd38305866bda07c418c1e9dd56e08ad1ffe1a4f25411ce05782fbd82831
6
+ metadata.gz: 1d3baa37bd7fba635b62f7733ccf23cd27b410e86e83845ffc70a52e315e98a7f479800ec669821b55fe2e8ff6ccc7bd6302659980f7d6a341ef7568629303b6
7
+ data.tar.gz: d782dc58f2a5ac6162983918f9bd0e488f54bec370bd4cad57122bf8a5e801fc31d071705211dbeed78cb9a8a6fdc64099ed09d5150cdbc89a53692c6e6ec073
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.102.0 (2026-05-07)
4
+
5
+ Full Changelog: [v5.101.0...v5.102.0](https://github.com/team-telnyx/telnyx-ruby/compare/v5.101.0...v5.102.0)
6
+
7
+ ### Features
8
+
9
+ * MSG-9000: document duplicate-vetting rejection on order brand external vetting ([8322fc0](https://github.com/team-telnyx/telnyx-ruby/commit/8322fc0a1681b8fd59897138082a176b1847d65b))
10
+
11
+ ## 5.101.0 (2026-05-07)
12
+
13
+ Full Changelog: [v5.100.0...v5.101.0](https://github.com/team-telnyx/telnyx-ruby/compare/v5.100.0...v5.101.0)
14
+
15
+ ### Features
16
+
17
+ * inference: expose chat completions and models under /ai/openai ([4711564](https://github.com/team-telnyx/telnyx-ruby/commit/47115648db8895fabe3913e086b23705c8a1851a))
18
+
3
19
  ## 5.100.0 (2026-05-06)
4
20
 
5
21
  Full Changelog: [v5.99.0...v5.100.0](https://github.com/team-telnyx/telnyx-ruby/compare/v5.99.0...v5.100.0)
data/README.md CHANGED
@@ -24,7 +24,7 @@ To use this gem, install via Bundler by adding the following to your application
24
24
  <!-- x-release-please-start-version -->
25
25
 
26
26
  ```ruby
27
- gem "telnyx", "~> 5.100.0"
27
+ gem "telnyx", "~> 5.102.0"
28
28
  ```
29
29
 
30
30
  <!-- x-release-please-end -->
@@ -125,6 +125,21 @@ module Telnyx
125
125
  # @return [Telnyx::Models::AI::ChatCreateCompletionParams::ResponseFormat, nil]
126
126
  optional :response_format, -> { Telnyx::AI::ChatCreateCompletionParams::ResponseFormat }
127
127
 
128
+ # @!attribute seed
129
+ # If specified, the system will make a best effort to sample deterministically,
130
+ # such that repeated requests with the same `seed` and parameters should return
131
+ # the same result.
132
+ #
133
+ # @return [Integer, nil]
134
+ optional :seed, Integer
135
+
136
+ # @!attribute stop
137
+ # Up to 4 sequences where the API will stop generating further tokens. The
138
+ # returned text will not contain the stop sequence.
139
+ #
140
+ # @return [String, Array<String>, nil]
141
+ optional :stop, union: -> { Telnyx::AI::ChatCreateCompletionParams::Stop }
142
+
128
143
  # @!attribute stream
129
144
  # Whether or not to stream data-only server-sent events as they become available.
130
145
  #
@@ -178,7 +193,7 @@ module Telnyx
178
193
  # @return [Boolean, nil]
179
194
  optional :use_beam_search, Telnyx::Internal::Type::Boolean
180
195
 
181
- # @!method initialize(messages:, api_key_ref: nil, best_of: nil, early_stopping: nil, enable_thinking: nil, frequency_penalty: nil, guided_choice: nil, guided_json: nil, guided_regex: nil, length_penalty: nil, logprobs: nil, max_tokens: nil, min_p: nil, model: nil, n: nil, presence_penalty: nil, response_format: nil, stream: nil, temperature: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, use_beam_search: nil, request_options: {})
196
+ # @!method initialize(messages:, api_key_ref: nil, best_of: nil, early_stopping: nil, enable_thinking: nil, frequency_penalty: nil, guided_choice: nil, guided_json: nil, guided_regex: nil, length_penalty: nil, logprobs: nil, max_tokens: nil, min_p: nil, model: nil, n: nil, presence_penalty: nil, response_format: nil, seed: nil, stop: nil, stream: nil, temperature: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, use_beam_search: nil, request_options: {})
182
197
  # Some parameter documentations has been truncated, see
183
198
  # {Telnyx::Models::AI::ChatCreateCompletionParams} for more details.
184
199
  #
@@ -216,6 +231,10 @@ module Telnyx
216
231
  #
217
232
  # @param response_format [Telnyx::Models::AI::ChatCreateCompletionParams::ResponseFormat] Use this is you want to guarantee a JSON output without defining a schema. For c
218
233
  #
234
+ # @param seed [Integer] If specified, the system will make a best effort to sample deterministically, su
235
+ #
236
+ # @param stop [String, Array<String>] Up to 4 sequences where the API will stop generating further tokens. The returne
237
+ #
219
238
  # @param stream [Boolean] Whether or not to stream data-only server-sent events as they become available.
220
239
  #
221
240
  # @param temperature [Float] Adjusts the "creativity" of the model. Lower values make the model more determin
@@ -337,6 +356,22 @@ module Telnyx
337
356
  end
338
357
  end
339
358
 
359
+ # Up to 4 sequences where the API will stop generating further tokens. The
360
+ # returned text will not contain the stop sequence.
361
+ module Stop
362
+ extend Telnyx::Internal::Type::Union
363
+
364
+ variant String
365
+
366
+ variant -> { Telnyx::Models::AI::ChatCreateCompletionParams::Stop::StringArray }
367
+
368
+ # @!method self.variants
369
+ # @return [Array(String, Array<String>)]
370
+
371
+ # @type [Telnyx::Internal::Type::Converter]
372
+ StringArray = Telnyx::Internal::Type::ArrayOf[String]
373
+ end
374
+
340
375
  module ToolChoice
341
376
  extend Telnyx::Internal::Type::Enum
342
377
 
@@ -0,0 +1,458 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telnyx
4
+ module Models
5
+ module AI
6
+ module OpenAI
7
+ # @see Telnyx::Resources::AI::OpenAI::Chat#create_completion
8
+ class ChatCreateCompletionParams < Telnyx::Internal::Type::BaseModel
9
+ extend Telnyx::Internal::Type::RequestParameters::Converter
10
+ include Telnyx::Internal::Type::RequestParameters
11
+
12
+ # @!attribute messages
13
+ # A list of the previous chat messages for context.
14
+ #
15
+ # @return [Array<Telnyx::Models::AI::OpenAI::ChatCreateCompletionParams::Message>]
16
+ required :messages,
17
+ -> { Telnyx::Internal::Type::ArrayOf[Telnyx::AI::OpenAI::ChatCreateCompletionParams::Message] }
18
+
19
+ # @!attribute api_key_ref
20
+ # If you are using an external inference provider like xAI or OpenAI, this field
21
+ # allows you to pass along a reference to your API key. After creating an
22
+ # [integration secret](https://developers.telnyx.com/api-reference/integration-secrets/create-a-secret)
23
+ # for you API key, pass the secret's `identifier` in this field.
24
+ #
25
+ # @return [String, nil]
26
+ optional :api_key_ref, String
27
+
28
+ # @!attribute best_of
29
+ # This is used with `use_beam_search` to determine how many candidate beams to
30
+ # explore.
31
+ #
32
+ # @return [Integer, nil]
33
+ optional :best_of, Integer
34
+
35
+ # @!attribute early_stopping
36
+ # This is used with `use_beam_search`. If `true`, generation stops as soon as
37
+ # there are `best_of` complete candidates; if `false`, a heuristic is applied and
38
+ # the generation stops when is it very unlikely to find better candidates.
39
+ #
40
+ # @return [Boolean, nil]
41
+ optional :early_stopping, Telnyx::Internal::Type::Boolean
42
+
43
+ # @!attribute enable_thinking
44
+ # Whether to enable the thinking/reasoning phase for models that support it (e.g.,
45
+ # QwQ, Qwen3). When set to false, the model will skip the internal reasoning step
46
+ # and respond directly, which can reduce latency. Defaults to true.
47
+ #
48
+ # @return [Boolean, nil]
49
+ optional :enable_thinking, Telnyx::Internal::Type::Boolean
50
+
51
+ # @!attribute frequency_penalty
52
+ # Higher values will penalize the model from repeating the same output tokens.
53
+ #
54
+ # @return [Float, nil]
55
+ optional :frequency_penalty, Float
56
+
57
+ # @!attribute guided_choice
58
+ # If specified, the output will be exactly one of the choices.
59
+ #
60
+ # @return [Array<String>, nil]
61
+ optional :guided_choice, Telnyx::Internal::Type::ArrayOf[String]
62
+
63
+ # @!attribute guided_json
64
+ # Must be a valid JSON schema. If specified, the output will follow the JSON
65
+ # schema.
66
+ #
67
+ # @return [Hash{Symbol=>Object}, nil]
68
+ optional :guided_json, Telnyx::Internal::Type::HashOf[Telnyx::Internal::Type::Unknown]
69
+
70
+ # @!attribute guided_regex
71
+ # If specified, the output will follow the regex pattern.
72
+ #
73
+ # @return [String, nil]
74
+ optional :guided_regex, String
75
+
76
+ # @!attribute length_penalty
77
+ # This is used with `use_beam_search` to prefer shorter or longer completions.
78
+ #
79
+ # @return [Float, nil]
80
+ optional :length_penalty, Float
81
+
82
+ # @!attribute logprobs
83
+ # Whether to return log probabilities of the output tokens or not. If true,
84
+ # returns the log probabilities of each output token returned in the `content` of
85
+ # `message`.
86
+ #
87
+ # @return [Boolean, nil]
88
+ optional :logprobs, Telnyx::Internal::Type::Boolean
89
+
90
+ # @!attribute max_tokens
91
+ # Maximum number of completion tokens the model should generate.
92
+ #
93
+ # @return [Integer, nil]
94
+ optional :max_tokens, Integer
95
+
96
+ # @!attribute min_p
97
+ # This is an alternative to `top_p` that
98
+ # [many prefer](https://github.com/huggingface/transformers/issues/27670). Must be
99
+ # in [0, 1].
100
+ #
101
+ # @return [Float, nil]
102
+ optional :min_p, Float
103
+
104
+ # @!attribute model
105
+ # The language model to chat with.
106
+ #
107
+ # @return [String, nil]
108
+ optional :model, String
109
+
110
+ # @!attribute n
111
+ # This will return multiple choices for you instead of a single chat completion.
112
+ #
113
+ # @return [Float, nil]
114
+ optional :n, Float
115
+
116
+ # @!attribute presence_penalty
117
+ # Higher values will penalize the model from repeating the same output tokens.
118
+ #
119
+ # @return [Float, nil]
120
+ optional :presence_penalty, Float
121
+
122
+ # @!attribute response_format
123
+ # Use this is you want to guarantee a JSON output without defining a schema. For
124
+ # control over the schema, use `guided_json`.
125
+ #
126
+ # @return [Telnyx::Models::AI::OpenAI::ChatCreateCompletionParams::ResponseFormat, nil]
127
+ optional :response_format, -> { Telnyx::AI::OpenAI::ChatCreateCompletionParams::ResponseFormat }
128
+
129
+ # @!attribute seed
130
+ # If specified, the system will make a best effort to sample deterministically,
131
+ # such that repeated requests with the same `seed` and parameters should return
132
+ # the same result.
133
+ #
134
+ # @return [Integer, nil]
135
+ optional :seed, Integer
136
+
137
+ # @!attribute stop
138
+ # Up to 4 sequences where the API will stop generating further tokens. The
139
+ # returned text will not contain the stop sequence.
140
+ #
141
+ # @return [String, Array<String>, nil]
142
+ optional :stop, union: -> { Telnyx::AI::OpenAI::ChatCreateCompletionParams::Stop }
143
+
144
+ # @!attribute stream
145
+ # Whether or not to stream data-only server-sent events as they become available.
146
+ #
147
+ # @return [Boolean, nil]
148
+ optional :stream, Telnyx::Internal::Type::Boolean
149
+
150
+ # @!attribute temperature
151
+ # Adjusts the "creativity" of the model. Lower values make the model more
152
+ # deterministic and repetitive, while higher values make the model more random and
153
+ # creative.
154
+ #
155
+ # @return [Float, nil]
156
+ optional :temperature, Float
157
+
158
+ # @!attribute tool_choice
159
+ #
160
+ # @return [Symbol, Telnyx::Models::AI::OpenAI::ChatCreateCompletionParams::ToolChoice, nil]
161
+ optional :tool_choice, enum: -> { Telnyx::AI::OpenAI::ChatCreateCompletionParams::ToolChoice }
162
+
163
+ # @!attribute tools
164
+ # The `function` tool type follows the same schema as the
165
+ # [OpenAI Chat Completions API](https://platform.openai.com/docs/api-reference/chat).
166
+ # The `retrieval` tool type is unique to Telnyx. You may pass a list of
167
+ # [embedded storage buckets](https://developers.telnyx.com/api-reference/embeddings/embed-documents)
168
+ # for retrieval-augmented generation.
169
+ #
170
+ # @return [Array<Telnyx::Models::AI::OpenAI::ChatCreateCompletionParams::Tool::Function, Telnyx::Models::AI::OpenAI::ChatCreateCompletionParams::Tool::Retrieval>, nil]
171
+ optional :tools,
172
+ -> { Telnyx::Internal::Type::ArrayOf[union: Telnyx::AI::OpenAI::ChatCreateCompletionParams::Tool] }
173
+
174
+ # @!attribute top_logprobs
175
+ # This is used with `logprobs`. An integer between 0 and 20 specifying the number
176
+ # of most likely tokens to return at each token position, each with an associated
177
+ # log probability.
178
+ #
179
+ # @return [Integer, nil]
180
+ optional :top_logprobs, Integer
181
+
182
+ # @!attribute top_p
183
+ # An alternative or complement to `temperature`. This adjusts how many of the top
184
+ # possibilities to consider.
185
+ #
186
+ # @return [Float, nil]
187
+ optional :top_p, Float
188
+
189
+ # @!attribute use_beam_search
190
+ # Setting this to `true` will allow the model to
191
+ # [explore more completion options](https://huggingface.co/blog/how-to-generate#beam-search).
192
+ # This is not supported by OpenAI.
193
+ #
194
+ # @return [Boolean, nil]
195
+ optional :use_beam_search, Telnyx::Internal::Type::Boolean
196
+
197
+ # @!method initialize(messages:, api_key_ref: nil, best_of: nil, early_stopping: nil, enable_thinking: nil, frequency_penalty: nil, guided_choice: nil, guided_json: nil, guided_regex: nil, length_penalty: nil, logprobs: nil, max_tokens: nil, min_p: nil, model: nil, n: nil, presence_penalty: nil, response_format: nil, seed: nil, stop: nil, stream: nil, temperature: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, use_beam_search: nil, request_options: {})
198
+ # Some parameter documentations has been truncated, see
199
+ # {Telnyx::Models::AI::OpenAI::ChatCreateCompletionParams} for more details.
200
+ #
201
+ # @param messages [Array<Telnyx::Models::AI::OpenAI::ChatCreateCompletionParams::Message>] A list of the previous chat messages for context.
202
+ #
203
+ # @param api_key_ref [String] If you are using an external inference provider like xAI or OpenAI, this field a
204
+ #
205
+ # @param best_of [Integer] This is used with `use_beam_search` to determine how many candidate beams to exp
206
+ #
207
+ # @param early_stopping [Boolean] This is used with `use_beam_search`. If `true`, generation stops as soon as ther
208
+ #
209
+ # @param enable_thinking [Boolean] Whether to enable the thinking/reasoning phase for models that support it (e.g.,
210
+ #
211
+ # @param frequency_penalty [Float] Higher values will penalize the model from repeating the same output tokens.
212
+ #
213
+ # @param guided_choice [Array<String>] If specified, the output will be exactly one of the choices.
214
+ #
215
+ # @param guided_json [Hash{Symbol=>Object}] Must be a valid JSON schema. If specified, the output will follow the JSON schem
216
+ #
217
+ # @param guided_regex [String] If specified, the output will follow the regex pattern.
218
+ #
219
+ # @param length_penalty [Float] This is used with `use_beam_search` to prefer shorter or longer completions.
220
+ #
221
+ # @param logprobs [Boolean] Whether to return log probabilities of the output tokens or not. If true, return
222
+ #
223
+ # @param max_tokens [Integer] Maximum number of completion tokens the model should generate.
224
+ #
225
+ # @param min_p [Float] This is an alternative to `top_p` that [many prefer](https://github.com/huggingf
226
+ #
227
+ # @param model [String] The language model to chat with.
228
+ #
229
+ # @param n [Float] This will return multiple choices for you instead of a single chat completion.
230
+ #
231
+ # @param presence_penalty [Float] Higher values will penalize the model from repeating the same output tokens.
232
+ #
233
+ # @param response_format [Telnyx::Models::AI::OpenAI::ChatCreateCompletionParams::ResponseFormat] Use this is you want to guarantee a JSON output without defining a schema. For c
234
+ #
235
+ # @param seed [Integer] If specified, the system will make a best effort to sample deterministically, su
236
+ #
237
+ # @param stop [String, Array<String>] Up to 4 sequences where the API will stop generating further tokens. The returne
238
+ #
239
+ # @param stream [Boolean] Whether or not to stream data-only server-sent events as they become available.
240
+ #
241
+ # @param temperature [Float] Adjusts the "creativity" of the model. Lower values make the model more determin
242
+ #
243
+ # @param tool_choice [Symbol, Telnyx::Models::AI::OpenAI::ChatCreateCompletionParams::ToolChoice]
244
+ #
245
+ # @param tools [Array<Telnyx::Models::AI::OpenAI::ChatCreateCompletionParams::Tool::Function, Telnyx::Models::AI::OpenAI::ChatCreateCompletionParams::Tool::Retrieval>] The `function` tool type follows the same schema as the [OpenAI Chat Completions
246
+ #
247
+ # @param top_logprobs [Integer] This is used with `logprobs`. An integer between 0 and 20 specifying the number
248
+ #
249
+ # @param top_p [Float] An alternative or complement to `temperature`. This adjusts how many of the top
250
+ #
251
+ # @param use_beam_search [Boolean] Setting this to `true` will allow the model to [explore more completion options]
252
+ #
253
+ # @param request_options [Telnyx::RequestOptions, Hash{Symbol=>Object}]
254
+
255
+ class Message < Telnyx::Internal::Type::BaseModel
256
+ # @!attribute content
257
+ #
258
+ # @return [String, Array<Telnyx::Models::AI::OpenAI::ChatCreateCompletionParams::Message::Content::TextAndImageArray>]
259
+ required :content, union: -> { Telnyx::AI::OpenAI::ChatCreateCompletionParams::Message::Content }
260
+
261
+ # @!attribute role
262
+ #
263
+ # @return [Symbol, Telnyx::Models::AI::OpenAI::ChatCreateCompletionParams::Message::Role]
264
+ required :role, enum: -> { Telnyx::AI::OpenAI::ChatCreateCompletionParams::Message::Role }
265
+
266
+ # @!method initialize(content:, role:)
267
+ # @param content [String, Array<Telnyx::Models::AI::OpenAI::ChatCreateCompletionParams::Message::Content::TextAndImageArray>]
268
+ # @param role [Symbol, Telnyx::Models::AI::OpenAI::ChatCreateCompletionParams::Message::Role]
269
+
270
+ # @see Telnyx::Models::AI::OpenAI::ChatCreateCompletionParams::Message#content
271
+ module Content
272
+ extend Telnyx::Internal::Type::Union
273
+
274
+ variant String
275
+
276
+ variant -> { Telnyx::Models::AI::OpenAI::ChatCreateCompletionParams::Message::Content::TextAndImage2DArray }
277
+
278
+ class TextAndImageArray < Telnyx::Internal::Type::BaseModel
279
+ # @!attribute type
280
+ #
281
+ # @return [Symbol, Telnyx::Models::AI::OpenAI::ChatCreateCompletionParams::Message::Content::TextAndImageArray::Type]
282
+ required :type,
283
+ enum: -> { Telnyx::AI::OpenAI::ChatCreateCompletionParams::Message::Content::TextAndImageArray::Type }
284
+
285
+ # @!attribute image_url
286
+ #
287
+ # @return [String, nil]
288
+ optional :image_url, String
289
+
290
+ # @!attribute text
291
+ #
292
+ # @return [String, nil]
293
+ optional :text, String
294
+
295
+ # @!method initialize(type:, image_url: nil, text: nil)
296
+ # @param type [Symbol, Telnyx::Models::AI::OpenAI::ChatCreateCompletionParams::Message::Content::TextAndImageArray::Type]
297
+ # @param image_url [String]
298
+ # @param text [String]
299
+
300
+ # @see Telnyx::Models::AI::OpenAI::ChatCreateCompletionParams::Message::Content::TextAndImageArray#type
301
+ module Type
302
+ extend Telnyx::Internal::Type::Enum
303
+
304
+ TEXT = :text
305
+ IMAGE_URL = :image_url
306
+
307
+ # @!method self.values
308
+ # @return [Array<Symbol>]
309
+ end
310
+ end
311
+
312
+ # @!method self.variants
313
+ # @return [Array(String, Array<Telnyx::Models::AI::OpenAI::ChatCreateCompletionParams::Message::Content::TextAndImageArray>)]
314
+
315
+ # @type [Telnyx::Internal::Type::Converter]
316
+ TextAndImage2DArray =
317
+ Telnyx::Internal::Type::ArrayOf[-> {
318
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Message::Content::TextAndImageArray
319
+ }]
320
+ end
321
+
322
+ # @see Telnyx::Models::AI::OpenAI::ChatCreateCompletionParams::Message#role
323
+ module Role
324
+ extend Telnyx::Internal::Type::Enum
325
+
326
+ SYSTEM = :system
327
+ USER = :user
328
+ ASSISTANT = :assistant
329
+ TOOL = :tool
330
+
331
+ # @!method self.values
332
+ # @return [Array<Symbol>]
333
+ end
334
+ end
335
+
336
+ class ResponseFormat < Telnyx::Internal::Type::BaseModel
337
+ # @!attribute type
338
+ #
339
+ # @return [Symbol, Telnyx::Models::AI::OpenAI::ChatCreateCompletionParams::ResponseFormat::Type]
340
+ required :type, enum: -> { Telnyx::AI::OpenAI::ChatCreateCompletionParams::ResponseFormat::Type }
341
+
342
+ # @!method initialize(type:)
343
+ # Use this is you want to guarantee a JSON output without defining a schema. For
344
+ # control over the schema, use `guided_json`.
345
+ #
346
+ # @param type [Symbol, Telnyx::Models::AI::OpenAI::ChatCreateCompletionParams::ResponseFormat::Type]
347
+
348
+ # @see Telnyx::Models::AI::OpenAI::ChatCreateCompletionParams::ResponseFormat#type
349
+ module Type
350
+ extend Telnyx::Internal::Type::Enum
351
+
352
+ TEXT = :text
353
+ JSON_OBJECT = :json_object
354
+
355
+ # @!method self.values
356
+ # @return [Array<Symbol>]
357
+ end
358
+ end
359
+
360
+ # Up to 4 sequences where the API will stop generating further tokens. The
361
+ # returned text will not contain the stop sequence.
362
+ module Stop
363
+ extend Telnyx::Internal::Type::Union
364
+
365
+ variant String
366
+
367
+ variant -> { Telnyx::Models::AI::OpenAI::ChatCreateCompletionParams::Stop::StringArray }
368
+
369
+ # @!method self.variants
370
+ # @return [Array(String, Array<String>)]
371
+
372
+ # @type [Telnyx::Internal::Type::Converter]
373
+ StringArray = Telnyx::Internal::Type::ArrayOf[String]
374
+ end
375
+
376
+ module ToolChoice
377
+ extend Telnyx::Internal::Type::Enum
378
+
379
+ NONE = :none
380
+ AUTO = :auto
381
+ REQUIRED = :required
382
+
383
+ # @!method self.values
384
+ # @return [Array<Symbol>]
385
+ end
386
+
387
+ module Tool
388
+ extend Telnyx::Internal::Type::Union
389
+
390
+ discriminator :type
391
+
392
+ variant :function, -> { Telnyx::AI::OpenAI::ChatCreateCompletionParams::Tool::Function }
393
+
394
+ variant :retrieval, -> { Telnyx::AI::OpenAI::ChatCreateCompletionParams::Tool::Retrieval }
395
+
396
+ class Function < Telnyx::Internal::Type::BaseModel
397
+ # @!attribute function
398
+ #
399
+ # @return [Telnyx::Models::AI::OpenAI::ChatCreateCompletionParams::Tool::Function::Function]
400
+ required :function, -> { Telnyx::AI::OpenAI::ChatCreateCompletionParams::Tool::Function::Function }
401
+
402
+ # @!attribute type
403
+ #
404
+ # @return [Symbol, :function]
405
+ required :type, const: :function
406
+
407
+ # @!method initialize(function:, type: :function)
408
+ # @param function [Telnyx::Models::AI::OpenAI::ChatCreateCompletionParams::Tool::Function::Function]
409
+ # @param type [Symbol, :function]
410
+
411
+ # @see Telnyx::Models::AI::OpenAI::ChatCreateCompletionParams::Tool::Function#function
412
+ class Function < Telnyx::Internal::Type::BaseModel
413
+ # @!attribute name
414
+ #
415
+ # @return [String]
416
+ required :name, String
417
+
418
+ # @!attribute description
419
+ #
420
+ # @return [String, nil]
421
+ optional :description, String
422
+
423
+ # @!attribute parameters
424
+ #
425
+ # @return [Hash{Symbol=>Object}, nil]
426
+ optional :parameters, Telnyx::Internal::Type::HashOf[Telnyx::Internal::Type::Unknown]
427
+
428
+ # @!method initialize(name:, description: nil, parameters: nil)
429
+ # @param name [String]
430
+ # @param description [String]
431
+ # @param parameters [Hash{Symbol=>Object}]
432
+ end
433
+ end
434
+
435
+ class Retrieval < Telnyx::Internal::Type::BaseModel
436
+ # @!attribute retrieval
437
+ #
438
+ # @return [Telnyx::Models::AI::BucketIDs]
439
+ required :retrieval, -> { Telnyx::AI::BucketIDs }
440
+
441
+ # @!attribute type
442
+ #
443
+ # @return [Symbol, :retrieval]
444
+ required :type, const: :retrieval
445
+
446
+ # @!method initialize(retrieval:, type: :retrieval)
447
+ # @param retrieval [Telnyx::Models::AI::BucketIDs]
448
+ # @param type [Symbol, :retrieval]
449
+ end
450
+
451
+ # @!method self.variants
452
+ # @return [Array(Telnyx::Models::AI::OpenAI::ChatCreateCompletionParams::Tool::Function, Telnyx::Models::AI::OpenAI::ChatCreateCompletionParams::Tool::Retrieval)]
453
+ end
454
+ end
455
+ end
456
+ end
457
+ end
458
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telnyx
4
+ module Models
5
+ module AI
6
+ module OpenAI
7
+ # @type [Telnyx::Internal::Type::Converter]
8
+ ChatCreateCompletionResponse = Telnyx::Internal::Type::HashOf[Telnyx::Internal::Type::Unknown]
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telnyx
4
+ module Models
5
+ module AI
6
+ # @see Telnyx::Resources::AI::OpenAI#list_models
7
+ class OpenAIListModelsParams < Telnyx::Internal::Type::BaseModel
8
+ extend Telnyx::Internal::Type::RequestParameters::Converter
9
+ include Telnyx::Internal::Type::RequestParameters
10
+
11
+ # @!method initialize(request_options: {})
12
+ # @param request_options [Telnyx::RequestOptions, Hash{Symbol=>Object}]
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telnyx
4
+ module Models
5
+ module AI
6
+ # @see Telnyx::Resources::AI::OpenAI#list_models
7
+ class OpenAIListModelsResponse < Telnyx::Internal::Type::BaseModel
8
+ # @!attribute data
9
+ #
10
+ # @return [Array<Telnyx::Models::AI::OpenAIListModelsResponse::Data>]
11
+ required :data, -> { Telnyx::Internal::Type::ArrayOf[Telnyx::Models::AI::OpenAIListModelsResponse::Data] }
12
+
13
+ # @!attribute object
14
+ #
15
+ # @return [String, nil]
16
+ optional :object, String
17
+
18
+ # @!method initialize(data:, object: nil)
19
+ # @param data [Array<Telnyx::Models::AI::OpenAIListModelsResponse::Data>]
20
+ # @param object [String]
21
+
22
+ class Data < Telnyx::Internal::Type::BaseModel
23
+ # @!attribute id
24
+ #
25
+ # @return [String]
26
+ required :id, String
27
+
28
+ # @!attribute created
29
+ #
30
+ # @return [Integer]
31
+ required :created, Integer
32
+
33
+ # @!attribute owned_by
34
+ #
35
+ # @return [String]
36
+ required :owned_by, String
37
+
38
+ # @!attribute object
39
+ #
40
+ # @return [String, nil]
41
+ optional :object, String
42
+
43
+ # @!method initialize(id:, created:, owned_by:, object: nil)
44
+ # @param id [String]
45
+ # @param created [Integer]
46
+ # @param owned_by [String]
47
+ # @param object [String]
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end