Class: OpenAI::Models::Beta::Threads::RunCreateParams::AdditionalMessage

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/openai/models/beta/threads/run_create_params.rb

Defined Under Namespace

Modules: Content, Role Classes: Attachment

Instance Attribute Summary collapse

Class Method 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, 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: , attachments: nil, metadata: nil) ⇒ Object

Some parameter documentations has been truncated, see OpenAI::Models::Beta::Threads::RunCreateParams::AdditionalMessage for more details.

Parameters:



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
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
# File 'lib/openai/models/beta/threads/run_create_params.rb', line 235

class AdditionalMessage < OpenAI::Internal::Type::BaseModel
  # @!attribute content
  #   The text contents of the message.
  #
  #   @return [String, Array<OpenAI::Models::Beta::Threads::ImageFileContentBlock, OpenAI::Models::Beta::Threads::ImageURLContentBlock, OpenAI::Models::Beta::Threads::TextContentBlockParam>]
  required :content,
           union: -> {
             OpenAI::Beta::Threads::RunCreateParams::AdditionalMessage::Content
           }

  # @!attribute role
  #   The role of the entity that is creating the message. Allowed values include:
  #
  #   - `user`: Indicates the message is sent by an actual user and should be used in
  #     most cases to represent user-generated messages.
  #   - `assistant`: Indicates the message is generated by the assistant. Use this
  #     value to insert messages from the assistant into the conversation.
  #
  #   @return [Symbol, OpenAI::Models::Beta::Threads::RunCreateParams::AdditionalMessage::Role]
  required :role, enum: -> { OpenAI::Beta::Threads::RunCreateParams::AdditionalMessage::Role }

  # @!attribute attachments
  #   A list of files attached to the message, and the tools they should be added to.
  #
  #   @return [Array<OpenAI::Models::Beta::Threads::RunCreateParams::AdditionalMessage::Attachment>, nil]
  optional :attachments,
           -> {
             OpenAI::Internal::Type::ArrayOf[OpenAI::Beta::Threads::RunCreateParams::AdditionalMessage::Attachment]
           },
           nil?: true

  # @!attribute metadata
  #   Set of 16 key-value pairs that can be attached to an object. This can be useful
  #   for storing additional information about the object in a structured format, and
  #   querying for objects via API or the dashboard.
  #
  #   Keys are strings with a maximum length of 64 characters. Values are strings with
  #   a maximum length of 512 characters.
  #
  #   @return [Hash{Symbol=>String}, nil]
  optional :metadata, OpenAI::Internal::Type::HashOf[String], nil?: true

  # @!method initialize(content:, role:, attachments: nil, metadata: nil)
  #   Some parameter documentations has been truncated, see
  #   {OpenAI::Models::Beta::Threads::RunCreateParams::AdditionalMessage} for more
  #   details.
  #
  #   @param content [String, Array<OpenAI::Models::Beta::Threads::ImageFileContentBlock, OpenAI::Models::Beta::Threads::ImageURLContentBlock, OpenAI::Models::Beta::Threads::TextContentBlockParam>] The text contents of the message.
  #
  #   @param role [Symbol, OpenAI::Models::Beta::Threads::RunCreateParams::AdditionalMessage::Role] The role of the entity that is creating the message. Allowed values include:
  #
  #   @param attachments [Array<OpenAI::Models::Beta::Threads::RunCreateParams::AdditionalMessage::Attachment>, nil] A list of files attached to the message, and the tools they should be added to.
  #
  #   @param metadata [Hash{Symbol=>String}, nil] Set of 16 key-value pairs that can be attached to an object. This can be

  # The text contents of the message.
  #
  # @see OpenAI::Models::Beta::Threads::RunCreateParams::AdditionalMessage#content
  module Content
    extend OpenAI::Internal::Type::Union

    # The text contents of the message.
    variant String

    # An array of content parts with a defined type, each can be of type `text` or images can be passed with `image_url` or `image_file`. Image types are only supported on [Vision-compatible models](https://platform.openai.com/docs/models).
    variant -> { OpenAI::Models::Beta::Threads::RunCreateParams::AdditionalMessage::Content::MessageContentPartParamArray }

    # @!method self.variants
    #   @return [Array(String, Array<OpenAI::Models::Beta::Threads::ImageFileContentBlock, OpenAI::Models::Beta::Threads::ImageURLContentBlock, OpenAI::Models::Beta::Threads::TextContentBlockParam>)]

    # @type [OpenAI::Internal::Type::Converter]
    MessageContentPartParamArray =
      OpenAI::Internal::Type::ArrayOf[union: -> { OpenAI::Beta::Threads::MessageContentPartParam }]
  end

  # The role of the entity that is creating the message. Allowed values include:
  #
  # - `user`: Indicates the message is sent by an actual user and should be used in
  #   most cases to represent user-generated messages.
  # - `assistant`: Indicates the message is generated by the assistant. Use this
  #   value to insert messages from the assistant into the conversation.
  #
  # @see OpenAI::Models::Beta::Threads::RunCreateParams::AdditionalMessage#role
  module Role
    extend OpenAI::Internal::Type::Enum

    USER = :user
    ASSISTANT = :assistant

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

  class Attachment < OpenAI::Internal::Type::BaseModel
    # @!attribute file_id
    #   The ID of the file to attach to the message.
    #
    #   @return [String, nil]
    optional :file_id, String

    # @!attribute tools
    #   The tools to add this file to.
    #
    #   @return [Array<OpenAI::Models::Beta::CodeInterpreterTool, OpenAI::Models::Beta::Threads::RunCreateParams::AdditionalMessage::Attachment::Tool::FileSearch>, nil]
    optional :tools,
             -> {
               OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::Threads::RunCreateParams::AdditionalMessage::Attachment::Tool]
             }

    # @!method initialize(file_id: nil, tools: nil)
    #   @param file_id [String] The ID of the file to attach to the message.
    #
    #   @param tools [Array<OpenAI::Models::Beta::CodeInterpreterTool, OpenAI::Models::Beta::Threads::RunCreateParams::AdditionalMessage::Attachment::Tool::FileSearch>] The tools to add this file to.

    module Tool
      extend OpenAI::Internal::Type::Union

      discriminator :type

      variant :code_interpreter, -> { OpenAI::Beta::CodeInterpreterTool }

      variant :file_search,
              -> {
                OpenAI::Beta::Threads::RunCreateParams::AdditionalMessage::Attachment::Tool::FileSearch
              }

      class FileSearch < OpenAI::Internal::Type::BaseModel
        # @!attribute type
        #   The type of tool being defined: `file_search`
        #
        #   @return [Symbol, :file_search]
        required :type, const: :file_search

        # @!method initialize(type: :file_search)
        #   @param type [Symbol, :file_search] The type of tool being defined: `file_search`
      end

      # @!method self.variants
      #   @return [Array(OpenAI::Models::Beta::CodeInterpreterTool, OpenAI::Models::Beta::Threads::RunCreateParams::AdditionalMessage::Attachment::Tool::FileSearch)]
    end
  end
