Class: Telnyx::Models::AI::ChatCreateCompletionParams::Message

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/telnyx/models/ai/chat_create_completion_params.rb

Defined Under Namespace

Modules: Content, Role

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(content:, role:) ⇒ Object



235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
# File 'lib/telnyx/models/ai/chat_create_completion_params.rb', line 235

class Message < Telnyx::Internal::Type::BaseModel
  # @!attribute content
  #
  #   @return [String, Array<Telnyx::Models::AI::ChatCreateCompletionParams::Message::Content::TextAndImageArray>]
  required :content, union: -> { Telnyx::AI::ChatCreateCompletionParams::Message::Content }

  # @!attribute role
  #
  #   @return [Symbol, Telnyx::Models::AI::ChatCreateCompletionParams::Message::Role]
  required :role, enum: -> { Telnyx::AI::ChatCreateCompletionParams::Message::Role }

  # @!method initialize(content:, role:)
  #   @param content [String, Array<Telnyx::Models::AI::ChatCreateCompletionParams::Message::Content::TextAndImageArray>]
  #   @param role [Symbol, Telnyx::Models::AI::ChatCreateCompletionParams::Message::Role]

  # @see Telnyx::Models::AI::ChatCreateCompletionParams::Message#content
  module Content
    extend Telnyx::Internal::Type::Union

    variant String

    variant -> { Telnyx::Models::AI::ChatCreateCompletionParams::Message::Content::TextAndImage2DArray }

    class TextAndImageArray < Telnyx::Internal::Type::BaseModel
      # @!attribute type
      #
      #   @return [Symbol, Telnyx::Models::AI::ChatCreateCompletionParams::Message::Content::TextAndImageArray::Type]
      required :type,
               enum: -> { Telnyx::AI::ChatCreateCompletionParams::Message::Content::TextAndImageArray::Type }

      # @!attribute image_url
      #
      #   @return [String, nil]
      optional :image_url, String

      # @!attribute text
      #
      #   @return [String, nil]
      optional :text, String

      # @!method initialize(type:, image_url: nil, text: nil)
      #   @param type [Symbol, Telnyx::Models::AI::ChatCreateCompletionParams::Message::Content::TextAndImageArray::Type]
      #   @param image_url [String]
      #   @param text [String]

      # @see Telnyx::Models::AI::ChatCreateCompletionParams::Message::Content::TextAndImageArray#type
      module Type
        extend Telnyx::Internal::Type::Enum

        TEXT = :text
        IMAGE_URL = :image_url

        # @!method self.values
        #   @return [Array<Symbol>]
      end
    end

    # @!method self.variants
    #   @return [Array(String, Array<Telnyx::Models::AI::ChatCreateCompletionParams::Message::Content::TextAndImageArray>)]

    # @type [Telnyx::Internal::Type::Converter]
    TextAndImage2DArray =
      Telnyx::Internal::Type::ArrayOf[-> {
        Telnyx::AI::ChatCreateCompletionParams::Message::Content::TextAndImageArray
      }]
  end

  # @see Telnyx::Models::AI::ChatCreateCompletionParams::Message#role
  module Role
    extend Telnyx::Internal::Type::Enum

    SYSTEM = :system
    USER = :user
    ASSISTANT = :assistant
    TOOL = :tool

    # @!method self.values
    #   @return [Array<Symbol>]
  end
end

Instance Attribute Details

#contentString, Array<Telnyx::Models::AI::ChatCreateCompletionParams::Message::Content::TextAndImageArray>



239
# File 'lib/telnyx/models/ai/chat_create_completion_params.rb', line 239

required :content, union: -> { Telnyx::AI::ChatCreateCompletionParams::Message::Content }

#roleSymbol, Telnyx::Models::AI::ChatCreateCompletionParams::Message::Role



244
# File 'lib/telnyx/models/ai/chat_create_completion_params.rb', line 244

required :role, enum: -> { Telnyx::AI::ChatCreateCompletionParams::Message::Role }