[ Edit, Add ] edited and updated docs of moderation model directory files code

This commit is contained in:
Anas Fikhi
2023-11-22 03:41:57 +01:00
parent a201cd8409
commit 313b07ce4c
4 changed files with 21 additions and 5 deletions

View File

@ -6,21 +6,27 @@ import 'sub_models/result.dart';
export 'sub_models/result.dart';
/// {@template openai_moderation_model}
/// This class is used to represent an OpenAI moderation job.
/// {@endtemplate}
@immutable
final class OpenAIModerationModel {
/// The ID of the moderation job.
/// The [id]entifier of the moderation job.
final String id;
/// The model used for moderation.
/// The [model] used for moderation.
final String model;
/// The results of the moderation job.
/// The [results] of the moderation job.
final List<OpenAIModerationResultModel> results;
/// Weither the moderation job have at least one result in [results].
bool get haveResults => results.isNotEmpty;
@override
int get hashCode => id.hashCode ^ model.hashCode ^ results.hashCode;
/// This class is used to represent an OpenAI moderation job.
/// {@macro openai_moderation_model}
const OpenAIModerationModel({
required this.id,
required this.model,

View File

@ -1,5 +1,8 @@
import 'package:meta/meta.dart';
/// {@template openai_moderation_result_categories_model}
/// This class is used to represent an OpenAI moderation job result categories.
/// {@endtemplate}
@immutable
final class OpenAIModerationResultCategoriesModel {
/// The hate category.
@ -56,6 +59,7 @@ final class OpenAIModerationResultCategoriesModel {
/// Whether the moderation request is not safe or not.
bool get isNotSafe => !isSafe;
@override
int get hashCode {
return hate.hashCode ^

View File

@ -1,5 +1,8 @@
import 'package:meta/meta.dart';
/// {@template openai_moderation_result_scores_model}
/// This class is used to represent an OpenAI moderation job result scores.
/// {@endtemplate}
@immutable
final class OpenAIModerationResultScoresModel {
/// The hate score of the moderation job.

View File

@ -6,6 +6,9 @@ import 'catgeories_scores.dart';
export 'catgeories.dart';
export 'catgeories_scores.dart';
/// {@template openai_moderation_result_model}
/// This class is used to represent an OpenAI moderation job result.
/// {@endtemplate}
@immutable
final class OpenAIModerationResultModel {
/// The categories of the moderation job.
@ -21,7 +24,7 @@ final class OpenAIModerationResultModel {
int get hashCode =>
categories.hashCode ^ categoryScores.hashCode ^ flagged.hashCode;
/// This class is used to represent an OpenAI moderation job result.
/// {@macro openai_moderation_result_model}
const OpenAIModerationResultModel({
required this.categories,
required this.categoryScores,