Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Actions Builderによるアクションのビジュアルプログラミング
Search
Daisuke Kobayashi
October 17, 2020
Programming
0
140
Actions Builderによるアクションのビジュアルプログラミング
GDG DevFest 2020 でお話した内容の資料です。
デモンストレーションとセットですので、Youtubeの動画も合わせてご覧下さい。
Daisuke Kobayashi
October 17, 2020
Tweet
Share
More Decks by Daisuke Kobayashi
See All by Daisuke Kobayashi
Google アシスタント アクション運用の知見あれこれ
covayashi
1
730
Transactions API
covayashi
6
2.9k
Other Decks in Programming
See All in Programming
iOSアプリで測る!名古屋駅までの 方向と距離
ryunakayama
0
160
Lambda(Python)の リファクタリングが好きなんです
komakichi
5
270
The Nature of Complexity in John Ousterhout’s Philosophy of Software Design
philipschwarz
PRO
0
170
ビカム・ア・コパイロット
ymd65536
1
130
ぽちぽち選択するだけでOSSを読めるVSCode拡張機能
ymbigo
14
6.3k
個人開発の学生アプリが企業譲渡されるまで
akidon0000
2
1.2k
SwiftDataのカスタムデータストアを試してみた
1mash0
0
150
GitHub Copilot for Azureを使い倒したい
ymd65536
1
330
Serving TUIs over SSH with Go
caarlos0
0
660
Ruby で作る RISC-V CPU エミュレーター / RISC-V CPU emulator made with Ruby
hayaokimura
5
1.1k
Bedrock × Confluenceで簡単(?)社内RAG
iharuoru
1
130
flutter_kaigi_mini_4.pdf
nobu74658
0
150
Featured
See All Featured
Embracing the Ebb and Flow
colly
85
4.7k
Faster Mobile Websites
deanohume
307
31k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
137
33k
Build your cross-platform service in a week with App Engine
jlugia
231
18k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.8k
Done Done
chrislema
184
16k
Speed Design
sergeychernyshev
29
940
Gamification - CAS2011
davidbonilla
81
5.3k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
160
15k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
24
2.7k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
179
53k
Transcript
Actions Builderによる ビジュアルプログラミング
Daisuke Kobayashi Programmer Gurunavi 絵を描いたり ゲーム作ったり webサイト作ったり twitter.com/0rga 0rga.org
None
1.Actions Builder について 2.Actions Builder の解説とデモ 3.Actions SDK について(軽く) お話する事
Actions Builderについて
2020/6/17に Actions Builderが リリースされました
Actions Builderとは 概要 - Actions Builderとは、Actionsコンソールで直接開発、テ スト、およびデプロイができる、WebベースのIDE - グラフィカルインターフェイスを使用しており、会話の流れを 視覚化できる
- 自然言語理解(NLU)トレーニングデータの管理
Devices Dialogflow Google Assistant Actions Before
Devices Actions Builder Google Assistant Actions After
設計方針の大きな違い Dialogflow Actions Builder 会話の流れを 構築していく 会話の場面を作り 繋げていく
新しい概念 Scenes の登場 会話の場面(Scenes)を繋げて、会話を流れを作る Scenes A Scenes B Scenes C
Scenes D
Scenesのライフサイクルとループ処理 Scenes A On enter Conditions Slot filling Prompts Intent
Transition Scenes B
Scenesのライフサイクルとループ処理 Scenes A Conditions Slot filling Prompts Intent Transition Scenes
B - Scenesがアクティブ化されたときに1回だけ実行され るステップ - Webhookをトリガーするか、シーンの1回限りのセッ トアップを行うようにユーザーに促すことができる On enter
Scenesのライフサイクルとループ処理 Scenes A On enter Slot filling Prompts Intent Transition
Scenes B Conditions - 次のステップに進める前に、パラメータが特定の値を 持っているかどうかに基づいて、ロジックを実行でき るステップ - ロジック次第では、別のシーンに移動したり、会話を 終了できたりする
Scenesのライフサイクルとループ処理 Scenes A On enter Prompts Intent Transition Scenes B
Conditions - ユーザーの入力を収集するためのステップ - Slotを埋めようと、Scenesのライフサイクルが動く Slot filling
Scenesのライフサイクルとループ処理 Scenes A On enter Intent Transition Scenes B Conditions
Slot filling - これまでのステップで集めたキューを元に、ユーザに 発話するステップ Prompts
Scenesのライフサイクルとループ処理 Scenes A On enter Slot filling Prompts Transition Conditions
Intent - Scenesのループを終了するための遷移基準を、定義で きるステップ - 遷移しない場合、ループは Conditions に戻る Scenes B
Actions Builder の 解説とデモ
デモで作るもの 仕様 - じゃんけんが出来るアクション - アクション名は「じゃんけんマシーン」 - ユーザが止めるまで、じゃんけんは続く - じゃんけんマシーンがグーチョキパーの何を出すかはランダム
VUI 設計 こんにちは、じゃんけんマ シーンです。 じゃんけんをしますか? じゃーんけーん はい グー 私はチョキ、あなたはグー。 あなたの勝ち!
もう一回じゃんけんしますか? じゃーんけーん… はい OK Google じゃんけん マシーンにつないで : :
Scenes 設計 じゃんけんをす るかどうか尋ね るシーン じゃんけんをす るシーン もう一度、 じゃんけんをす るかどうか尋ね
るシーン 「こんにちは、じゃんけん マシーンです」 会話終了 YES NO
下準備1 プロジェクトの作成
下準備2 アクション名の設定
こんにちは、じゃんけん マシーンです。 これを作る
Main invocation 概要 - ユーザーがアクションとの会話を開始するためのエントリーポ イント - ユーザーからの 「OK Google,
〇〇◦につないで」 と言うような invocation(呼び出し)に反応する部分
Main invocationの設定
こんにちは、じゃんけんマ シーンです。 じゃんけんをしますか? これを作る
Scenesの作成
Scenesの設定
じゃんけんをしますか? はい これを作る
Intents 概要 - アクションが理解できる、ユーザーの入力を定義できる - System intent と Custom intent
がある - Training phrases - ユーザの入力の定義の例の事 - Assistant NLU(自然言語理解)エンジンは、 Training Phrasesを拡張して、 他の類似したフレーズを含めることができる
Custom Intentの作成
ScenesにCustom Intent handlingを設定
はい じゃーんけーん グー これを作る
Custom Intent handlingで別Scenesに
Types 概要 - ざっくり言うと、Intentsの複数版。 - ユーザ入力の同義語を定義し判別できる。
// Custom Intent のイメージ { yes: ['はい', 'OK', 'YES', 'もちろん',
'オッケー', ... ] } // Types のイメージ { meat : { beef: ['牛肉', 'ビーフ', 'ステーキ', ... ], pork: ['豚肉', 'ポーク', 'とんかつ', ... ], chicken: ['鶏肉', 'チキン', 'から揚げ', ... ], } }
Typesの作成
Typesの設定
Slot fillingの設定
Slot fillingの設定
Conditionの設定
グー 私はチョキ、 あなたはグー。 あなたの勝ち! これを作る
Conditionの条件分岐の作成
私はチョキ、 あなたはグー。 あなたの勝ち! もう一回 じゃんけんしますか? これを作る
Conditionから別Scenesに
Conditionから別Scenesに
Scenesの設定
ScenesにCustom Intent handlingを設定
私はチョキ、 あなたはグー。 あなたの勝ち! ラ ン ダ ム に し た
い
Webhook Actions SDK Node.js Fulfillment Library
const { conversation } = require('@assistant/conversation'); const functions = require('firebase-functions');
const app = conversation({debug: true}); const jankenTypeName = { gu: 'グー', tyoki: 'チョキ', pa: 'パー' }; const judgeMap = { gu: { gu: 'あいこ!', tyoki: 'あなたの勝ち!', pa: 'あなたの負け!' }, tyoki: { gu: 'あなたの負け!', tyoki: 'あいこ!', pa: 'あなたの勝ち!' }, pa: { gu: 'あなたの勝ち!', tyoki: 'あなたの負け!', pa: 'あいこ!' } }; 新しいライブラリに
app.handle('janken', conv => { const actionChoice = ['gu', 'pa', 'tyoki'][Math.floor(Math.random()
* 3)]; const message = judgeMap[conv.session.params.chosenJankenType][actionChoice]; conv.add(`私は${jankenTypeName[actionChoice]}、あなたは ${jankenTypeName[conv.session.params.chosenJankenType]}、${message}`); }); exports.ActionsOnGoogleFulfillment = functions.https.onRequest(app); intent から handle に ask から add に
Actions SDK について
Actions SDK ファイルとコマンドラインの利点 - 手元の環境で作業が可能 - ファイルのバージョン管理が可能 - gactions コマンドで
pull / push が可能 - 独自のツールを適用可能
今回作ったデモを pull してきたもの
// Custom Intentでつくった「yes.yaml」 trainingPhrases: - そうだよ - そうです - もちろん
- それで - よろしく - おねがい - "YES" - OK - うん - はい
// Scenesでつくった「start.yaml」 intentEvents: - intent: "yes" transitionToScene: janken - handler:
staticPrompt: candidates: - promptResponse: firstSimple: variants: - speech: では、さようなら intent: "no" transitionToScene: actions.scene.END_CONVERSATION onEnter: staticPrompt: candidates: - promptResponse: firstSimple: variants: - speech: じゃんけんをしますか?
1.Actions Builderのグラフィカルインターフェ イスで、よりノンコーティングに。 2.Actions SDKで、より自由に。 まとめ
Thank you!