From dc5af42cfe5ec8034b02d50c4b51da829cde4617 Mon Sep 17 00:00:00 2001 From: Manas Hejmadi Date: Mon, 23 Jun 2025 01:55:21 +0530 Subject: [PATCH] genai: Example Project added + README --- packages/genai/README.md | 58 ++- packages/genai/example/.gitignore | 45 ++ packages/genai/example/README.md | 59 +++ packages/genai/example/analysis_options.yaml | 28 ++ packages/genai/example/lib/main.dart | 184 ++++++++ packages/genai/example/pubspec.lock | 432 +++++++++++++++++++ packages/genai/example/pubspec.yaml | 91 ++++ packages/genai/models.json | 2 +- 8 files changed, 897 insertions(+), 2 deletions(-) create mode 100644 packages/genai/example/.gitignore create mode 100644 packages/genai/example/README.md create mode 100644 packages/genai/example/analysis_options.yaml create mode 100644 packages/genai/example/lib/main.dart create mode 100644 packages/genai/example/pubspec.lock create mode 100644 packages/genai/example/pubspec.yaml diff --git a/packages/genai/README.md b/packages/genai/README.md index ea898451..0e12b996 100644 --- a/packages/genai/README.md +++ b/packages/genai/README.md @@ -1,2 +1,58 @@ # genai package -This Package contains all the code related to generative AI capabilities and is a foundational package that can be used in various projects \ No newline at end of file +This Package contains all the code related to generative AI capabilities and is a foundational package that can be used in various projects + +### Fetch all available Remote LLMs +```dart +await LLMManager.fetchAvailableLLMs(); +``` + +### Getting LLM Models for a given Provider +```dart +final List models = LLMProvider.gemini.models; +``` + +### Calling a GenAI Model using the provided helper +```dart +final LLMModel geminiModel = LLMProvider.gemini.getLLMByIdentifier('gemini-2.0-flash'); +final ModelController controller = model.provider.modelController; +GenerativeAI.callGenerativeModel( + geminiModel, + onAnswer: (x) { + print(x); + }, + onError: (e){}, + systemPrompt: 'Give a 100 word summary of the provided word. Only give the answer', + userPrompt: 'Pizza', + credential: 'AIza.....', +); +``` + +### Calling a GenAI model (with Streaming) +```dart +final LLMModel geminiModel = LLMProvider.gemini.getLLMByIdentifier('gemini-2.0-flash'); +final ModelController controller = model.provider.modelController; +GenerativeAI.callGenerativeModel( + geminiModel, + onAnswer: (x) { + stdout.write(x); //each word in the stream + }, + onError: (e){}, + systemPrompt: 'Give a 100 word summary of the provided word. Only give the answer', + userPrompt: 'Pizza', + credential: 'AIza.....', + stream: true, +); +``` + +### Directly Using a Model (eg: Gemini) +```dart +final LLMModel model = LLMProvider.gemini.getLLMByIdentifier('gemini-2.0-flash'); +final ModelController controller = model.provider.modelController; +final payload = controller.inputPayload; +payload.systemPrompt = 'Say YES or NO'; +payload.userPrompt = 'The sun sets in the west'; +payload.credential = 'AIza....'; +final genAIRequest = controller.createRequest(model, payload); +final answer = await GenerativeAI.executeGenAIRequest(model, genAIRequest); +print(answer) +``` \ No newline at end of file diff --git a/packages/genai/example/.gitignore b/packages/genai/example/.gitignore new file mode 100644 index 00000000..79c113f9 --- /dev/null +++ b/packages/genai/example/.gitignore @@ -0,0 +1,45 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.build/ +.buildlog/ +.history +.svn/ +.swiftpm/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.pub-cache/ +.pub/ +/build/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/packages/genai/example/README.md b/packages/genai/example/README.md new file mode 100644 index 00000000..70e37aa4 --- /dev/null +++ b/packages/genai/example/README.md @@ -0,0 +1,59 @@ +# GenAI Example + +This project is a simple demonstration of how to use the GenAI package + +### Fetch all available Remote LLMs +```dart +await LLMManager.fetchAvailableLLMs(); +``` + +### Getting LLM Models for a given Provider +```dart +final List models = LLMProvider.gemini.models; +``` + +### Calling a GenAI Model using the provided helper +```dart +final LLMModel geminiModel = LLMProvider.gemini.getLLMByIdentifier('gemini-2.0-flash'); +final ModelController controller = model.provider.modelController; +GenerativeAI.callGenerativeModel( + geminiModel, + onAnswer: (x) { + print(x); + }, + onError: (e){}, + systemPrompt: 'Give a 100 word summary of the provided word. Only give the answer', + userPrompt: 'Pizza', + credential: 'AIza.....', +); +``` + +### Calling a GenAI model (with Streaming) +```dart +final LLMModel geminiModel = LLMProvider.gemini.getLLMByIdentifier('gemini-2.0-flash'); +final ModelController controller = model.provider.modelController; +GenerativeAI.callGenerativeModel( + geminiModel, + onAnswer: (x) { + stdout.write(x); //each word in the stream + }, + onError: (e){}, + systemPrompt: 'Give a 100 word summary of the provided word. Only give the answer', + userPrompt: 'Pizza', + credential: 'AIza.....', + stream: true, +); +``` + +### Directly Using a Model (eg: Gemini) +```dart +final LLMModel model = LLMProvider.gemini.getLLMByIdentifier('gemini-2.0-flash'); +final ModelController controller = model.provider.modelController; +final payload = controller.inputPayload; +payload.systemPrompt = 'Say YES or NO'; +payload.userPrompt = 'The sun sets in the west'; +payload.credential = 'AIza....'; +final genAIRequest = controller.createRequest(model, payload); +final answer = await GenerativeAI.executeGenAIRequest(model, genAIRequest); +print(answer) +``` \ No newline at end of file diff --git a/packages/genai/example/analysis_options.yaml b/packages/genai/example/analysis_options.yaml new file mode 100644 index 00000000..0d290213 --- /dev/null +++ b/packages/genai/example/analysis_options.yaml @@ -0,0 +1,28 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at https://dart.dev/lints. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/packages/genai/example/lib/main.dart b/packages/genai/example/lib/main.dart new file mode 100644 index 00000000..cee60173 --- /dev/null +++ b/packages/genai/example/lib/main.dart @@ -0,0 +1,184 @@ +import 'package:flutter/material.dart'; +import 'package:genai/genai.dart'; + +void main() { + runApp(const GenAIExample()); +} + +class GenAIExample extends StatelessWidget { + const GenAIExample({super.key}); + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'GenAI Example', + theme: ThemeData( + colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), + ), + home: AIExample(), + ); + } +} + +class AIExample extends StatefulWidget { + const AIExample({super.key}); + + @override + State createState() => _AIExampleState(); +} + +class _AIExampleState extends State { + @override + void initState() { + super.initState(); + () async { + await LLMManager.fetchAvailableLLMs(); //fetch latest LLMs + await LLMManager.loadAvailableLLMs(); //Load Saved LLMs + setState(() {}); + }(); + LLMManager.fetchAvailableLLMs().then((_) { + LLMManager.loadAvailableLLMs().then((_) {}); + }); + systemPromptController.text = 'Give me a 200 word essay on the given topic'; + inputPromptController.text = 'Apple'; + } + + generateAIResponse({bool stream = false}) { + setState(() { + output = ""; + }); + GenerativeAI.callGenerativeModel( + LLMProvider.fromName( + selectedProvider, + ).getLLMByIdentifier(selectedModel![0]), + onAnswer: (x) { + setState(() { + output += "$x "; + }); + }, + onError: (e) { + print(e); + }, + systemPrompt: systemPromptController.value.text, + userPrompt: inputPromptController.value.text, + credential: credentialController.value.text, + stream: stream, + ); + } + + String output = ""; + String selectedProvider = 'ollama'; + List? selectedModel; + + TextEditingController systemPromptController = TextEditingController(); + TextEditingController inputPromptController = TextEditingController(); + TextEditingController credentialController = TextEditingController(); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: Text('GenAI Example')), + body: SingleChildScrollView( + padding: EdgeInsets.all(20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text('Providers'), + SizedBox(height: 10), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + ...LLMManager.avaiableModels.keys.map( + (x) => Container( + child: GestureDetector( + onTap: () { + setState(() { + selectedProvider = x; + }); + }, + child: Chip( + label: Text(x), + backgroundColor: selectedProvider == x + ? Colors.blue[50] + : Colors.transparent, + ), + ), + padding: EdgeInsets.only(right: 10), + ), + ), + ], + ), + SizedBox(height: 20), + Text('Models'), + SizedBox(height: 10), + Wrap( + spacing: 5, + runSpacing: 5, + children: [ + ...(LLMManager.avaiableModels[selectedProvider] ?? []).map( + (x) => Container( + child: GestureDetector( + onTap: () { + setState(() { + selectedModel = x; + }); + }, + child: Chip( + label: Text(x[1].toString()), + backgroundColor: selectedModel == x + ? Colors.blue[50] + : Colors.transparent, + ), + ), + padding: EdgeInsets.only(right: 10), + ), + ), + ], + ), + SizedBox(height: 30), + Container( + width: 400, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text('Input Prompt'), + TextField(controller: inputPromptController), + SizedBox(height: 20), + Text('System Prompt'), + TextField(controller: systemPromptController), + SizedBox(height: 20), + Text('Credential'), + TextField(controller: credentialController), + SizedBox(height: 20), + ], + ), + ), + SizedBox(height: 30), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + ElevatedButton( + onPressed: () { + generateAIResponse(); + }, + child: Text('Generate Response (SINGLE-RESPONSE)'), + ), + SizedBox(width: 20), + ElevatedButton( + onPressed: () { + generateAIResponse(stream: true); + }, + child: Text('Generate Response (STREAM)'), + ), + ], + ), + SizedBox(height: 30), + Divider(), + SizedBox(height: 20), + + Text(output), + ], + ), + ), + ); + } +} diff --git a/packages/genai/example/pubspec.lock b/packages/genai/example/pubspec.lock new file mode 100644 index 00000000..c6afd837 --- /dev/null +++ b/packages/genai/example/pubspec.lock @@ -0,0 +1,432 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + async: + dependency: transitive + description: + name: async + sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb" + url: "https://pub.dev" + source: hosted + version: "2.13.0" + better_networking: + dependency: transitive + description: + path: "../../better_networking" + relative: true + source: path + version: "0.0.1" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + characters: + dependency: transitive + description: + name: characters + sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + clock: + dependency: transitive + description: + name: clock + sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b + url: "https://pub.dev" + source: hosted + version: "1.1.2" + collection: + dependency: transitive + description: + name: collection + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" + source: hosted + version: "1.19.1" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 + url: "https://pub.dev" + source: hosted + version: "1.0.8" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" + url: "https://pub.dev" + source: hosted + version: "1.3.3" + ffi: + dependency: transitive + description: + name: ffi + sha256: "289279317b4b16eb2bb7e271abccd4bf84ec9bdcbe999e278a94b804f5630418" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + file: + dependency: transitive + description: + name: file + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + url: "https://pub.dev" + source: hosted + version: "7.0.1" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1" + url: "https://pub.dev" + source: hosted + version: "5.0.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + freezed_annotation: + dependency: transitive + description: + name: freezed_annotation + sha256: c2e2d632dd9b8a2b7751117abcfc2b4888ecfe181bd9fca7170d9ef02e595fe2 + url: "https://pub.dev" + source: hosted + version: "2.4.4" + genai: + dependency: "direct main" + description: + path: ".." + relative: true + source: path + version: "0.0.1" + http: + dependency: transitive + description: + name: http + sha256: "2c11f3f94c687ee9bad77c171151672986360b2b001d109814ee7140b2cf261b" + url: "https://pub.dev" + source: hosted + version: "1.4.0" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" + url: "https://pub.dev" + source: hosted + version: "4.1.2" + json5: + dependency: transitive + description: + name: json5 + sha256: b67d6e06c9e225c8277d3c43f796677af7975a2a2b0669ff12ba38ff466a31f4 + url: "https://pub.dev" + source: hosted + version: "0.8.2" + json_annotation: + dependency: transitive + description: + name: json_annotation + sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" + url: "https://pub.dev" + source: hosted + version: "4.9.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0" + url: "https://pub.dev" + source: hosted + version: "10.0.9" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573 + url: "https://pub.dev" + source: hosted + version: "3.0.9" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" + lints: + dependency: transitive + description: + name: lints + sha256: c35bb79562d980e9a453fc715854e1ed39e24e7d0297a880ef54e17f9874a9d7 + url: "https://pub.dev" + source: hosted + version: "5.1.1" + matcher: + dependency: transitive + description: + name: matcher + sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 + url: "https://pub.dev" + source: hosted + version: "0.12.17" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + url: "https://pub.dev" + source: hosted + version: "0.11.1" + meta: + dependency: transitive + description: + name: meta + sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c + url: "https://pub.dev" + source: hosted + version: "1.16.0" + path: + dependency: transitive + description: + name: path + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 + url: "https://pub.dev" + source: hosted + version: "2.2.1" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 + url: "https://pub.dev" + source: hosted + version: "2.3.0" + petitparser: + dependency: transitive + description: + name: petitparser + sha256: "07c8f0b1913bcde1ff0d26e57ace2f3012ccbf2b204e070290dad3bb22797646" + url: "https://pub.dev" + source: hosted + version: "6.1.0" + platform: + dependency: transitive + description: + name: platform + sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" + url: "https://pub.dev" + source: hosted + version: "3.1.6" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + seed: + dependency: transitive + description: + name: seed + sha256: "0d74a46abd169c96a73d9dec4739e6623021915661beadf265e885bb1eafd214" + url: "https://pub.dev" + source: hosted + version: "0.0.3" + shared_preferences: + dependency: transitive + description: + name: shared_preferences + sha256: "6e8bf70b7fef813df4e9a36f658ac46d107db4b4cfe1048b477d4e453a8159f5" + url: "https://pub.dev" + source: hosted + version: "2.5.3" + shared_preferences_android: + dependency: transitive + description: + name: shared_preferences_android + sha256: "20cbd561f743a342c76c151d6ddb93a9ce6005751e7aa458baad3858bfbfb6ac" + url: "https://pub.dev" + source: hosted + version: "2.4.10" + shared_preferences_foundation: + dependency: transitive + description: + name: shared_preferences_foundation + sha256: "6a52cfcdaeac77cad8c97b539ff688ccfc458c007b4db12be584fbe5c0e49e03" + url: "https://pub.dev" + source: hosted + version: "2.5.4" + shared_preferences_linux: + dependency: transitive + description: + name: shared_preferences_linux + sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + shared_preferences_platform_interface: + dependency: transitive + description: + name: shared_preferences_platform_interface + sha256: "57cbf196c486bc2cf1f02b85784932c6094376284b3ad5779d1b1c6c6a816b80" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + shared_preferences_web: + dependency: transitive + description: + name: shared_preferences_web + sha256: c49bd060261c9a3f0ff445892695d6212ff603ef3115edbb448509d407600019 + url: "https://pub.dev" + source: hosted + version: "2.4.3" + shared_preferences_windows: + dependency: transitive + description: + name: shared_preferences_windows + sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + source_span: + dependency: transitive + description: + name: source_span + sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" + url: "https://pub.dev" + source: hosted + version: "1.10.1" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" + url: "https://pub.dev" + source: hosted + version: "1.12.1" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" + source: hosted + version: "1.4.1" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" + source: hosted + version: "1.2.2" + test_api: + dependency: transitive + description: + name: test_api + sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd + url: "https://pub.dev" + source: hosted + version: "0.7.4" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02 + url: "https://pub.dev" + source: hosted + version: "15.0.0" + web: + dependency: transitive + description: + name: web + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + xml: + dependency: transitive + description: + name: xml + sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 + url: "https://pub.dev" + source: hosted + version: "6.5.0" +sdks: + dart: ">=3.8.0 <4.0.0" + flutter: ">=3.27.0" diff --git a/packages/genai/example/pubspec.yaml b/packages/genai/example/pubspec.yaml new file mode 100644 index 00000000..8a3c302e --- /dev/null +++ b/packages/genai/example/pubspec.yaml @@ -0,0 +1,91 @@ +name: example +description: "A new Flutter project." +# The following line prevents the package from being accidentally published to +# pub.dev using `flutter pub publish`. This is preferred for private packages. +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +# In Windows, build-name is used as the major, minor, and patch parts +# of the product and file versions while build-number is used as the build suffix. +version: 1.0.0+1 + +environment: + sdk: ^3.8.0 + +# Dependencies specify other packages that your package needs in order to work. +# To automatically upgrade your package dependencies to the latest versions +# consider running `flutter pub upgrade --major-versions`. Alternatively, +# dependencies can be manually updated by changing the version numbers below to +# the latest version available on pub.dev. To see which dependencies have newer +# versions available, run `flutter pub outdated`. +dependencies: + flutter: + sdk: flutter + genai: + path: .. + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.8 + +dev_dependencies: + flutter_test: + sdk: flutter + + # The "flutter_lints" package below contains a set of recommended lints to + # encourage good coding practices. The lint set provided by the package is + # activated in the `analysis_options.yaml` file located at the root of your + # package. See that file for information about deactivating specific lint + # rules and activating additional ones. + flutter_lints: ^5.0.0 + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter packages. +flutter: + + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add assets to your application, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/to/resolution-aware-images + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/to/asset-from-package + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/to/font-from-package diff --git a/packages/genai/models.json b/packages/genai/models.json index e29e6fc8..b8156b72 100644 --- a/packages/genai/models.json +++ b/packages/genai/models.json @@ -85,7 +85,7 @@ "Gemini 2.0 Flash Lite" ], [ - "gemini-2.5-flash-preview_0520", + "gemini-2.5-flash-preview-0520", "Gemini 2.5 Flash Preview 0520" ] ],