Class: OpenAI::Models::Chat::ChatCompletionMessage

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

Direct Known Subclasses

ChatCompletionStoreMessage

Defined Under Namespace

Classes: Annotation, 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_with_error, 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(end_index:, start_index:, title:, url:) ⇒ Object

Parameters:

  • content

    The contents of the message.

  • refusal

    The refusal message generated by the model.

  • annotations

    Annotations for the message, when applicable, as when using the web search tool.

  • audio

    If the audio output modality is requested, this object contains data about the audio response from the model. Learn more.

  • function_call

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

  • tool_calls

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

  • role

    The role of the author of this message.



# File 'lib/openai/models/chat/chat_completion_message.rb', line 144

Instance Attribute Details

#annotations::Array[OpenAI::Chat::ChatCompletionMessage::Annotation]?

Annotations for the message, when applicable, as when using the web search tool.

Returns:

  • (::Array[OpenAI::Chat::ChatCompletionMessage::Annotation], nil)


38
39
40
41
# File 'lib/openai/models/chat/chat_completion_message.rb', line 38

optional(
  :annotations,
  -> { OpenAI::Internal::Type::ArrayOf[OpenAI::Chat::ChatCompletionMessage::Annotation] }
)

#audioOpenAI::Chat::ChatCompletionAudio?

If the audio output modality is requested, this object contains data about the audio response from the model. Learn more.

Returns:

  • (OpenAI::Chat::ChatCompletionAudio, nil)


49
# File 'lib/openai/models/chat/chat_completion_message.rb', line 49

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

#contentString?

The contents of the message.

Returns:

  • (String, nil)


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

required :content, String, nil?: true

#function_callOpenAI::Chat::ChatCompletionMessage::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::ChatCompletionMessage::FunctionCall, nil)


58
# File 'lib/openai/models/chat/chat_completion_message.rb', line 58

optional :function_call, -> { OpenAI::Chat::ChatCompletionMessage::FunctionCall }

#refusalString?

The refusal message generated by the model.

Returns:

  • (String, nil)


25
# File 'lib/openai/models/chat/chat_completion_message.rb', line 25

required :refusal, String, nil?: true

#role:assistant

The role of the author of this message.

Returns:

  • (:assistant)


31
# File 'lib/openai/models/chat/chat_completion_message.rb', line 31

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)


64
65
66
67
# File 'lib/openai/models/chat/chat_completion_message.rb', line 64

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

Instance Method Details

#to_hash{

Returns:

  • ({)


88
# File 'sig/openai/models/chat/chat_completion_message.rbs', line 88

def to_hash: -> {