Giter VIP home page Giter VIP logo

generative-ai-dart's Introduction

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.

Getting Started

This repository contains a few sample apps. To try them out, follow these steps:

  • Change directory to the samples package.
  • Export a $GOOGLE_API_KEY environment variable with an API key with access to the Gemini generative models, or run the below commands with an environment containing this variable.
  • Run any sample from the bin directory (e.g., dart bin/simple_text.dart).

Using the SDK in your own app

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: [email protected]:google/generative-ai-dart.git
      path: pkgs/google_generative_ai
      ref: main

Initializing the API client

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

Calling the API

final prompt = 'Write a story about a magic backpack.';
final content = [Content.text(prompt)];
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.
samples/dart Dart samples for package:google_generative_ai.
samples/flutter_app 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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.