> ## Documentation Index
> Fetch the complete documentation index at: https://apidoc.cometapi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Flowise を CometAPI に接続する

> base URL、API key、model または provider オプションを設定して、Flowise を CometAPI に接続するには、このガイドを使用してください。

FlowiseAI は、LLM アプリケーションを視覚的に構築するためのローコードプラットフォームです。ネイティブの **ChatCometAPI** ノードを使用して、CometAPI をチャットフロー、Q\&A システム、テキストチャットモデルを呼び出す RAG ワークフローに接続できます。

<Note>
  このガイドでは、テキストチャットと RAG ワークフローを扱います。画像生成ワークフローは対象外です。
</Note>

## 前提条件

* 有効な API key を持つ CometAPI アカウント - [こちらで取得](https://www.cometapi.com/console/token)
* FlowiseAI アカウント、またはセルフホストされた Flowise インスタンス - [Flowise Cloud にサインイン](https://cloud.flowiseai.com/chatflows)
* [CometAPI Models page](/ja/overview/models) にある最新のテキスト model ID
* RAG の場合、ドキュメントソースに加え、Flowise がサポートする embeddings provider と vector store

## ChatCometAPI を設定する

<Steps>
  <Step title="CometAPI API key を取得する">
    [CometAPI console](https://www.cometapi.com/console/token) にログインします。**Add API Key** をクリックし、CometAPI API key をコピーします。

    <Frame>
      <img src="https://mintcdn.com/cometapi/SZhlxZhCnMLn__BW/images/overview/810968_364191.png?fit=max&auto=format&n=SZhlxZhCnMLn__BW&q=85&s=aef81a83f29f8eb16655ed4060425f50" alt="Add API Key ボタンが表示された CometAPI ダッシュボード" width="3824" height="1892" data-path="images/overview/810968_364191.png" />
    </Frame>

    <Frame>
      <img src="https://mintcdn.com/cometapi/HhtmQffktazbxUvS/images/overview/810968_364193.png?fit=max&auto=format&n=HhtmQffktazbxUvS&q=85&s=d893f659267150d0faf45f99eb5dffc1" alt="base URL が表示された CometAPI API key の詳細" width="2434" height="1232" data-path="images/overview/810968_364193.png" />
    </Frame>
  </Step>

  <Step title="ChatCometAPI ノードを追加する">
    1. FlowiseAI のチャットフローキャンバスで、**Add New** をクリックします。

    <Frame>
      <img src="https://mintcdn.com/cometapi/SZhlxZhCnMLn__BW/images/integrations/810968_361945.png?fit=max&auto=format&n=SZhlxZhCnMLn__BW&q=85&s=f36fc7cc6d541af1acd95f6b8aea9b04" alt="Add New ボタンが表示された FlowiseAI キャンバス" width="1874" height="960" data-path="images/integrations/810968_361945.png" />
    </Frame>

    2. **cometapi** を検索し、**ChatCometAPI** ノードを選択します。

    <Frame>
      <img src="https://mintcdn.com/cometapi/SZhlxZhCnMLn__BW/images/integrations/810968_361946.png?fit=max&auto=format&n=SZhlxZhCnMLn__BW&q=85&s=0da9222351e5378eeeb928b1acf1e959" alt="ChatCometAPI の検索結果を表示しているノード検索" width="1880" height="910" data-path="images/integrations/810968_361946.png" />
    </Frame>

    3. それをキャンバス上にドラッグします。

    <Frame>
      <img src="https://mintcdn.com/cometapi/SZhlxZhCnMLn__BW/images/integrations/810968_361947.png?fit=max&auto=format&n=SZhlxZhCnMLn__BW&q=85&s=c727ab9ff734355a0f2d5de4ff479c97" alt="キャンバス上に配置された ChatCometAPI ノード" width="1810" height="950" data-path="images/integrations/810968_361947.png" />
    </Frame>
  </Step>

  <Step title="CometAPI credential を作成する">
    ChatCometAPI ノードで **Connect Credential** を開き、**Create New** を選択して、CometAPI API key を貼り付け、credential を保存します。

    <Frame>
      <img src="https://mintcdn.com/cometapi/SZhlxZhCnMLn__BW/images/integrations/810968_361948.png?fit=max&auto=format&n=SZhlxZhCnMLn__BW&q=85&s=b64309fa10d20704751e433c3316cf82" alt="API key が入力された credential ダイアログ" width="1820" height="900" data-path="images/integrations/810968_361948.png" />
    </Frame>
  </Step>

  <Step title="CometAPI base path を設定する">
    ChatCometAPI ノードの **Additional Parameters** を展開します。

    Flowise のビルドに **Base Path** フィールドが表示される場合は、次のように設定します:

    ```text theme={null}
    https://api.cometapi.com/v1/
    ```

    代わりに **Base Options** が表示される場合は、`basePath` エントリを追加します:

    ```json theme={null}
    {
      "basePath": "https://api.cometapi.com/v1/"
    }
    ```

    **Model Name** には呼び出したい正確なテキスト model ID を設定します（例: `your-model-id`）。**Temperature** は、ワークフローでより多くまたは少ない変化が必要な場合にのみ調整してください。
  </Step>
</Steps>

## 基本的な chatflow を作成する

<Steps>
  <Step title="Prompt Template を追加する">
    **Prompt Template** ノードを追加し、chatflow がモデルに送信するプロンプトを定義します。

    ```text theme={null}
    Question: {question}
    Answer clearly and concisely.
    ```

    <Frame>
      <img src="https://mintcdn.com/cometapi/SZhlxZhCnMLn__BW/images/integrations/810968_361949.png?fit=max&auto=format&n=SZhlxZhCnMLn__BW&q=85&s=201c0e040b56a7a5338ba34b5761cac1" alt="例のテンプレートを含む Prompt Template ノード" width="1238" height="850" data-path="images/integrations/810968_361949.png" />
    </Frame>

    <Frame>
      <img src="https://mintcdn.com/cometapi/SZhlxZhCnMLn__BW/images/integrations/810968_361950.png?fit=max&auto=format&n=SZhlxZhCnMLn__BW&q=85&s=9a872c659549ba024457a015a5c75064" alt="キャンバス上に配置された Prompt Template ノード" width="511" height="805" data-path="images/integrations/810968_361950.png" />
    </Frame>
  </Step>

  <Step title="LLM Chain を追加する">
    **LLM Chain** ノードを追加します。**ChatCometAPI** ノードをチェーンの **Language Model** 入力に接続し、次に **Prompt Template** ノードをチェーンの **Prompt** 入力に接続します。

    <Frame>
      <img src="https://mintcdn.com/cometapi/SZhlxZhCnMLn__BW/images/integrations/810968_361951.png?fit=max&auto=format&n=SZhlxZhCnMLn__BW&q=85&s=a44d838bb2fc70911e0407b1ea2ed7f2" alt="Language Model と Prompt が接続された LLM Chain ノード" width="514" height="724" data-path="images/integrations/810968_361951.png" />
    </Frame>
  </Step>

  <Step title="フローを保存してテストする">
    chatflow を保存し、チャットプレビューを開いて、短いテスト質問を送信します。正常な設定であれば、選択した CometAPI モデルから通常のテキスト回答が返されます。

    <Frame>
      <img src="https://mintcdn.com/cometapi/SZhlxZhCnMLn__BW/images/integrations/810968_361954.png?fit=max&auto=format&n=SZhlxZhCnMLn__BW&q=85&s=73647ee6f0995ed8c36a9fd1a2e6fd97" alt="3 つのノードがすべて接続された完全な chatflow" width="1466" height="789" data-path="images/integrations/810968_361954.png" />
    </Frame>
  </Step>
</Steps>

## model ID を切り替える

モデルを切り替えるには、同じ CometAPI credential と base path を維持したまま、ChatCometAPI の model ID フィールドのみを変更します。

正確な model ID は [CometAPI Models page](/ja/overview/models) から使用してください。表示名、プロバイダー名、余分なスペースをコピーしないでください。

| ユースケース           | Model ID value            |
| ---------------- | ------------------------- |
| 一般的なチャットモデルファミリー | `your-chat-model-id`      |
| 推論モデルファミリー       | `your-reasoning-model-id` |
| コーディングモデルファミリー   | `your-coding-model-id`    |

model ID を変更したら、chatflow を保存して短いテスト用プロンプトを実行します。複数の本番フローを運用している場合は、先に chatflow を複製し、各コピーにそのモデルファミリーを反映した名前を付けてください。

## 検索拡張生成を設定する

Flowise RAG は 2 つの部分で構成されます。まず **Document Stores** でドキュメントを準備して upsert し、その後、準備した retriever を chatflow に接続します。ChatCometAPI は最終回答を生成するチャットモデルです。Document Store には、Flowise がサポートするエンベディング プロバイダーと vector store も引き続き必要です。

<Steps>
  <Step title="Document Store を作成して処理する">
    Flowise で **Document Stores** を開き、新しいストアを作成します。**File Loader**、**PDF Loader**、**Web Scraper** など、ソースに合った document loader を追加します。ドキュメントが十分に長く chunking が必要な場合は text splitter を追加し、その後 **Process** をクリックして生成された chunks をプレビューします。
  </Step>

  <Step title="エンベディングとベクトル保存を設定する">
    **Upsert** または **Upsert All Chunks** をクリックします。以下を選択します。

    * **Embeddings**: データと vector store に対応する Flowise の embeddings node。
    * **Vector Store**: Flowise が document embeddings を保存する vector database。
    * **Record Manager**: 任意。繰り返し upsert する際に重複レコードを避けたい場合に使用します。

    embedding model の dimension は、vector store の index dimension と一致させてください。upsert の完了後、chatflow を構築する前に、Document Store の retrieval query test を使って関連する chunks が返されることを確認します。
  </Step>

  <Step title="検索用 chatflow を作成する">
    chatflow で **Document Store (Vector)** または **Document Store Retriever** node を追加し、処理済みの Document Store を選択します。**Top K** には、各質問ごとに Flowise に取得させたい chunks の数を設定します。
  </Step>

  <Step title="Conversational Retrieval QA Chain を接続する">
    **Conversational Retrieval QA Chain** を追加し、以下を接続します。

    * **Language Model** input を **ChatCometAPI** から接続。
    * **Vector Store Retriever** input を Document Store retriever から接続。
    * **Memory** は、chatflow で会話履歴が必要な場合のみ接続します。

    回答に引用や取得したソース chunks を含めたい場合は、**Return Source Documents** を有効にします。フローを保存し、アップロードしたドキュメントにしか答えが存在しない質問をしてみてください。
  </Step>
</Steps>

## トラブルシューティング

<AccordionGroup>
  <Accordion title="ChatCometAPI ノードが見つからない">
    お使いの Flowise バージョンに **ChatCometAPI** チャットモデル連携が含まれていることを確認してください。古い Flowise デプロイやカスタマイズされた Flowise デプロイでは、Flowise を更新するか、その連携が管理者によって無効化されていないか確認してください。
  </Accordion>

  <Accordion title="base path が間違っているためリクエストが失敗する">
    CometAPI の base path を `https://api.cometapi.com/v1/` に設定してください。一部の Flowise ビルドでは、これは **Base Path** フィールドです。ほかの環境では、**Base Options** 内に `basePath` を追加してください。

    ChatCometAPI の chatflow では `https://api.cometapi.com` を使わないでください。これは、chat ノードが `/v1` 配下の OpenAI 互換 `/chat/completions` ルートを呼び出すためです。
  </Accordion>

  <Accordion title="API キーまたは credential が失敗する">
    [CometAPI console](https://www.cometapi.com/console/token) からキーをコピーし直し、新しい Flowise credential を作成して、chatflow がその credential を使用していることを確認してください。同じキーが直接の API 呼び出しでは動作するのに Flowise では失敗する場合は、Flowise がまだノードに紐付いた古い credential を使っていないか確認してください。
  </Accordion>

  <Accordion title="model ID が失敗する">
    ChatCometAPI ノード内の model ID の値を、[CometAPI Models page](/ja/overview/models) にある現在有効な正確なテキスト model ID に置き換えてください。値には引用符、provider プレフィックス、表示ラベル、末尾の空白を含めないでください。
  </Accordion>

  <Accordion title="ワークフローが画像を生成しようとする">
    ChatCometAPI はテキストワークフロー向けのチャットモデルノードです。チャット、チェーン、エージェント、RAG の回答生成に使用してください。この Flowise セットアップを画像生成ノードや画像専用ワークフローに使用しないでください。
  </Accordion>

  <Accordion title="RAG がソースを返さない、または回答が弱い">
    まず、完全な chatflow をテストする前に、Document Store の検索クエリをテストしてください。検索結果が弱い場合は、text splitter、chunk size、chunk overlap、metadata filters、**Top K** を調整してください。引用が欠けている場合は、**Conversational Retrieval QA Chain** で **Return Source Documents** を有効にしてください。
  </Accordion>

  <Accordion title="Upsert またはベクトルストア設定が失敗する">
    embedding provider、ベクトルストア、ベクトル次元が一致していることを確認してください。Flowise Cloud のベクトルストアでは、多くの場合、到達可能な独自のサービス URL と credentials が必要です。`localhost` のようなローカル専用のベクトルストア URL は、Flowise Cloud からは到達できません。Record Manager は任意ですが、有効にする場合は、そのデータベース接続も個別に設定してください。
  </Accordion>

  <Accordion title="リクエストがタイムアウトする、または rate limit に達する">
    取得の **Top K** を下げる、プロンプト（Prompt）サイズを減らす、より小さい chunk を使う、または ChatCometAPI ノードにより高速な model ID を選んでください。rate limit の場合は、少し待ってから、より低い同時実行数で再試行し、その後 CometAPI console でアカウント使用量と制限を確認してください。
  </Accordion>
</AccordionGroup>

<script type="application/ld+json">
  {`
    {
    "@context": "https://schema.org",
    "@graph": [
      {
        "@type": "HowTo",
        "@id": "https://apidoc.cometapi.com/integrations/flowiseai#howto",
        "name": "Flowise を CometAPI に接続する",
        "description": "このガイドを使用して、base URL、API キー、model または provider オプションを設定し、Flowise を CometAPI に接続します。",
        "step": [
          {
            "@type": "HowToStep",
            "@id": "https://apidoc.cometapi.com/integrations/flowiseai#step-1",
            "position": 1,
            "name": "CometAPI の API キーを取得する",
            "text": "CometAPI アカウントを作成または開き、ダッシュボードから有効な API キーをコピーします。"
          },
          {
            "@type": "HowToStep",
            "@id": "https://apidoc.cometapi.com/integrations/flowiseai#step-2",
            "position": 2,
            "name": "ChatCometAPI ノードを追加する",
            "text": "「Flowise を CometAPI に接続する」ガイドの「ChatCometAPI ノードを追加する」手順を完了します。"
          },
          {
            "@type": "HowToStep",
            "@id": "https://apidoc.cometapi.com/integrations/flowiseai#step-3",
            "position": 3,
            "name": "CometAPI credential を作成する",
            "text": "「Flowise を CometAPI に接続する」ガイドの「CometAPI credential を作成する」手順を完了します。"
          },
          {
            "@type": "HowToStep",
            "@id": "https://apidoc.cometapi.com/integrations/flowiseai#step-4",
            "position": 4,
            "name": "CometAPI の base path を設定する",
            "text": "「Flowise を CometAPI に接続する」ガイドの「CometAPI の base path を設定する」手順を完了します。"
          },
          {
            "@type": "HowToStep",
            "@id": "https://apidoc.cometapi.com/integrations/flowiseai#step-5",
            "position": 5,
            "name": "Prompt Template を追加する",
            "text": "「Flowise を CometAPI に接続する」ガイドの「Prompt Template を追加する」手順を完了します。"
          },
          {
            "@type": "HowToStep",
            "@id": "https://apidoc.cometapi.com/integrations/flowiseai#step-6",
            "position": 6,
            "name": "LLM Chain を追加する",
            "text": "「Flowise を CometAPI に接続する」ガイドの「LLM Chain を追加する」手順を完了します。"
          },
          {
            "@type": "HowToStep",
            "@id": "https://apidoc.cometapi.com/integrations/flowiseai#step-7",
            "position": 7,
            "name": "フローを保存してテストする",
            "text": "「Flowise を CometAPI に接続する」ガイドの「フローを保存してテストする」手順を完了します。"
          },
          {
            "@type": "HowToStep",
            "@id": "https://apidoc.cometapi.com/integrations/flowiseai#step-8",
            "position": 8,
            "name": "Document Store を作成して処理する",
            "text": "「Flowise を CometAPI に接続する」ガイドの「Document Store を作成して処理する」手順を完了します。"
          }
        ]
      },
      {
        "@type": "BreadcrumbList",
        "itemListElement": [
          {
            "@type": "ListItem",
            "position": 1,
            "name": "CometAPI ドキュメント",
            "item": "https://apidoc.cometapi.com/"
          },
          {
            "@type": "ListItem",
            "position": 2,
            "name": "連携",
            "item": "https://apidoc.cometapi.com/integrations"
          },
          {
            "@type": "ListItem",
            "position": 3,
            "name": "Flowise を CometAPI に接続する",
            "item": "https://apidoc.cometapi.com/integrations/flowiseai"
          }
        ]
      }
    ]
    }
    `}
</script>
