Skip to content

Commit

Permalink
Added comments
Browse files Browse the repository at this point in the history
  • Loading branch information
MananGandhi1810 committed May 17, 2024
1 parent 024eeda commit 9295e97
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@

- Updated pubspec.yaml with better description.
- Added comments for readability.

## 1.0.1+1

- Updated pubspec.yaml with better description.
9 changes: 3 additions & 6 deletions lib/src/text_generation/text_generation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,16 @@ export 'models.dart';
export 'response.dart';

class TextGenerationModel {
late String accountId;
late String apiKey;
late TextGenerationModels model;
late bool raw;
late String accountId; // Account ID, available on Cloudflare daskboard
late String apiKey; // API Key, can by generated from the Cloudflare dashboard
late TextGenerationModels model; // The model to use
NetworkService networkService = NetworkService();
late String baseUrl;

TextGenerationModel({
required this.accountId,
required this.apiKey,
required this.model,
this.raw = true,
}) {
baseUrl = "https://api.cloudflare.com/client/v4/accounts/$accountId/ai/run";
}
Expand All @@ -28,7 +26,6 @@ class TextGenerationModel {
Map<String, dynamic> res =
await networkService.post("$baseUrl/${model.value}", apiKey, {
"prompt": prompt,
"raw": raw,
});
TextGenerationResponse response =
TextGenerationResponse.fromJson(res['data']);
Expand Down
6 changes: 3 additions & 3 deletions lib/src/text_summarization/text_summarization.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ export 'models.dart';
export 'response.dart';

class TextSummarizationModel {
late String accountId;
late String apiKey;
late TextSummarizationModels model;
late String accountId; // Account ID, available on Cloudflare daskboard
late String apiKey; // API Key, can by generated from the Cloudflare dashboard
late TextSummarizationModels model; // The model to use
NetworkService networkService = NetworkService();
late String baseUrl;

Expand Down
6 changes: 3 additions & 3 deletions lib/src/text_to_image/text_to_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import 'models.dart';
export 'models.dart';

class TextToImageModel {
late String accountId;
late String apiKey;
late TextToImageModels model;
late String accountId; // Account ID, available on Cloudflare daskboard
late String apiKey; // API Key, can by generated from the Cloudflare dashboard
late TextToImageModels model; // The model to use
NetworkService networkService = NetworkService();
late String baseUrl;

Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: cloudflare_ai
description: This is a Dart package for Cloudflare Workers AI. It provides a simple Dart API to interact with Cloudflare AI. It is built on top of the Dio package. It currently supports Text Generation and Image Generation, Text Summarization, and Image Generation Models. Feel free to contribute to this project through Issues and Pull Requests.
version: 1.0.1
description: This is a Dart package for Cloudflare Workers AI. It currently supports Text Generation and Image Generation, Text Summarization, and Image Generation Models.
version: 1.0.1+1
repository: https://github.com/MananGandhi1810/cloudflare-ai-dart

environment:
Expand Down

0 comments on commit 9295e97

Please sign in to comment.