end

Instance Attribute Details

#attachmentsArray<OpenAI::Models::Beta::Threads::RunCreateParams::AdditionalMessage::Attachment>?

A list of files attached to the message, and the tools they should be added to.



260
261
262
263
264
# File 'lib/openai/models/beta/threads/run_create_params.rb', line 260

optional :attachments,
-> {
  OpenAI::Internal::Type::ArrayOf[OpenAI::Beta::Threads::RunCreateParams::AdditionalMessage::Attachment]
},
nil?: true

#contentString, Array<OpenAI::Models::Beta::Threads::ImageFileContentBlock, OpenAI::Models::Beta::Threads::ImageURLContentBlock, OpenAI::Models::Beta::Threads::TextContentBlockParam>

The text contents of the message.



240
241
242
243
# File 'lib/openai/models/beta/threads/run_create_params.rb', line 240

required :content,
union: -> {
  OpenAI::Beta::Threads::RunCreateParams::AdditionalMessage::Content
}

#metadataHash{Symbol=>String}?

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.

Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.

Returns:

  • (Hash{Symbol=>String}, nil)


275
# File 'lib/openai/models/beta/threads/run_create_params.rb', line 275

optional :metadata, OpenAI::Internal::Type::HashOf[String], nil?: true

#roleSymbol, OpenAI::Models::Beta::Threads::RunCreateParams::AdditionalMessage::Role

The role of the entity that is creating the message. Allowed values include:

  • ‘user`: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages.

  • ‘assistant`: Indicates the message is generated by the assistant. Use this value to insert messages from the assistant into the conversation.



254
# File 'lib/openai/models/beta/threads/run_create_params.rb', line 254

required :role, enum: -> { OpenAI::Beta::Threads::RunCreateParams::AdditionalMessage::Role }

Class Method Details

.valuesArray<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/openai/models/beta/threads/run_create_params.rb', line 324