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

This commit is contained in:
Anas Fikhi
2023-11-22 03:39:11 +01:00
parent 85b4b6b4fe
commit a201cd8409
4 changed files with 38 additions and 13 deletions

View File

@ -6,12 +6,15 @@ export 'sub_models/data.dart';
@immutable
final class OpenAIImageModel {
/// The time the image was created.
/// The time the image was [created].
final DateTime created;
/// The data of the image.
final List<OpenAIImageData> data;
/// Weither the image have some [data].
bool get haveData => data.isNotEmpty;
@override
int get hashCode => created.hashCode ^ data.hashCode;

View File

@ -1,18 +1,30 @@
import 'package:meta/meta.dart';
/// {@template openai_image_data_model}
/// This class is used to represent an OpenAI image data.
/// {@endtemplate}
@immutable
final class OpenAIImageData {
/// The URL of the image.
/// The [URL] of the image.
final String? url;
/// the [OpenAIImageResponseFormat] b64Json data
/// The [b64Json] data.
final String? b64Json;
///
/// The revised prompt.
final String? revisedPrompt;
/// Weither the image have a [URL] result.
bool get haveUrl => url != null;
/// Weither the image have a [b64Json] result.
bool get haveB64Json => b64Json != null;
/// Weither the image have a revised prompt.
bool get haveRevisedPrompt => revisedPrompt != null;
@override
int get hashCode => url.hashCode;
int get hashCode => url.hashCode ^ b64Json.hashCode ^ revisedPrompt.hashCode;
/// This class is used to represent an OpenAI image data.
const OpenAIImageData({

View File

@ -3,21 +3,27 @@ import 'package:meta/meta.dart';
import 'sub_models/permission.dart';
/// {@template openai_model_model}
/// This class is used to represent an OpenAI model.
/// {@endtemplate}
@immutable
final class OpenAIModelModel {
/// The ID of the model.
/// The [id]entifier of the model.
final String id;
/// The name of the organization that owns the model.
final String ownedBy;
/// The permissions of the model.
/// The [permission]s of the model.
final List<OpenAIModelModelPermission>? permission;
@override
int get hashCode => id.hashCode ^ ownedBy.hashCode;
/// Weither the model have at least one permission in [permission].
bool get havePermission => permission != null;
/// This class is used to represent an OpenAI model.
@override
int get hashCode => id.hashCode ^ ownedBy.hashCode ^ permission.hashCode;
/// {@macro openai_model_model}
const OpenAIModelModel({
required this.id,
required this.ownedBy,
@ -43,7 +49,8 @@ final class OpenAIModelModel {
}
@override
String toString() => 'OpenAIModelModel(id: $id, ownedBy: $ownedBy)';
String toString() =>
'OpenAIModelModel(id: $id, ownedBy: $ownedBy, permission: $permission)';
@override
bool operator ==(covariant OpenAIModelModel other) {

View File

@ -1,11 +1,14 @@
import 'package:meta/meta.dart';
/// {@template openai_model_model_permission}
/// This class is used to represent an OpenAI model permission.
/// {@endtemplate}
@immutable
final class OpenAIModelModelPermission {
/// The ID of the permission.
/// The [id]entifier of the permission.
final String? id;
/// The time the permission was created.
/// The time the permission was [created].
final DateTime? created;
/// Whether the permission allows the user to create engines.