Class: OpenAI::Models::Chat::ChatCompletionAssistantMessageParam

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/openai/models/chat/chat_completion_assistant_message_param.rb,
sig/openai/models/chat/chat_completion_assistant_message_param.rbs

Defined Under Namespace

Modules: Content Classes: Audio, FunctionCall

Instance Attribute Summary collapse

Attributes inherited from Internal::Type::BaseModel

#last_response

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], #_request_id, #_set_last_response, coerce, #deconstruct_keys, #deep_to_h, dump, #encode_with, 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, coerce_cached, coerce_with_error, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, resolve_type, 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(id:) ⇒ ChatCompletionAssistantMessageParam

Returns a new instance of ChatCompletionAssistantMessageParam.

Parameters:

  • audio —

    Data about a previous audio response from the model. Learn more.

  • content —

    The contents of the assistant message. Required unless tool_calls or function_call is specified.

  • function_call —

    Deprecated and replaced by tool_calls. The name and arguments of a function that should be called, as generated by the model.

  • name —

    An optional name for the participant. Provides the model information to differentiate between participants of the same role.

  • refusal —

    The refusal message by the assistant.

  • tool_calls —

    The tool calls generated by the model, such as function calls.

  • role —

    The role of the messages author, in this case assistant.

  • audio: (OpenAI::Chat::ChatCompletionAssistantMessageParam::Audio, nil)
  • content: (OpenAI::Models::Chat::ChatCompletionAssistantMessageParam::content, nil)
  • function_call: (OpenAI::Chat::ChatCompletionAssistantMessageParam::FunctionCall, nil)
  • name: (String)
  • refusal: (String, nil)
  • tool_calls: (::Array[OpenAI::Models::Chat::chat_completion_message_tool_call])
  • role: (:assistant)


# File 'lib/openai/models/chat/chat_completion_assistant_message_param.rb', line 68

Instance Attribute Details

#audio ⇒ OpenAI::Chat::ChatCompletionAssistantMessageParam::Audio?

Data about a previous audio response from the model. Learn more.

Returns:

  • (OpenAI::Chat::ChatCompletionAssistantMessageParam::Audio, nil)


18
# File 'lib/openai/models/chat/chat_completion_assistant_message_param.rb', line 18

optional :audio, -> { OpenAI::Chat::ChatCompletionAssistantMessageParam::Audio }, nil?: true

#content ⇒ OpenAI::Models::Chat::ChatCompletionAssistantMessageParam::content?

The contents of the assistant message. Required unless tool_calls or function_call is specified.

Returns:

  • (OpenAI::Models::Chat::ChatCompletionAssistantMessageParam::content, nil)


25
26
27
28
29
30
31
# File 'lib/openai/models/chat/chat_completion_assistant_message_param.rb', line 25

optional(
  :content,
  union: -> {
    OpenAI::Chat::ChatCompletionAssistantMessageParam::Content
  },
  nil?: true
)

#function_call ⇒ OpenAI::Chat::ChatCompletionAssistantMessageParam::FunctionCall?

Deprecated and replaced by tool_calls. The name and arguments of a function that should be called, as generated by the model.

Returns:

  • (OpenAI::Chat::ChatCompletionAssistantMessageParam::FunctionCall, nil)


40
41
42
43
44
# File 'lib/openai/models/chat/chat_completion_assistant_message_param.rb', line 40

optional(
  :function_call,
  -> { OpenAI::Chat::ChatCompletionAssistantMessageParam::FunctionCall },
  nil?: true
)

#name ⇒ String?

An optional name for the participant. Provides the model information to differentiate between participants of the same role.

Returns:

  • (String, nil)


51
# File 'lib/openai/models/chat/chat_completion_assistant_message_param.rb', line 51

optional :name, String

#refusal ⇒ String?

The refusal message by the assistant.

Returns:

  • (String, nil)


57
# File 'lib/openai/models/chat/chat_completion_assistant_message_param.rb', line 57

optional :refusal, String, nil?: true

#role ⇒ :assistant

The role of the messages author, in this case assistant.

Returns:

  • (:assistant)


11
# File 'lib/openai/models/chat/chat_completion_assistant_message_param.rb', line 11

required :role, const: :assistant

#tool_calls ⇒ ::Array[OpenAI::Models::Chat::chat_completion_message_tool_call]?

The tool calls generated by the model, such as function calls.

Returns:

  • (::Array[OpenAI::Models::Chat::chat_completion_message_tool_call], nil)


63
64
65
66
# File 'lib/openai/models/chat/chat_completion_assistant_message_param.rb', line 63

optional(
  :tool_calls,
  -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Chat::ChatCompletionMessageToolCall] }
)

Instance Method Details

#to_hash ⇒ { ?role: :assistant, ?audio: OpenAI::Chat::ChatCompletionAssistantMessageParam::Audio?, ?content: OpenAI::Models::Chat::ChatCompletionAssistantMessageParam::content?, ?function_call: OpenAI::Chat::ChatCompletionAssistantMessageParam::FunctionCall?, ?name: String, ?refusal: String?, ?tool_calls: ::Array[OpenAI::Models::Chat::chat_completion_message_tool_call] }

Returns:

  • ({ ?role: :assistant, ?audio: OpenAI::Chat::ChatCompletionAssistantMessageParam::Audio?, ?content: OpenAI::Models::Chat::ChatCompletionAssistantMessageParam::content?, ?function_call: OpenAI::Chat::ChatCompletionAssistantMessageParam::FunctionCall?, ?name: String, ?refusal: String?, ?tool_calls: ::Array[OpenAI::Models::Chat::chat_completion_message_tool_call] })


80
81
82
83
84
85
86
87
88
# File 'sig/openai/models/chat/chat_completion_assistant_message_param.rbs', line 80

def to_hash: -> {
  ?role: :assistant,
  ?audio: OpenAI::Chat::ChatCompletionAssistantMessageParam::Audio?,
  ?content: OpenAI::Models::Chat::ChatCompletionAssistantMessageParam::content?,
  ?function_call: OpenAI::Chat::ChatCompletionAssistantMessageParam::FunctionCall?,
  ?name: String,
  ?refusal: String?,
  ?tool_calls: ::Array[OpenAI::Models::Chat::chat_completion_message_tool_call]
}