// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: invalid_annotation_target
part of open_a_i_schema;

// ==========================================
// CLASS: CompletionLogprobs
// ==========================================

/// The probabilities on the `logprobs` most likely tokens, as well the chosen tokens. For example, if `logprobs` is 5, the API will return a list of the 5 most likely tokens. The API will always return the `logprob` of the sampled token, so there may be up to `logprobs+1` elements in the response.
@freezed
class CompletionLogprobs with _$CompletionLogprobs {
  const CompletionLogprobs._();

  /// Factory constructor for CompletionLogprobs
  const factory CompletionLogprobs({
    /// The offset of the token from the beginning of the prompt.
    @JsonKey(name: 'text_offset', includeIfNull: false) List<int>? textOffset,

    /// The log probabilities of tokens in the completion.
    @JsonKey(name: 'token_logprobs', includeIfNull: false)
    List<double?>? tokenLogprobs,

    /// The tokens generated by the model converted back to text.
    @JsonKey(includeIfNull: false) List<String>? tokens,

    /// The log probabilities of the `logprobs` most likely tokens.
    @JsonKey(name: 'top_logprobs', includeIfNull: false)
    List<Map<String, double>?>? topLogprobs,
  }) = _CompletionLogprobs;

  /// Object construction from a JSON representation
  factory CompletionLogprobs.fromJson(Map<String, dynamic> json) =>
      _$CompletionLogprobsFromJson(json);

  /// List of all property names of schema
  static const List<String> propertyNames = [
    'text_offset',
    'token_logprobs',
    'tokens',
    'top_logprobs'
  ];

  /// Perform validations on the schema property values
  String? validateSchema() {
    return null;
  }

  /// Map representation of object (not serialized)
  Map<String, dynamic> toMap() {
    return {
      'text_offset': textOffset,
      'token_logprobs': tokenLogprobs,
      'tokens': tokens,
      'top_logprobs': topLogprobs,
    };
  }
}
