MyGit
🚩收到GitHub仓库的更新通知

google-gemini/generative-ai-dart

Fork: 83 Star: 446 (更新于 2024-05-09 05:21:07)

license: Apache-2.0

Language: Dart .

Google AI SDK for Dart

最后发布版本: google_generative_ai-v0.3.3 ( 2024-05-07 08:49:14)

官方网址 GitHub网址

✨免费申请网站SSL证书,支持多域名和泛域名,点击查看

Google Generative AI SDK for Dart

The Google Generative AI SDK for Dart allows developers to use state-of-the-art Large Language Models (LLMs) to build language applications.

[!CAUTION] Using the Google AI SDK for Dart (Flutter) to call the Google AI Gemini API directly from your app is recommended for prototyping only. If you plan to enable billing, we strongly recommend that you use the SDK to call the Google AI Gemini API only server-side to keep your API key safe. You risk potentially exposing your API key to malicious actors if you embed your API key directly in your mobile or web app or fetch it remotely at runtime.

Getting Started

API keys

To use the Gemini API, you'll need an API key. If you don't already have one, create a key in Google AI Studio: https://aistudio.google.com/app/apikey.

Dart samples

See the Dart sample apps at samples/dart, including some getting started instructions.

Flutter sample

See a Flutter sample app at samples/flutter_app, including some getting started instructions.

Using the SDK in your own app

Add a dependency on the package:google_generative_ai package via:

dart pub add google_generative_ai

or:

flutter pub add google_generative_ai

Initializing the API client

final model = GenerativeModel(model: 'gemini-pro', apiKey: apiKey);

Calling the API

final prompt = 'Do these look store-bought or homemade?';
final imageBytes = await File('cookie.png').readAsBytes();
final content = [
  Content.multi([
    TextPart(prompt),
    DataPart('image/png', imageBytes),
  ])
];

final response = await model.generateContent(content);
print(response.text);

Documentation

Find complete documentation for the Google AI SDKs and the Gemini model in the Google documentation: https://ai.google.dev/docs.

Packages

Package Description Version
google_generative_ai The Google Generative AI SDK for Dart - allows access to state-of-the-art LLMs. pub package
samples/dart Dart samples for package:google_generative_ai.
samples/flutter_app A Flutter sample for package:google_generative_ai.

Contributing

See Contributing for more information on contributing to the Generative AI SDK for Dart.

License

The contents of this repository are licensed under the Apache License, version 2.0.

最近版本更新:(数据更新于 2024-05-09 05:20:50)

2024-05-07 08:49:14 google_generative_ai-v0.3.3

2024-04-27 08:39:28 google_generative_ai-v0.3.2

2024-04-19 05:05:53 google_generative_ai-v0.3.1

2024-02-23 07:48:12 google_generative_ai-v0.2.1

主题(topics):

dart, generative-ai, generative-art

google-gemini/generative-ai-dart同语言 Dart最近更新仓库

2024-05-18 10:56:31 felangel/data_class

2024-05-10 17:26:00 AppFlowy-IO/AppFlowy

2024-05-10 15:23:54 ente-io/ente

2024-04-29 05:49:53 ReVanced/revanced-manager

2024-04-24 22:16:57 baumths/flutter_tree_view

2024-04-15 22:08:29 KRTirtho/spotube