The Google Generative AI SDK for Dart allows developers to use state-of-the-art Large Language Models (LLMs) to build language applications.
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://makersuite.google.com/app/apikey.
See the Dart sample apps at samples/dart, including getting some started instructions.
See a Flutter sample app at samples/flutter_app, including some getting started instructions.
Add a dependency on this repository to the path pkgs/google_generative_ai
.
Once the API is stable the package will be available from pub. We welcome
pre-publish feedback through GitHub issues.
dependencies:
google_generative_ai:
git:
url: git@github.com:google/generative-ai-dart.git
path: pkgs/google_generative_ai
ref: main
final model = GenerativeModel(model: 'gemini-pro', apiKey: apiKey);
final prompt = 'Write a story about a magic backpack.';
final content = [Content.text(prompt)];
final response = await model.generateContent(content);
print(response.text);
Find complete documentation for the Google AI SDKs and the Gemini model in the Google documentation: https://ai.google.dev/docs.
Package | Description | Version |
---|---|---|
google_generative_ai | The Google Generative AI SDK for Dart - allows access to state-of-the-art LLMs. | |
samples/dart | Dart samples for package:google_generative_ai . |
|
samples/flutter_app | Flutter sample for package:google_generative_ai . |
See Contributing for more information on contributing to the Generative AI SDK for Dart.
The contents of this repository are licensed under the Apache License, version 2.0.