搜尋套件、儲存庫與 APP 分類

套件詳情v0.0.10+1

chrome_ai

支援 Flutter 中的 Chrome AI。本程式庫是 Chrome AI API 的封裝。它提供了一種在 Flutter 中使用 Chrome AI API 的簡單方式。

近 30 天下載
28
喜歡數
12
Pub 分數
40

安裝套件

flutter pub add chrome_ai

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

chrome_ai 包是 Chrome AI API 的 Flutter 包裝,使開發者能夠將其 Chrome AI 功能整合到 Flutter 應用中。它簡化了對自然語言處理和生成式回應等 AI 功能的存取。該包專為在 Flutter 項目中無縫使用而設計,將複雜的 API 互動抽象為簡單的方法。該包非常適合希望利用 AI 驅動的聊天、內容產生或智慧使用者協助功能的應用。它支援未來的平台擴展,儘管目前的平台支援尚未明確。

適用情境

  • AI 驅動的聊天介面
  • 應用中的內容產生
  • 智慧助理整合
  • 即時語言處理
  • 增強的使用者與AI的互動
  • 自動回應系統

主要特色

  • Chrome AI 的簡單 API 包裝器
  • 無縫的 Flutter 集成
  • 支援產生式AI任務
  • 乾淨、易用的方法
  • 面向未來,支援平台擴展
  • 輕量且專注

適合對象

  • 開發 AI 增強型 Flutter 應用的開發者
  • 整合Chrome AI功能的團隊
  • 需要即時文本生成的應用程式
  • 原型設計人工智慧驅動的使用者體驗
  • 旨在最小化設置開銷的項目

使用建議

  • 未列出特定平台的支援
  • 依賴外部 Chrome AI API 的可用性
  • 有限的文件暗示
  • 需要互聯網連接以進行AI呼叫
  • 取決於出版商的維護
  • 不適用於離線AI功能

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

pub package GitHub

ChromeAI

Recently, Chrome has added window.ai — a Gemini Nano AI model right inside your browser. This means that web developers can instantly and unlimitedly use on-device AI without any configuration.

I believe this will truly transform web applications. The use-cases are endless: smart auto-completion, error correction and validation, natural language filtering, auto-filling forms, UI suggestions, first-pass summarization, and search.

Accordingly, I have developed a library to enable this feature in Flutter. With this library, you can easily utilize the feature in Flutter web as well.

Installation

you can watch this video to see how to enable AI in Chrome and run this library.

1. Enable AI in Chrome

Chrome built-in AI is a preview feature, you need to use chrome version 127 or greater, now in dev or canary channel, may release on stable chanel at Jul 17, 2024.

After then, you should turn on these flags:

  • [chrome://flags/#prompt-api-for-gemini-nano](chrome://flags/#prompt-api-for-gemini-nano): Enabled
  • [chrome://flags/#optimization-guide-on-device-model](chrome://flags/#optimization-guide-on-device-model): Enabled BypassPrefRequirement
  • [chrome://components/](chrome://components/): Click Optimization Guide On Device Model to download the model.
2. Add library
flutter pub add chrome_ai
3. Run your project
1. Open terminal and run web-server
flutter run -d web-server
2. Open Chrome dev or canary, and open your project in http://localhost:port

Usage

Check Availability of Chrome AI
import 'package:chrome_ai/chrome_ai.dart';

final availability = await ChromeAI.canCreateTextSession();
if(availability == AIModelAvailability.no){
    // can not create text session
}else if(availability == AIModelAvailability.afterDownload) {
    // need to download model
}else if(availability == AIModelAvailability.readily){
    // model is ready
}
Generate Text
import 'package:chrome_ai/chrome_ai.dart';

final session = await ChromeAI.createTextSession();
var result = await session.prompt("why is the sky blue?");
print(result);  
Generate Streaming Text
import 'package:chrome_ai/chrome_ai.dart';

final session = await ChromeAI.createTextSession();
final stream = session.promptStreaming("why is the sky blue?");

stream.listen((result) {
  print(result);
}).onError((e, stackTrace) {
  print(e.toString());
});

Need Help!

This project is very new. If you have any questions, please open an issue. Contributions are very welcome.

所屬分類

依賴

依賴清單 1 項

  • js^0.7.1

原始碼儲存庫

使用此套件的專案

暫無相關資料。