Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Dart client for Genkit: Flutter から Genkit を使うため...

Dart client for Genkit: Flutter から Genkit を使うための公式クライアント開発

Nozomi Koborinai

July 05, 2025

Transcript

9 slides
  1. Dart client for Genkit Nozomi Koborinai Google Cloud Partner Top

    Engineer (Serverless App Development) 2025 Flutter から Genkit を使うための公式クライアント開発
  2. What is ? Google Firebase チームが開発した AI アプリケーション 向けのサーバーサイドフレームワーク サーバー上で

    AI の `Flow` を定義して実行する AI ワークフローにおけるオブザーバビリティを強化 AI アプリのバックエンドロジックの構築に最適
  3. Future<String> generateImage({required String description}) async { try { final response

    = await dio.post( 'https://your-genkit-endpoint.com/generateImage', data: { 'data': { 'imageDescription': description, }, }, ); if (response.statusCode == 200) { return response.data['result']['url'] as String; } throw Exception('Failed to generate image: ${response.statusCode}'); } on DioException catch (e) { throw Exception('Failed to generate image: ${e.message}'); } } Calling Genkit from Dart 従来の課題 HTTP リクエスト および JSON 変換の手動実装 複雑な Streaming (SSE) の手動実装 Genkit サーバー側固有のお作法の理解
  4. Using the Dart client for Genkit // 1. 公開中の Genkit

    エンドポイントとその型付けの定義 final action = defineRemoteAction( url: 'https://your-genkit-endpoint.com/generateImage', fromResponse: (data) => MyOutput.fromJson(data), ); final input = MyInput(message: 'Hello Dart Genkit!', count: 10); try { // 2. 定義したリモートアクションの呼び出し final output = await action(input: input); print('Flow Response: ${output.reply}, ${output.newCount}'); } catch (e) { print('Error calling flow: $e'); }
  5. Google I/O Extended 25 Proprietary & Confidential Key Features Type-Safe

    & Reusable Actions Built-in Streaming (Server-Sent Events) Support Genkit official client library

More Decks by Nozomi Koborinai

Other Decks in Programming