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
120
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
640
Transactions API
covayashi
6
2.7k
Other Decks in Programming
See All in Programming
冗長なエラーログを削減し、スタックトレースを手に入れる / Reducing Verbose Error Logs and Obtaining Stack Traces
upamune
0
930
Anthropic Cookbook のおすすめレシピ
schroneko
7
1.1k
What We Can Learn From OSS
inouehi
0
430
Hanami and htmx
bkuhlmann
0
210
見た目から始める生産性向上
ikumatadokoro
8
1.1k
Node.js v22 で変わること
yosuke_furukawa
PRO
10
3.7k
AppRouter Panel Talk
yosuke_furukawa
PRO
1
240
MetricKitで予期せぬ終了を検知する話 / Detect unexpected termination with MetricKit
nekowen
1
190
try! Swift Tokyo 初参加報告LT
hinakko2
0
230
if constexpr文はテンプレート世界のラムダ式である
faithandbrave
3
660
使ってみよう Azure AI Document Intelligence
kosmosebi
2
350
"config" ってなんだ? / What is "config"?
okashoi
0
240
Featured
See All Featured
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
12
8.3k
Navigating Team Friction
lara
179
13k
What the flash - Photography Introduction
edds
64
11k
From Idea to $5000 a Month in 5 Months
shpigford
378
45k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
63
14k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
323
20k
Debugging Ruby Performance
tmm1
70
11k
Build your cross-platform service in a week with App Engine
jlugia
226
17k
Designing with Data
zakiwarfel
96
4.8k
Unsuck your backbone
ammeep
663
57k
Ruby is Unlike a Banana
tanoku
96
10k
How to train your dragon (web standard)
notwaldorf
74
5.2k
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!