CreateCompletionRequest class
Request object for the Create completion endpoint.
- Annotations
-
- @freezed
Constructors
-
CreateCompletionRequest.new({@_CompletionModelConverter() required CompletionModel model, @_CompletionPromptConverter() required CompletionPrompt? prompt, @JsonKey(name: 'best_of', includeIfNull: false) int? bestOf, @JsonKey(includeIfNull: false) @Default(false) bool? echo, @JsonKey(name: 'frequency_penalty', includeIfNull: false) @Default(0.0) double? frequencyPenalty, @JsonKey(name: 'logit_bias', includeIfNull: false) Map<
String, int> ? logitBias, @JsonKey(includeIfNull: false) int? logprobs, @JsonKey(name: 'max_tokens', includeIfNull: false) @Default(16) int? maxTokens, @JsonKey(includeIfNull: false) @Default(1) int? n, @JsonKey(name: 'presence_penalty', includeIfNull: false) @Default(0.0) double? presencePenalty, @JsonKey(includeIfNull: false) int? seed, @_CompletionStopConverter() @JsonKey(includeIfNull: false) CompletionStop? stop, @JsonKey(includeIfNull: false) @Default(false) bool? stream, @JsonKey(name: 'stream_options', includeIfNull: false) ChatCompletionStreamOptions? streamOptions, @JsonKey(includeIfNull: false) String? suffix, @JsonKey(includeIfNull: false) @Default(1.0) double? temperature, @JsonKey(name: 'top_p', includeIfNull: false) @Default(1.0) double? topP, @JsonKey(includeIfNull: false) String? user}) -
Factory constructor for CreateCompletionRequest
constfactory
-
CreateCompletionRequest.fromJson(Map<
String, dynamic> json) -
Object construction from a JSON representation
factory
Properties
- bestOf → int?
-
Generates
best_of
completions server-side and returns the "best" (the one with the highest log probability per token). Results cannot be streamed.no setterinherited -
copyWith
→ $CreateCompletionRequestCopyWith<
CreateCompletionRequest> -
Create a copy of CreateCompletionRequest
with the given fields replaced by the non-null parameter values.
no setterinherited
- echo → bool?
-
Echo back the prompt in addition to the completion
no setterinherited
- frequencyPenalty → double?
-
Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the
text so far, decreasing the model's likelihood to repeat the same line verbatim.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
-
logitBias
→ Map<
String, int> ? -
Modify the likelihood of specified tokens appearing in the completion.
no setterinherited
- logprobs → int?
-
Include the log probabilities on the
logprobs
most likely output tokens, as well the chosen tokens. For example, iflogprobs
is 5, the API will return a list of the 5 most likely tokens. The API will always return thelogprob
of the sampled token, so there may be up tologprobs+1
elements in the response.no setterinherited - maxTokens → int?
-
The maximum number of tokens that can be generated in the completion.
no setterinherited
- model → CompletionModel
-
ID of the model to use. You can use the List models
API to see all of your available models, or see our Model overview for
descriptions of them.
no setterinherited
- n → int?
-
How many completions to generate for each prompt.
no setterinherited
- presencePenalty → double?
-
Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.
no setterinherited
- prompt → CompletionPrompt?
-
The prompt(s) to generate completions for, encoded as a string, array of strings, array of tokens, or array of token arrays.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- seed → int?
-
If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same
seed
and parameters should return the same result.no setterinherited - stop → CompletionStop?
-
Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence.
no setterinherited
- stream → bool?
-
Whether to stream back partial progress. If set, tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a
data: [DONE]
message. Example Python code.no setterinherited - streamOptions → ChatCompletionStreamOptions?
-
Options for streaming response. Only set this when you set
stream: true
.no setterinherited - suffix → String?
-
The suffix that comes after a completion of inserted text.
no setterinherited
- temperature → double?
-
What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.
no setterinherited
- topP → double?
-
An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.
no setterinherited
- user → String?
-
A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. Learn more.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> -
Serializes this CreateCompletionRequest to a JSON map.
inherited
-
toMap(
) → Map< String, dynamic> - Map representation of object (not serialized)
-
toString(
) → String -
A string representation of this object.
inherited
-
validateSchema(
) → String? - Perform validations on the schema property values
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- bestOfMaxValue → const int
- bestOfMinValue → const int
- Validation constants
- frequencyPenaltyDefaultValue → const double
- frequencyPenaltyMaxValue → const double
- frequencyPenaltyMinValue → const double
- logprobsMaxValue → const int
- logprobsMinValue → const int
- maxTokensDefaultValue → const int
- maxTokensMinValue → const int
- nDefaultValue → const int
- nMaxValue → const int
- nMinValue → const int
- presencePenaltyDefaultValue → const double
- presencePenaltyMaxValue → const double
- presencePenaltyMinValue → const double
-
propertyNames
→ const List<
String> - List of all property names of schema
- temperatureDefaultValue → const double
- temperatureMaxValue → const double
- temperatureMinValue → const double
- topPDefaultValue → const double
- topPMaxValue → const double
- topPMinValue → const double