Skip to content

Commit

Permalink
[ Edit, Add ] edited and updated docs of moderation model directory f…
Browse files Browse the repository at this point in the history
…iles code
  • Loading branch information
anasfik committed Nov 22, 2023
1 parent a201cd8 commit 313b07c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
14 changes: 10 additions & 4 deletions lib/src/core/models/moderation/moderation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions lib/src/core/models/moderation/sub_models/catgeories.dart
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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 ^
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
5 changes: 4 additions & 1 deletion lib/src/core/models/moderation/sub_models/result.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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,
Expand Down

0 comments on commit 313b07c

Please sign in to comment.