Class: OpenAI::Models::Chat::ChatCompletion
- Inherits:
-
Internal::Type::BaseModel
- Object
- Internal::Type::BaseModel
- OpenAI::Models::Chat::ChatCompletion
- Defined in:
- lib/openai/models/chat/chat_completion.rb,
sig/openai/models/chat/chat_completion.rbs
Overview
Direct Known Subclasses
Defined Under Namespace
Modules: ServiceTier Classes: Choice, Moderation
Instance Attribute Summary collapse
-
#choices ⇒ Array<OpenAI::Models::Chat::ChatCompletion::Choice>
A list of chat completion choices.
-
#created ⇒ Integer
The Unix timestamp (in seconds) of when the chat completion was created.
-
#id ⇒ String
A unique identifier for the chat completion.
-
#model ⇒ String
The model used for the chat completion.
-
#moderation ⇒ OpenAI::Models::Chat::ChatCompletion::Moderation?
Moderation results for the request input and generated output, if moderated completions were requested.
-
#object ⇒ Symbol, :"chat.completion"
The object type, which is always
chat.completion. -
#service_tier ⇒ Symbol, ...
Specifies the processing type used for serving the request.
- #system_fingerprint ⇒ String? deprecated Deprecated.
-
#usage ⇒ OpenAI::Models::CompletionUsage?
Usage statistics for the completion request.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(code:, message:, type: :error) ⇒ Object
constructor
An error produced while attempting moderation.
- #to_hash ⇒ {
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, 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(code:, message:, type: :error) ⇒ Object
An error produced while attempting moderation.
|
|
# File 'lib/openai/models/chat/chat_completion.rb', line 194
|
Instance Attribute Details
#choices ⇒ Array<OpenAI::Models::Chat::ChatCompletion::Choice>
A list of chat completion choices. Can be more than one if n is greater
than 1.
21 |
# File 'lib/openai/models/chat/chat_completion.rb', line 21 required :choices, -> { OpenAI::Internal::Type::ArrayOf[OpenAI::Chat::ChatCompletion::Choice] } |
#created ⇒ Integer
The Unix timestamp (in seconds) of when the chat completion was created.
27 |
# File 'lib/openai/models/chat/chat_completion.rb', line 27 required :created, Integer |
#id ⇒ String
A unique identifier for the chat completion.
14 |
# File 'lib/openai/models/chat/chat_completion.rb', line 14 required :id, String |
#model ⇒ String
The model used for the chat completion.
33 |
# File 'lib/openai/models/chat/chat_completion.rb', line 33 required :model, String |
#moderation ⇒ OpenAI::Models::Chat::ChatCompletion::Moderation?
Moderation results for the request input and generated output, if moderated completions were requested.
46 |
# File 'lib/openai/models/chat/chat_completion.rb', line 46 optional :moderation, -> { OpenAI::Chat::ChatCompletion::Moderation }, nil?: true |
#object ⇒ Symbol, :"chat.completion"
The object type, which is always chat.completion.
39 |
# File 'lib/openai/models/chat/chat_completion.rb', line 39 required :object, const: :"chat.completion" |
#service_tier ⇒ Symbol, ...
Specifies the processing type used for serving the request.
- If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'.
- If set to 'default', then the request will be processed with the standard pricing and performance for the selected model.
- If set to 'flex' or 'priority', then the request will be processed with the corresponding service tier.
- When not set, the default behavior is 'auto'.
When the service_tier parameter is set, the response body will include the
service_tier value based on the processing mode actually used to serve the
request. This response value may be different from the value set in the
parameter.
67 |
# File 'lib/openai/models/chat/chat_completion.rb', line 67 optional :service_tier, enum: -> { OpenAI::Chat::ChatCompletion::ServiceTier }, nil?: true |
#system_fingerprint ⇒ String?
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.
78 |
# File 'lib/openai/models/chat/chat_completion.rb', line 78 optional :system_fingerprint, String |
#usage ⇒ OpenAI::Models::CompletionUsage?
Usage statistics for the completion request.
84 |
# File 'lib/openai/models/chat/chat_completion.rb', line 84 optional :usage, -> { OpenAI::CompletionUsage } |
Class Method Details
.variants ⇒ Array(OpenAI::Models::Chat::ChatCompletion::Moderation::Output::ModerationResults, OpenAI::Models::Chat::ChatCompletion::Moderation::Output::Error)
|
|
# File 'lib/openai/models/chat/chat_completion.rb', line 525
|
Instance Method Details
#to_hash ⇒ {
54 |
# File 'sig/openai/models/chat/chat_completion.rbs', line 54
def to_hash: -> {
|