パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v0.1.2

google_gemini

Flutter用Google Gemini SDK。このパッケージは、FlutterアプリケーションとGoogleの革新的なGemini AIとの間で強力なブリッジを提供します。

AndroidiOSmacOSWindowsLinux
30日間ダウンロード
154
いいね数
69
Pub ポイント
160

パッケージをインストール

flutter pub add google_gemini

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

Flutter用のGoogle Gemini SDKは、Googleの高度なGemini AIをFlutterアプリにシームレスに統合できるようにします。自然言語理解、テキスト生成、マルチモーダル推論などの生成型AI機能を、モバイルおよびデスクトップアプリ内 directly 利用するための堅牢なブリッジを提供します。最先端のAI機能を求める開発者向けに設計されており、Android、iOS、macOS、Windows、Linux プラットフォームをサポートしています。pub addによる簡単なセットアップで、アプリがインテリジェントかつ文脈に応じた対話を実現できるようになります。

用途

  • AI駆動のチャットインターフェース
  • アプリでのコンテンツ生成
  • マルチモーダル画像およびテキスト分析
  • スマートアシスタント機能
  • リアルタイム言語翻訳

主な機能

  • Google Gemini とのネイティブ統合
  • 複数のプラットフォームのサポート
  • シンプルなパブ追加インストール
  • リアルタイムAI応答
  • クロスプラットフォーム互換性

適している対象

  • AIを活用したアプリを開発する開発者
  • 生成型AIを統合するチーム
  • モバイルおよびデスクトップアプリケーション作成者
  • 生産性とコンテンツツール

注意事項

  • API呼び出しにはインターネット接続が必要です
  • Google Cloudの資格情報に依存しています
  • 使用に基づくコストが発生する可能性があります
  • 制限されたオフライン機能
  • API のレート制限が適用されます

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

Google DeepMind Gemini

Google Gemini is a set of cutting-edge large language models (LLMs) designed to be the driving force behind Google's future AI initiatives.

Gemini

This package provides a powerful bridge between your Flutter application and Google's revolutionary Gemini AI. It empowers you to seamlessly integrate Gemini's capabilities into your app, unlocking a world of possibilities for building innovative, intelligent, and engaging experiences that redefine user interaction.

Example

Features

Getting started

To get the API key you have to create a Gemini account on the ai.google.dev. Once you have to Gemini API key, you are ready to start building.

Create Gemini Instance

final gemini = GoogleGemini(
  apiKey: "--- Your Gemini Api Key --- ",
);

Generate content

With Gemini you use both text and image data for prompting, depending on what model variation you use.

For example, you can generate text using text prompt with the gemini-pro model and use both text and image data to prompt the gemini-pro-vision model

Text only input

This feature lets you perform natural language processing (NLP) tasks such as text completion and summarization.

gemini.generateFromText("Tell me a story")
.then((value) => print(value.text))
.catchError((e) => print(e));
Text and image input

You can send a text prompt with an image to the gemini-pro-vision model to perform a vision related task. For example, captioning an image or identifying what's in an image.

File image = File("assets/images.png")

gemini.generateFromTextAndImages(
  query: "What is this picture?",
  image: image
)
.then((value) => print(value.text))
.catchError((e) => print(e));

Configuration

Every prompt you send to the model includes parameter values that control how the model generates a response. The model can generate different results for different parameter values.

Model parameters

The most common model parameters are:

  1. Max output tokens: Specifies the maximum number of tokens that can be generated in the response. A token is approximately four characters. 100 tokens correspond to roughly 60-80 words.

  2. Temperature: The temperature controls the degree of randomness in token selection. Lower temperatures are good for prompts that require a more deterministic or less open-ended response, while higher temperatures can lead to more diverse or creative results.

  3. topK: The topK parameter changes how the model selects tokens for output.

  4. topP: The topP parameter changes how the model selects tokens for output.

  5. stop_sequences: Set a stop sequence to tell the model to stop generating content. A stop sequence can be any sequence of characters. Try to avoid using a sequence of characters that may appear in the generated content.

Example

// Generation Configuration
final config = GenerationConfig(
    temperature: 0.5,
    maxOutputTokens: 100,
    topP: 1.0,
    topK: 40,
    stopSequences: []
);

// Gemini Instance
final gemini = GoogleGemini(
    apiKey: "--- Your Gemini Api Key ---",
    config: config // pass the config here
);
Safety settings

Safety settings are part of the request you send to the text service. It can be adjusted for each request you make to the API.

Categories

These categories cover various kinds of harms that developers may wish to adjust.

HARM_CATEGORY_UNSPECIFIED
HARM_CATEGORY_DEROGATORY
HARM_CATEGORY_TOXICITY
HARM_CATEGORY_VIOLENCE
HARM_CATEGORY_SEXUAL
HARM_CATEGORY_MEDICAL
HARM_CATEGORY_DANGEROUS
HARM_CATEGORY_HARASSMENT
HARM_CATEGORY_HATE_SPEECH
HARM_CATEGORY_SEXUALLY_EXPLICIT
HARM_CATEGORY_DANGEROUS_CONTENT	
Threshold

Block at and beyond a specified harm probability.

HARM_BLOCK_THRESHOLD_UNSPECIFIED	
BLOCK_LOW_AND_ABOVE	
BLOCK_MEDIUM_AND_ABOVE
BLOCK_ONLY_HIGH	
BLOCK_NONE

Example

// Safety Settings
final safety1 = SafetySettings(
  category: SafetyCategory.HARM_CATEGORY_DANGEROUS_CONTENT,
  threshold: SafetyThreshold.BLOCK_ONLY_HIGH
);


//  Gemini Instance
final gemini = GoogleGemini(
  apiKey:"--- Your Gemini Api Key ---",
  safetySettings: [
    safety1,
    // safety2
  ]  
);

Build multi-turn conversations

// In progress

Use streaming for faster interactions

// In progress

Gemini Response

// In progress

Gemini Methods

// In progress

カテゴリー

依存関係

依存関係一覧 1 件

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。