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
@@ -0,0 +1,963 @@
1
+ # typed: strong
2
+
3
+ module Telnyx
4
+ module Models
5
+ module AI
6
+ module OpenAI
7
+ class ChatCreateCompletionParams < Telnyx::Internal::Type::BaseModel
8
+ extend Telnyx::Internal::Type::RequestParameters::Converter
9
+ include Telnyx::Internal::Type::RequestParameters
10
+
11
+ OrHash =
12
+ T.type_alias do
13
+ T.any(
14
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams,
15
+ Telnyx::Internal::AnyHash
16
+ )
17
+ end
18
+
19
+ # A list of the previous chat messages for context.
20
+ sig do
21
+ returns(
22
+ T::Array[Telnyx::AI::OpenAI::ChatCreateCompletionParams::Message]
23
+ )
24
+ end
25
+ attr_accessor :messages
26
+
27
+ # If you are using an external inference provider like xAI or OpenAI, this field
28
+ # allows you to pass along a reference to your API key. After creating an
29
+ # [integration secret](https://developers.telnyx.com/api-reference/integration-secrets/create-a-secret)
30
+ # for you API key, pass the secret's `identifier` in this field.
31
+ sig { returns(T.nilable(String)) }
32
+ attr_reader :api_key_ref
33
+
34
+ sig { params(api_key_ref: String).void }
35
+ attr_writer :api_key_ref
36
+
37
+ # This is used with `use_beam_search` to determine how many candidate beams to
38
+ # explore.
39
+ sig { returns(T.nilable(Integer)) }
40
+ attr_reader :best_of
41
+
42
+ sig { params(best_of: Integer).void }
43
+ attr_writer :best_of
44
+
45
+ # This is used with `use_beam_search`. If `true`, generation stops as soon as
46
+ # there are `best_of` complete candidates; if `false`, a heuristic is applied and
47
+ # the generation stops when is it very unlikely to find better candidates.
48
+ sig { returns(T.nilable(T::Boolean)) }
49
+ attr_reader :early_stopping
50
+
51
+ sig { params(early_stopping: T::Boolean).void }
52
+ attr_writer :early_stopping
53
+
54
+ # Whether to enable the thinking/reasoning phase for models that support it (e.g.,
55
+ # QwQ, Qwen3). When set to false, the model will skip the internal reasoning step
56
+ # and respond directly, which can reduce latency. Defaults to true.
57
+ sig { returns(T.nilable(T::Boolean)) }
58
+ attr_reader :enable_thinking
59
+
60
+ sig { params(enable_thinking: T::Boolean).void }
61
+ attr_writer :enable_thinking
62
+
63
+ # Higher values will penalize the model from repeating the same output tokens.
64
+ sig { returns(T.nilable(Float)) }
65
+ attr_reader :frequency_penalty
66
+
67
+ sig { params(frequency_penalty: Float).void }
68
+ attr_writer :frequency_penalty
69
+
70
+ # If specified, the output will be exactly one of the choices.
71
+ sig { returns(T.nilable(T::Array[String])) }
72
+ attr_reader :guided_choice
73
+
74
+ sig { params(guided_choice: T::Array[String]).void }
75
+ attr_writer :guided_choice
76
+
77
+ # Must be a valid JSON schema. If specified, the output will follow the JSON
78
+ # schema.
79
+ sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
80
+ attr_reader :guided_json
81
+
82
+ sig { params(guided_json: T::Hash[Symbol, T.anything]).void }
83
+ attr_writer :guided_json
84
+
85
+ # If specified, the output will follow the regex pattern.
86
+ sig { returns(T.nilable(String)) }
87
+ attr_reader :guided_regex
88
+
89
+ sig { params(guided_regex: String).void }
90
+ attr_writer :guided_regex
91
+
92
+ # This is used with `use_beam_search` to prefer shorter or longer completions.
93
+ sig { returns(T.nilable(Float)) }
94
+ attr_reader :length_penalty
95
+
96
+ sig { params(length_penalty: Float).void }
97
+ attr_writer :length_penalty
98
+
99
+ # Whether to return log probabilities of the output tokens or not. If true,
100
+ # returns the log probabilities of each output token returned in the `content` of
101
+ # `message`.
102
+ sig { returns(T.nilable(T::Boolean)) }
103
+ attr_reader :logprobs
104
+
105
+ sig { params(logprobs: T::Boolean).void }
106
+ attr_writer :logprobs
107
+
108
+ # Maximum number of completion tokens the model should generate.
109
+ sig { returns(T.nilable(Integer)) }
110
+ attr_reader :max_tokens
111
+
112
+ sig { params(max_tokens: Integer).void }
113
+ attr_writer :max_tokens
114
+
115
+ # This is an alternative to `top_p` that
116
+ # [many prefer](https://github.com/huggingface/transformers/issues/27670). Must be
117
+ # in [0, 1].
118
+ sig { returns(T.nilable(Float)) }
119
+ attr_reader :min_p
120
+
121
+ sig { params(min_p: Float).void }
122
+ attr_writer :min_p
123
+
124
+ # The language model to chat with.
125
+ sig { returns(T.nilable(String)) }
126
+ attr_reader :model
127
+
128
+ sig { params(model: String).void }
129
+ attr_writer :model
130
+
131
+ # This will return multiple choices for you instead of a single chat completion.
132
+ sig { returns(T.nilable(Float)) }
133
+ attr_reader :n
134
+
135
+ sig { params(n: Float).void }
136
+ attr_writer :n
137
+
138
+ # Higher values will penalize the model from repeating the same output tokens.
139
+ sig { returns(T.nilable(Float)) }
140
+ attr_reader :presence_penalty
141
+
142
+ sig { params(presence_penalty: Float).void }
143
+ attr_writer :presence_penalty
144
+
145
+ # Use this is you want to guarantee a JSON output without defining a schema. For
146
+ # control over the schema, use `guided_json`.
147
+ sig do
148
+ returns(
149
+ T.nilable(
150
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::ResponseFormat
151
+ )
152
+ )
153
+ end
154
+ attr_reader :response_format
155
+
156
+ sig do
157
+ params(
158
+ response_format:
159
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::ResponseFormat::OrHash
160
+ ).void
161
+ end
162
+ attr_writer :response_format
163
+
164
+ # If specified, the system will make a best effort to sample deterministically,
165
+ # such that repeated requests with the same `seed` and parameters should return
166
+ # the same result.
167
+ sig { returns(T.nilable(Integer)) }
168
+ attr_reader :seed
169
+
170
+ sig { params(seed: Integer).void }
171
+ attr_writer :seed
172
+
173
+ # Up to 4 sequences where the API will stop generating further tokens. The
174
+ # returned text will not contain the stop sequence.
175
+ sig do
176
+ returns(
177
+ T.nilable(
178
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Stop::Variants
179
+ )
180
+ )
181
+ end
182
+ attr_reader :stop
183
+
184
+ sig do
185
+ params(
186
+ stop:
187
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Stop::Variants
188
+ ).void
189
+ end
190
+ attr_writer :stop
191
+
192
+ # Whether or not to stream data-only server-sent events as they become available.
193
+ sig { returns(T.nilable(T::Boolean)) }
194
+ attr_reader :stream
195
+
196
+ sig { params(stream: T::Boolean).void }
197
+ attr_writer :stream
198
+
199
+ # Adjusts the "creativity" of the model. Lower values make the model more
200
+ # deterministic and repetitive, while higher values make the model more random and
201
+ # creative.
202
+ sig { returns(T.nilable(Float)) }
203
+ attr_reader :temperature
204
+
205
+ sig { params(temperature: Float).void }
206
+ attr_writer :temperature
207
+
208
+ sig do
209
+ returns(
210
+ T.nilable(
211
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::ToolChoice::OrSymbol
212
+ )
213
+ )
214
+ end
215
+ attr_reader :tool_choice
216
+
217
+ sig do
218
+ params(
219
+ tool_choice:
220
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::ToolChoice::OrSymbol
221
+ ).void
222
+ end
223
+ attr_writer :tool_choice
224
+
225
+ # The `function` tool type follows the same schema as the
226
+ # [OpenAI Chat Completions API](https://platform.openai.com/docs/api-reference/chat).
227
+ # The `retrieval` tool type is unique to Telnyx. You may pass a list of
228
+ # [embedded storage buckets](https://developers.telnyx.com/api-reference/embeddings/embed-documents)
229
+ # for retrieval-augmented generation.
230
+ sig do
231
+ returns(
232
+ T.nilable(
233
+ T::Array[
234
+ T.any(
235
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Tool::Function,
236
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Tool::Retrieval
237
+ )
238
+ ]
239
+ )
240
+ )
241
+ end
242
+ attr_reader :tools
243
+
244
+ sig do
245
+ params(
246
+ tools:
247
+ T::Array[
248
+ T.any(
249
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Tool::Function::OrHash,
250
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Tool::Retrieval::OrHash
251
+ )
252
+ ]
253
+ ).void
254
+ end
255
+ attr_writer :tools
256
+
257
+ # This is used with `logprobs`. An integer between 0 and 20 specifying the number
258
+ # of most likely tokens to return at each token position, each with an associated
259
+ # log probability.
260
+ sig { returns(T.nilable(Integer)) }
261
+ attr_reader :top_logprobs
262
+
263
+ sig { params(top_logprobs: Integer).void }
264
+ attr_writer :top_logprobs
265
+
266
+ # An alternative or complement to `temperature`. This adjusts how many of the top
267
+ # possibilities to consider.
268
+ sig { returns(T.nilable(Float)) }
269
+ attr_reader :top_p
270
+
271
+ sig { params(top_p: Float).void }
272
+ attr_writer :top_p
273
+
274
+ # Setting this to `true` will allow the model to
275
+ # [explore more completion options](https://huggingface.co/blog/how-to-generate#beam-search).
276
+ # This is not supported by OpenAI.
277
+ sig { returns(T.nilable(T::Boolean)) }
278
+ attr_reader :use_beam_search
279
+
280
+ sig { params(use_beam_search: T::Boolean).void }
281
+ attr_writer :use_beam_search
282
+
283
+ sig do
284
+ params(
285
+ messages:
286
+ T::Array[
287
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Message::OrHash
288
+ ],
289
+ api_key_ref: String,
290
+ best_of: Integer,
291
+ early_stopping: T::Boolean,
292
+ enable_thinking: T::Boolean,
293
+ frequency_penalty: Float,
294
+ guided_choice: T::Array[String],
295
+ guided_json: T::Hash[Symbol, T.anything],
296
+ guided_regex: String,
297
+ length_penalty: Float,
298
+ logprobs: T::Boolean,
299
+ max_tokens: Integer,
300
+ min_p: Float,
301
+ model: String,
302
+ n: Float,
303
+ presence_penalty: Float,
304
+ response_format:
305
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::ResponseFormat::OrHash,
306
+ seed: Integer,
307
+ stop:
308
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Stop::Variants,
309
+ stream: T::Boolean,
310
+ temperature: Float,
311
+ tool_choice:
312
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::ToolChoice::OrSymbol,
313
+ tools:
314
+ T::Array[
315
+ T.any(
316
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Tool::Function::OrHash,
317
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Tool::Retrieval::OrHash
318
+ )
319
+ ],
320
+ top_logprobs: Integer,
321
+ top_p: Float,
322
+ use_beam_search: T::Boolean,
323
+ request_options: Telnyx::RequestOptions::OrHash
324
+ ).returns(T.attached_class)
325
+ end
326
+ def self.new(
327
+ # A list of the previous chat messages for context.
328
+ messages:,
329
+ # If you are using an external inference provider like xAI or OpenAI, this field
330
+ # allows you to pass along a reference to your API key. After creating an
331
+ # [integration secret](https://developers.telnyx.com/api-reference/integration-secrets/create-a-secret)
332
+ # for you API key, pass the secret's `identifier` in this field.
333
+ api_key_ref: nil,
334
+ # This is used with `use_beam_search` to determine how many candidate beams to
335
+ # explore.
336
+ best_of: nil,
337
+ # This is used with `use_beam_search`. If `true`, generation stops as soon as
338
+ # there are `best_of` complete candidates; if `false`, a heuristic is applied and
339
+ # the generation stops when is it very unlikely to find better candidates.
340
+ early_stopping: nil,
341
+ # Whether to enable the thinking/reasoning phase for models that support it (e.g.,
342
+ # QwQ, Qwen3). When set to false, the model will skip the internal reasoning step
343
+ # and respond directly, which can reduce latency. Defaults to true.
344
+ enable_thinking: nil,
345
+ # Higher values will penalize the model from repeating the same output tokens.
346
+ frequency_penalty: nil,
347
+ # If specified, the output will be exactly one of the choices.
348
+ guided_choice: nil,
349
+ # Must be a valid JSON schema. If specified, the output will follow the JSON
350
+ # schema.
351
+ guided_json: nil,
352
+ # If specified, the output will follow the regex pattern.
353
+ guided_regex: nil,
354
+ # This is used with `use_beam_search` to prefer shorter or longer completions.
355
+ length_penalty: nil,
356
+ # Whether to return log probabilities of the output tokens or not. If true,
357
+ # returns the log probabilities of each output token returned in the `content` of
358
+ # `message`.
359
+ logprobs: nil,
360
+ # Maximum number of completion tokens the model should generate.
361
+ max_tokens: nil,
362
+ # This is an alternative to `top_p` that
363
+ # [many prefer](https://github.com/huggingface/transformers/issues/27670). Must be
364
+ # in [0, 1].
365
+ min_p: nil,
366
+ # The language model to chat with.
367
+ model: nil,
368
+ # This will return multiple choices for you instead of a single chat completion.
369
+ n: nil,
370
+ # Higher values will penalize the model from repeating the same output tokens.
371
+ presence_penalty: nil,
372
+ # Use this is you want to guarantee a JSON output without defining a schema. For
373
+ # control over the schema, use `guided_json`.
374
+ response_format: nil,
375
+ # If specified, the system will make a best effort to sample deterministically,
376
+ # such that repeated requests with the same `seed` and parameters should return
377
+ # the same result.
378
+ seed: nil,
379
+ # Up to 4 sequences where the API will stop generating further tokens. The
380
+ # returned text will not contain the stop sequence.
381
+ stop: nil,
382
+ # Whether or not to stream data-only server-sent events as they become available.
383
+ stream: nil,
384
+ # Adjusts the "creativity" of the model. Lower values make the model more
385
+ # deterministic and repetitive, while higher values make the model more random and
386
+ # creative.
387
+ temperature: nil,
388
+ tool_choice: nil,
389
+ # The `function` tool type follows the same schema as the
390
+ # [OpenAI Chat Completions API](https://platform.openai.com/docs/api-reference/chat).
391
+ # The `retrieval` tool type is unique to Telnyx. You may pass a list of
392
+ # [embedded storage buckets](https://developers.telnyx.com/api-reference/embeddings/embed-documents)
393
+ # for retrieval-augmented generation.
394
+ tools: nil,
395
+ # This is used with `logprobs`. An integer between 0 and 20 specifying the number
396
+ # of most likely tokens to return at each token position, each with an associated
397
+ # log probability.
398
+ top_logprobs: nil,
399
+ # An alternative or complement to `temperature`. This adjusts how many of the top
400
+ # possibilities to consider.
401
+ top_p: nil,
402
+ # Setting this to `true` will allow the model to
403
+ # [explore more completion options](https://huggingface.co/blog/how-to-generate#beam-search).
404
+ # This is not supported by OpenAI.
405
+ use_beam_search: nil,
406
+ request_options: {}
407
+ )
408
+ end
409
+
410
+ sig do
411
+ override.returns(
412
+ {
413
+ messages:
414
+ T::Array[
415
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Message
416
+ ],
417
+ api_key_ref: String,
418
+ best_of: Integer,
419
+ early_stopping: T::Boolean,
420
+ enable_thinking: T::Boolean,
421
+ frequency_penalty: Float,
422
+ guided_choice: T::Array[String],
423
+ guided_json: T::Hash[Symbol, T.anything],
424
+ guided_regex: String,
425
+ length_penalty: Float,
426
+ logprobs: T::Boolean,
427
+ max_tokens: Integer,
428
+ min_p: Float,
429
+ model: String,
430
+ n: Float,
431
+ presence_penalty: Float,
432
+ response_format:
433
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::ResponseFormat,
434
+ seed: Integer,
435
+ stop:
436
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Stop::Variants,
437
+ stream: T::Boolean,
438
+ temperature: Float,
439
+ tool_choice:
440
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::ToolChoice::OrSymbol,
441
+ tools:
442
+ T::Array[
443
+ T.any(
444
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Tool::Function,
445
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Tool::Retrieval
446
+ )
447
+ ],
448
+ top_logprobs: Integer,
449
+ top_p: Float,
450
+ use_beam_search: T::Boolean,
451
+ request_options: Telnyx::RequestOptions
452
+ }
453
+ )
454
+ end
455
+ def to_hash
456
+ end
457
+
458
+ class Message < Telnyx::Internal::Type::BaseModel
459
+ OrHash =
460
+ T.type_alias do
461
+ T.any(
462
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Message,
463
+ Telnyx::Internal::AnyHash
464
+ )
465
+ end
466
+
467
+ sig do
468
+ returns(
469
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Message::Content::Variants
470
+ )
471
+ end
472
+ attr_accessor :content
473
+
474
+ sig do
475
+ returns(
476
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Message::Role::OrSymbol
477
+ )
478
+ end
479
+ attr_accessor :role
480
+
481
+ sig do
482
+ params(
483
+ content:
484
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Message::Content::Variants,
485
+ role:
486
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Message::Role::OrSymbol
487
+ ).returns(T.attached_class)
488
+ end
489
+ def self.new(content:, role:)
490
+ end
491
+
492
+ sig do
493
+ override.returns(
494
+ {
495
+ content:
496
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Message::Content::Variants,
497
+ role:
498
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Message::Role::OrSymbol
499
+ }
500
+ )
501
+ end
502
+ def to_hash
503
+ end
504
+
505
+ module Content
506
+ extend Telnyx::Internal::Type::Union
507
+
508
+ Variants =
509
+ T.type_alias do
510
+ T.any(
511
+ String,
512
+ T::Array[
513
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Message::Content::TextAndImageArray
514
+ ]
515
+ )
516
+ end
517
+
518
+ class TextAndImageArray < Telnyx::Internal::Type::BaseModel
519
+ OrHash =
520
+ T.type_alias do
521
+ T.any(
522
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Message::Content::TextAndImageArray,
523
+ Telnyx::Internal::AnyHash
524
+ )
525
+ end
526
+
527
+ sig do
528
+ returns(
529
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Message::Content::TextAndImageArray::Type::OrSymbol
530
+ )
531
+ end
532
+ attr_accessor :type
533
+
534
+ sig { returns(T.nilable(String)) }
535
+ attr_reader :image_url
536
+
537
+ sig { params(image_url: String).void }
538
+ attr_writer :image_url
539
+
540
+ sig { returns(T.nilable(String)) }
541
+ attr_reader :text
542
+
543
+ sig { params(text: String).void }
544
+ attr_writer :text
545
+
546
+ sig do
547
+ params(
548
+ type:
549
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Message::Content::TextAndImageArray::Type::OrSymbol,
550
+ image_url: String,
551
+ text: String
552
+ ).returns(T.attached_class)
553
+ end
554
+ def self.new(type:, image_url: nil, text: nil)
555
+ end
556
+
557
+ sig do
558
+ override.returns(
559
+ {
560
+ type:
561
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Message::Content::TextAndImageArray::Type::OrSymbol,
562
+ image_url: String,
563
+ text: String
564
+ }
565
+ )
566
+ end
567
+ def to_hash
568
+ end
569
+
570
+ module Type
571
+ extend Telnyx::Internal::Type::Enum
572
+
573
+ TaggedSymbol =
574
+ T.type_alias do
575
+ T.all(
576
+ Symbol,
577
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Message::Content::TextAndImageArray::Type
578
+ )
579
+ end
580
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
581
+
582
+ TEXT =
583
+ T.let(
584
+ :text,
585
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Message::Content::TextAndImageArray::Type::TaggedSymbol
586
+ )
587
+ IMAGE_URL =
588
+ T.let(
589
+ :image_url,
590
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Message::Content::TextAndImageArray::Type::TaggedSymbol
591
+ )
592
+
593
+ sig do
594
+ override.returns(
595
+ T::Array[
596
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Message::Content::TextAndImageArray::Type::TaggedSymbol
597
+ ]
598
+ )
599
+ end
600
+ def self.values
601
+ end
602
+ end
603
+ end
604
+
605
+ sig do
606
+ override.returns(
607
+ T::Array[
608
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Message::Content::Variants
609
+ ]
610
+ )
611
+ end
612
+ def self.variants
613
+ end
614
+
615
+ TextAndImage2DArray =
616
+ T.let(
617
+ Telnyx::Internal::Type::ArrayOf[
618
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Message::Content::TextAndImageArray
619
+ ],
620
+ Telnyx::Internal::Type::Converter
621
+ )
622
+ end
623
+
624
+ module Role
625
+ extend Telnyx::Internal::Type::Enum
626
+
627
+ TaggedSymbol =
628
+ T.type_alias do
629
+ T.all(
630
+ Symbol,
631
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Message::Role
632
+ )
633
+ end
634
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
635
+
636
+ SYSTEM =
637
+ T.let(
638
+ :system,
639
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Message::Role::TaggedSymbol
640
+ )
641
+ USER =
642
+ T.let(
643
+ :user,
644
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Message::Role::TaggedSymbol
645
+ )
646
+ ASSISTANT =
647
+ T.let(
648
+ :assistant,
649
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Message::Role::TaggedSymbol
650
+ )
651
+ TOOL =
652
+ T.let(
653
+ :tool,
654
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Message::Role::TaggedSymbol
655
+ )
656
+
657
+ sig do
658
+ override.returns(
659
+ T::Array[
660
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Message::Role::TaggedSymbol
661
+ ]
662
+ )
663
+ end
664
+ def self.values
665
+ end
666
+ end
667
+ end
668
+
669
+ class ResponseFormat < Telnyx::Internal::Type::BaseModel
670
+ OrHash =
671
+ T.type_alias do
672
+ T.any(
673
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::ResponseFormat,
674
+ Telnyx::Internal::AnyHash
675
+ )
676
+ end
677
+
678
+ sig do
679
+ returns(
680
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::ResponseFormat::Type::OrSymbol
681
+ )
682
+ end
683
+ attr_accessor :type
684
+
685
+ # Use this is you want to guarantee a JSON output without defining a schema. For
686
+ # control over the schema, use `guided_json`.
687
+ sig do
688
+ params(
689
+ type:
690
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::ResponseFormat::Type::OrSymbol
691
+ ).returns(T.attached_class)
692
+ end
693
+ def self.new(type:)
694
+ end
695
+
696
+ sig do
697
+ override.returns(
698
+ {
699
+ type:
700
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::ResponseFormat::Type::OrSymbol
701
+ }
702
+ )
703
+ end
704
+ def to_hash
705
+ end
706
+
707
+ module Type
708
+ extend Telnyx::Internal::Type::Enum
709
+
710
+ TaggedSymbol =
711
+ T.type_alias do
712
+ T.all(
713
+ Symbol,
714
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::ResponseFormat::Type
715
+ )
716
+ end
717
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
718
+
719
+ TEXT =
720
+ T.let(
721
+ :text,
722
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::ResponseFormat::Type::TaggedSymbol
723
+ )
724
+ JSON_OBJECT =
725
+ T.let(
726
+ :json_object,
727
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::ResponseFormat::Type::TaggedSymbol
728
+ )
729
+
730
+ sig do
731
+ override.returns(
732
+ T::Array[
733
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::ResponseFormat::Type::TaggedSymbol
734
+ ]
735
+ )
736
+ end
737
+ def self.values
738
+ end
739
+ end
740
+ end
741
+
742
+ # Up to 4 sequences where the API will stop generating further tokens. The
743
+ # returned text will not contain the stop sequence.
744
+ module Stop
745
+ extend Telnyx::Internal::Type::Union
746
+
747
+ Variants = T.type_alias { T.any(String, T::Array[String]) }
748
+
749
+ sig do
750
+ override.returns(
751
+ T::Array[
752
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Stop::Variants
753
+ ]
754
+ )
755
+ end
756
+ def self.variants
757
+ end
758
+
759
+ StringArray =
760
+ T.let(
761
+ Telnyx::Internal::Type::ArrayOf[String],
762
+ Telnyx::Internal::Type::Converter
763
+ )
764
+ end
765
+
766
+ module ToolChoice
767
+ extend Telnyx::Internal::Type::Enum
768
+
769
+ TaggedSymbol =
770
+ T.type_alias do
771
+ T.all(
772
+ Symbol,
773
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::ToolChoice
774
+ )
775
+ end
776
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
777
+
778
+ NONE =
779
+ T.let(
780
+ :none,
781
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::ToolChoice::TaggedSymbol
782
+ )
783
+ AUTO =
784
+ T.let(
785
+ :auto,
786
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::ToolChoice::TaggedSymbol
787
+ )
788
+ REQUIRED =
789
+ T.let(
790
+ :required,
791
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::ToolChoice::TaggedSymbol
792
+ )
793
+
794
+ sig do
795
+ override.returns(
796
+ T::Array[
797
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::ToolChoice::TaggedSymbol
798
+ ]
799
+ )
800
+ end
801
+ def self.values
802
+ end
803
+ end
804
+
805
+ module Tool
806
+ extend Telnyx::Internal::Type::Union
807
+
808
+ Variants =
809
+ T.type_alias do
810
+ T.any(
811
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Tool::Function,
812
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Tool::Retrieval
813
+ )
814
+ end
815
+
816
+ class Function < Telnyx::Internal::Type::BaseModel
817
+ OrHash =
818
+ T.type_alias do
819
+ T.any(
820
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Tool::Function,
821
+ Telnyx::Internal::AnyHash
822
+ )
823
+ end
824
+
825
+ sig do
826
+ returns(
827
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Tool::Function::Function
828
+ )
829
+ end
830
+ attr_reader :function
831
+
832
+ sig do
833
+ params(
834
+ function:
835
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Tool::Function::Function::OrHash
836
+ ).void
837
+ end
838
+ attr_writer :function
839
+
840
+ sig { returns(Symbol) }
841
+ attr_accessor :type
842
+
843
+ sig do
844
+ params(
845
+ function:
846
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Tool::Function::Function::OrHash,
847
+ type: Symbol
848
+ ).returns(T.attached_class)
849
+ end
850
+ def self.new(function:, type: :function)
851
+ end
852
+
853
+ sig do
854
+ override.returns(
855
+ {
856
+ function:
857
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Tool::Function::Function,
858
+ type: Symbol
859
+ }
860
+ )
861
+ end
862
+ def to_hash
863
+ end
864
+
865
+ class Function < Telnyx::Internal::Type::BaseModel
866
+ OrHash =
867
+ T.type_alias do
868
+ T.any(
869
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Tool::Function::Function,
870
+ Telnyx::Internal::AnyHash
871
+ )
872
+ end
873
+
874
+ sig { returns(String) }
875
+ attr_accessor :name
876
+
877
+ sig { returns(T.nilable(String)) }
878
+ attr_reader :description
879
+
880
+ sig { params(description: String).void }
881
+ attr_writer :description
882
+
883
+ sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
884
+ attr_reader :parameters
885
+
886
+ sig { params(parameters: T::Hash[Symbol, T.anything]).void }
887
+ attr_writer :parameters
888
+
889
+ sig do
890
+ params(
891
+ name: String,
892
+ description: String,
893
+ parameters: T::Hash[Symbol, T.anything]
894
+ ).returns(T.attached_class)
895
+ end
896
+ def self.new(name:, description: nil, parameters: nil)
897
+ end
898
+
899
+ sig do
900
+ override.returns(
901
+ {
902
+ name: String,
903
+ description: String,
904
+ parameters: T::Hash[Symbol, T.anything]
905
+ }
906
+ )
907
+ end
908
+ def to_hash
909
+ end
910
+ end
911
+ end
912
+
913
+ class Retrieval < Telnyx::Internal::Type::BaseModel
914
+ OrHash =
915
+ T.type_alias do
916
+ T.any(
917
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Tool::Retrieval,
918
+ Telnyx::Internal::AnyHash
919
+ )
920
+ end
921
+
922
+ sig { returns(Telnyx::AI::BucketIDs) }
923
+ attr_reader :retrieval
924
+
925
+ sig { params(retrieval: Telnyx::AI::BucketIDs::OrHash).void }
926
+ attr_writer :retrieval
927
+
928
+ sig { returns(Symbol) }
929
+ attr_accessor :type
930
+
931
+ sig do
932
+ params(
933
+ retrieval: Telnyx::AI::BucketIDs::OrHash,
934
+ type: Symbol
935
+ ).returns(T.attached_class)
936
+ end
937
+ def self.new(retrieval:, type: :retrieval)
938
+ end
939
+
940
+ sig do
941
+ override.returns(
942
+ { retrieval: Telnyx::AI::BucketIDs, type: Symbol }
943
+ )
944
+ end
945
+ def to_hash
946
+ end
947
+ end
948
+
949
+ sig do
950
+ override.returns(
951
+ T::Array[
952
+ Telnyx::AI::OpenAI::ChatCreateCompletionParams::Tool::Variants
953
+ ]
954
+ )
955
+ end
956
+ def self.variants
957
+ end
958
+ end
959
+ end
960
+ end
961
+ end
962
+ end
963
+ end