Class: OpenAI::Models::Completion

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/openai/models/completion.rb

Overview

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, 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(id: , choices: , created: , model: , system_fingerprint: nil, usage: nil, object: :text_completion) ⇒ void

Some parameter documentations has been truncated, see OpenAI::Models::Completion for more details.

Represents a completion response from the API. Note: both the streamed and non-streamed response objects share the same shape (unlike the chat endpoint).

Parameters:

  • id (String) (defaults to: )

    A unique identifier for the completion.

  • choices (Array<OpenAI::Models::CompletionChoice>) (defaults to: )

    The list of completion choices the model generated for the input prompt.

  • created (Integer) (defaults to: )

    The Unix timestamp (in seconds) of when the completion was created.

  • model (String) (defaults to: )

    The model used for completion.

  • system_fingerprint (String) (defaults to: nil)

    This fingerprint represents the backend configuration that the model runs with.

  • usage (OpenAI::Models::CompletionUsage) (defaults to: nil)

    Usage statistics for the completion request.

  • object (Symbol, :text_completion) (defaults to: :text_completion)

    The object type, which is always "text_completion"



# File 'lib/openai/models/completion.rb', line 54

Instance Attribute Details

#choicesArray<OpenAI::Models::CompletionChoice>

The list of completion choices the model generated for the input prompt.



19
# File 'lib/openai/models/completion.rb', line 19

required :choices, -> { OpenAI::Internal::Type::ArrayOf[OpenAI::CompletionChoice] }

#createdInteger

The Unix timestamp (in seconds) of when the completion was created.

Returns:

  • (Integer)


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

required :created, Integer

#idString

A unique identifier for the completion.

Returns:

  • (String)


13
# File 'lib/openai/models/completion.rb', line 13

required :id, String

#modelString

The model used for completion.

Returns:

  • (String)


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

required :model, String

#objectSymbol, :text_completion

The object type, which is always "text_completion"

Returns:

  • (Symbol, :text_completion)


37
# File 'lib/openai/models/completion.rb', line 37

required :object, const: :text_completion

#system_fingerprintString?

This fingerprint represents the backend configuration that the model runs with.

Can be used in conjunction with the seed request parameter to understand when backend changes have been made that might impact determinism.

Returns:

  • (String, nil)


46
# File 'lib/openai/models/completion.rb', line 46

optional :system_fingerprint, String

#usageOpenAI::Models::CompletionUsage?

Usage statistics for the completion request.



52
# File 'lib/openai/models/completion.rb', line 52

optional :usage, -> { OpenAI::CompletionUsage }