AI Builderにプロンプトを登録する機能と、そのプロンプトを使用してGPTを呼び出す機能が提供されたので、実際に使ってみた。
ソースはこちら
![]()
Page not found
基本的な使い方:用意されているプロンプトを使用
事前に用意されているプロンプトがいくつかあるようなので、まずはそちらを使用してみる。
Power Automateから呼び出す
まず、手動トリガーでフローを作成しGPTに渡すテキストを引数として準備する。


そしたらアクションで「AI Builder」を選んで、


[GPTでプロンプトを使用してテキストを生成する]を選択。


今回は最もスタンダードっぽい[AI Reply]を選択して、[Input Text]に引数を設定して準備完了。


そしたらInputに適当なテキストを入れて実行してみると、


無事会話ができた!
※後ほど触れるけどたぶんGPT-3.5だと思われる。

※後ほど触れるけどたぶんGPT-3.5だと思われる。

キャンバスから呼び出す
続いてキャンバスアプリから呼び出す。適当なUIを作って[データの追加]から[AIモデル]にある[AI Reply]を選択。


そしたらこんな感じで[AI Reply]をボタンから呼び出して、戻り値を変数に入れれば完成。


無事にテキストが生成される。


ちなみにさっきGPT-3って返答してきたけど、聞き方を変えるとGPT-3.5っていうので、たぶんモデルは3.5かと。


自分でプロンプトを作成して呼び出してみる
続いて自分でプロンプトを作成して呼び出してみる。
Power Apps Studioの[AI モデル]を選んで[プロンプトのセクションが追加されました]をクリック。


するとタブ[AI プロンプト]に移動できるので、[カスタムプロンプトを使用してテキストを作成する]を選択。


そしたら[カスタムプロンプトを作成]をクリックして、


適当なプロンプトと入力を作成する(今回は英語で入れたけど、たぶん日本語もいけるはず)。


※今回入れたプロンプト(俳句アーティスト)はこちら
You are a very talented haiku artist. Please create a response to the user's question with a Japanese Haiku. Note : Please output only Japanese. #Haiku A haiku is a short poem read in the Japanese rhythm of "5, 7, 5". Please include seasonal words whenever possible. ### user : content
[プロンプトをテストする]から試しに使ってみると無事テキストが生成される。


そしたら保存して準備完了。


Power Automateから呼び出す
先ほどと同様のアクションを選ぶと作成したプロンプトが追加されているので選択。


実行してみると、


(俳句かは怪しいけど)無事テキストが生成される。


キャンバスから呼び出す
キャンバスから呼び出す際も先ほどと同様に[データの追加]から作成したプロンプトを選択。


式もさっきと同様に書いて呼び出してみると、


無事にテキストが生成される。


見ての通り簡単にGPTを呼び出せるので、とてもおすすめな機能。
戻り値に[終了理由(finish_reason)]があるので、lengthが戻ってくることもあるかもなので、構築時は考慮が必要かもしれない。
※戻り値「function」は今後に期待。
GPT機能を使うときの注意点
承認の流れを入れることが推奨
この機能を使ったフローとかを作成すると、こんな警告が表示される。


これはGPTが作成したテキストを人間がきちんと確認(承認)することを推奨しているため。
もし製品とかに組み込む場合はこの辺も考慮が必要。
コンテンツフィルターに引っかかる場合もあり
質問内容によってはこんな感じでコンテンツフィルターに引っかかってエラーが返ってくる場合がある。


この辺りも製品に入れるときは考慮が必要かと。
コメント