Class: OpenAI::Models::Chat::ChatCompletionChunk::Choice::Delta

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

Overview

See Also:

  • OpenAI::Models::Chat::ChatCompletionChunk::Choice#delta

Defined Under Namespace

Modules: Role Classes: Audio, FunctionCall, ToolCall

Instance Attribute Summary collapse

Attributes inherited from Internal::Type::BaseModel

#last_response

Class Method Summary collapse

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(arguments: nil, name: nil) ⇒ Delta

Returns a new instance of Delta.

Parameters:

  • audio —

    A partial audio response. Audio chunks may carry an ID, base64 data, or transcript text; the final audio update contains only its expiry timestamp.

  • content —

    The contents of the chunk message.

  • function_call —

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

  • refusal —

    The refusal message generated by the model.

  • role —

    The role of the author of this message.

  • audio: (OpenAI::Chat::ChatCompletionChunk::Choice::Delta::Audio)
  • content: (String, nil)
  • function_call: (OpenAI::Chat::ChatCompletionChunk::Choice::Delta::FunctionCall)
  • refusal: (String, nil)
  • role: (OpenAI::Models::Chat::ChatCompletionChunk::Choice::Delta::role)
  • tool_calls: (::Array[OpenAI::Chat::ChatCompletionChunk::Choice::Delta::ToolCall])


# File 'lib/openai/models/chat/chat_completion_chunk.rb', line 277

Instance Attribute Details

#audio ⇒ OpenAI::Chat::ChatCompletionChunk::Choice::Delta::Audio?

A partial audio response. Audio chunks may carry an ID, base64 data, or transcript text; the final audio update contains only its expiry timestamp.

Returns:

  • (OpenAI::Chat::ChatCompletionChunk::Choice::Delta::Audio, nil)


240
# File 'lib/openai/models/chat/chat_completion_chunk.rb', line 240

optional :audio, -> { OpenAI::Chat::ChatCompletionChunk::Choice::Delta::Audio }

#content ⇒ String?

The contents of the chunk message.

Returns:

  • (String, nil)


246
# File 'lib/openai/models/chat/chat_completion_chunk.rb', line 246

optional :content, String, nil?: true

#function_call ⇒ OpenAI::Chat::ChatCompletionChunk::Choice::Delta::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::ChatCompletionChunk::Choice::Delta::FunctionCall, nil)


255
# File 'lib/openai/models/chat/chat_completion_chunk.rb', line 255

optional :function_call, -> { OpenAI::Chat::ChatCompletionChunk::Choice::Delta::FunctionCall }

#refusal ⇒ String?

The refusal message generated by the model.

Returns:

  • (String, nil)


261
# File 'lib/openai/models/chat/chat_completion_chunk.rb', line 261

optional :refusal, String, nil?: true

#role ⇒ OpenAI::Models::Chat::ChatCompletionChunk::Choice::Delta::role?

The role of the author of this message.

Returns:

  • (OpenAI::Models::Chat::ChatCompletionChunk::Choice::Delta::role, nil)


267
# File 'lib/openai/models/chat/chat_completion_chunk.rb', line 267

optional :role, enum: -> { OpenAI::Chat::ChatCompletionChunk::Choice::Delta::Role }

#tool_calls ⇒ Array<OpenAI::Models::Chat::ChatCompletionChunk::Choice::Delta::ToolCall>?

Parameters:

  • (::Array[OpenAI::Chat::ChatCompletionChunk::Choice::Delta::ToolCall])

Returns:



272
273
274
275
# File 'lib/openai/models/chat/chat_completion_chunk.rb', line 272

optional(
  :tool_calls,
  -> { OpenAI::Internal::Type::ArrayOf[OpenAI::Chat::ChatCompletionChunk::Choice::Delta::ToolCall] }
)

Class Method Details

.values ⇒ Array<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/openai/models/chat/chat_completion_chunk.rb', line 393

Instance Method Details

#to_hash ⇒ { ?audio: OpenAI::Chat::ChatCompletionChunk::Choice::Delta::Audio, ?content: String?, ?function_call: OpenAI::Chat::ChatCompletionChunk::Choice::Delta::FunctionCall, ?refusal: String?, ?role: OpenAI::Models::Chat::ChatCompletionChunk::Choice::Delta::role, ?tool_calls: ::Array[OpenAI::Chat::ChatCompletionChunk::Choice::Delta::ToolCall] }

Returns:

  • ({ ?audio: OpenAI::Chat::ChatCompletionChunk::Choice::Delta::Audio, ?content: String?, ?function_call: OpenAI::Chat::ChatCompletionChunk::Choice::Delta::FunctionCall, ?refusal: String?, ?role: OpenAI::Models::Chat::ChatCompletionChunk::Choice::Delta::role, ?tool_calls: ::Array[OpenAI::Chat::ChatCompletionChunk::Choice::Delta::ToolCall] })


308
309
310
311
312
313
314
315
# File 'sig/openai/models/chat/chat_completion_chunk.rbs', line 308

def to_hash: -> {
  ?audio: OpenAI::Chat::ChatCompletionChunk::Choice::Delta::Audio,
  ?content: String?,
  ?function_call: OpenAI::Chat::ChatCompletionChunk::Choice::Delta::FunctionCall,
  ?refusal: String?,
  ?role: OpenAI::Models::Chat::ChatCompletionChunk::Choice::Delta::role,
  ?tool_calls: ::Array[OpenAI::Chat::ChatCompletionChunk::Choice::Delta::ToolCall]
}