# 問い合わせに対するFAQ検索→回答メール文を作成

問い合わせに対するFAQ検索→回答メール文を作成アプリでは、社内/社外からの問い合わせ文を貼り付けることで、問い合わせに対応する回答のFAQ検索を行い、回答文から問い合わせ元に連絡するためのメール文を作成するアプリです。

## フローの全体図 <a href="#overall" id="overall"></a>

<figure><img src="/files/DNjubVliFjfMLHuCxOMi" alt=""><figcaption></figcaption></figure>

## 概要 <a href="#outline" id="outline"></a>

問い合わせに対するFAQ検索→回答メール文を作成アプリは社内、社外でメールの文面を変更するため、ユーザーに「社内」からの問い合わせか「社外」からの問い合わせか、ボタンで選択するようにしています。プロードするか、「テキストで直接入力」するかの2つのボタンから選択するように設定しています。

選択後、問い合わせの内容を直接貼り付ければ、Q\&A検索が実行されます。\
提示されたFAQの中から該当するFAQを選択したあとは回答文からメールを作成しますか\
に対して「はい」を選択すると、LLM実行でFAQで表示した回答をベースに問い合わせへの返信メール文章を作成します。

### 問い合わせ元の属性と問い合わせ内容の取集（会話応答ノード） <a href="#send-message-node1" id="send-message-node1"></a>

問い合わせ元の属性を取得する変数は以下で構成されています。

変数：＠CUSTOMER

* 変数種別：会話変数
* タイプ：文字列

<figure><img src="/files/GLQrNEBXDmKt9Mr1nLeN" alt="" width="375"><figcaption></figcaption></figure>

問い合わせ内容を取得する変数は以下で構成されています。

変数：＠QUERY

* 変数種別：会話変数
* タイプ：文字列

<figure><img src="/files/mueuJRoJER3bAanFa85Y" alt="" width="375"><figcaption></figcaption></figure>

### FAQ検索（Q\&Aから回答ノード） <a href="#qa-node1" id="qa-node1"></a>

一つ前の問い合わせ内容を収集するノードで、問い合わせ内容を"QUERY"に格納したので、質問入力方式は"変数"で設定しています。

<figure><img src="/files/Wmy4hzrMBkDf3qFzstT9" alt="" width="375"><figcaption></figcaption></figure>

本アプリは、FAQ検索を実行する前提で作成をしていますが、このノードをLLMを使って回答する「回答生成」ノードで代用することも可能です。

また、問い合わせの属性に合わせて、検索ソースを変更する場合は、以下のように実装してください。

<figure><img src="/files/l0I1xhNcIfGvT4LFarL9" alt=""><figcaption></figcaption></figure>

### メール文を作成する（LLM実行ノード） <a href="#llm-node1" id="llm-node1"></a>

LLM実行ノードでは質問応答ノードでユーザーが入力した情報を保存した変数＠CUSTOMERと、@QUERY、そしてFAQ検索で選択したFAQの回答文を@FAQ\_SELECTED\_ANSWERをプロンプトで指定し実行しています。（@FAQ\_SELECTED\_ANSWERはAlli LLM App Marketで備わっている変数です）

* ベースモデル：OPENAI GPT-4
* プロンプト：FAQ検索からメール文を作成

<figure><img src="/files/RtWsQc775Umjzn5gQeEV" alt="" width="375"><figcaption></figcaption></figure>

<figure><img src="/files/apIlhwoZKeb0dTrDuhYk" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.allganize.ai/alli-llm-app-market/app-market/default-apps/customer-service/create-a-response-email-from-faq.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
