2023-02-16 10:17:08 +08:00
|
|
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
2025-01-06 13:34:11 +08:00
|
|
|
|
2023-02-16 10:17:08 +08:00
|
|
|
part 'text_completion.freezed.dart';
|
|
|
|
part 'text_completion.g.dart';
|
|
|
|
|
|
|
|
@freezed
|
|
|
|
class TextCompletionChoice with _$TextCompletionChoice {
|
|
|
|
factory TextCompletionChoice({
|
|
|
|
required String text,
|
|
|
|
required int index,
|
|
|
|
// ignore: invalid_annotation_target
|
2023-03-08 08:58:28 +08:00
|
|
|
@JsonKey(name: 'finish_reason') String? finishReason,
|
2023-02-16 10:17:08 +08:00
|
|
|
}) = _TextCompletionChoice;
|
|
|
|
|
|
|
|
factory TextCompletionChoice.fromJson(Map<String, Object?> json) =>
|
|
|
|
_$TextCompletionChoiceFromJson(json);
|
|
|
|
}
|
|
|
|
|
|
|
|
@freezed
|
|
|
|
class TextCompletionResponse with _$TextCompletionResponse {
|
|
|
|
const factory TextCompletionResponse({
|
|
|
|
required List<TextCompletionChoice> choices,
|
|
|
|
}) = _TextCompletionResponse;
|
|
|
|
|
|
|
|
factory TextCompletionResponse.fromJson(Map<String, Object?> json) =>
|
|
|
|
_$TextCompletionResponseFromJson(json);
|
|
|
|
}
|