---
schema_version: "1"
id: cbc9f9f02d698cee7679360e6c8bc06d5f91bb45a63a1dacdb89d50d3e9ed392
title: RAG 操作の設定
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/mulesoft-ai-chain-connector/1.0/configuring-rag-operations.md
canonical_url: https://docs.mulesoft.com/jp/mulesoft-ai-chain-connector/1.0/configuring-rag-operations
source_site: docs.mulesoft.com
content_type: documentation
content_hash: d63a97eb6a7e60e0b51ad01b6d630d315998dece69222845171880b217d072d1
description: MuleSoft Documentation Site
release: "1.0"
latest: true
---
# RAG 操作の設定

Retrieval-Augmented Generation (RAG) とは、関連コンテンツを取得し、そのコンテンツを使用して追加のコンテキストで AI プロンプトを増強することで、AI が生成した出力を拡張する技術です。この追加情報で LLM をグラウンディングすることで、より正確で信頼性の高い応答を提供できます。

## [](#rag-load-document-操作の設定)RAG Load Document 操作の設定

**RAG load document**​ 操作では、メモリ内エンベディングストアからプレーンテキストプロンプトに基づいて情報を取得します。

**RAG load document**​ 操作を設定する手順は、次のとおりです。

Unresolved include directive in modules/ROOT/pages/configuring-rag-operations.adoc - include::connectors::partial$t-configure-operations.adoc\[\] \* **Data**

\+ LLM と応答先のエンベディングストアに送信するプロンプト。 \* **Context Path (コンテキストパス)**​

\+ エンベディングストアに取り込むドキュメントの完全なファイルパスを含めます。ファイルパスにアクセスできることを確認します。

\+ この項目では DataWeave 式を使用することもできます。次に例を示します。

+

```dataweave
mule.home ++ "/apps/" ++ app.name ++ "/customer-service.pdf"
```

1. 操作の ​**\[Context (コンテキスト)\]**​ セクションで ​**\[File Type (ファイル種別)\]**​ を選択します。
    
    - **text**​
        
        JSON、XML、TXT、CSV などのテキストファイル。
    - **URL**​
        
        取り込む Web コンテンツを参照する単一 URL。

この操作の XML 設定を次に示します。

```xml
<ms-aichain:rag-load-document
  doc:name="RAG load document"
  doc:id="3d3edd66-4970-4dad-a5bf-2a8eae123da4"
  config-ref="MAC_AI_Llm_configuration"
  data="#[payload.prompt]"
  contextPath="#[payload.contextPath]"
/>
```

## [](#出力設定)出力設定

この操作の応答には、メイン LLM 応答を含む JSON ペイロードが含まれます。また、トークン利用状況などの属性がメインペイロード内ではなくメタデータ (属性) の一部として含まれます。

JSON ペイロードの応答例を次に示します。

```json
{
  "response": "Wakanda, a technologically advanced and environmentally conscious nation in Africa, is renowned for its unique integration of ancient traditions with cutting-edge innovations, powered by the rare metal Vibranium. With a population of 12.5 million, it emphasizes sustainable growth, quality education, and healthcare, while maintaining a zero carbon footprint through advanced eco-tech solutions. Despite its peaceful nature, Wakanda's formidable military and cultural heritage, led by King T’Challa and the Dora Milaje, ensure its resilience and unity as a symbol of progress and tradition."
}
```

この操作では、メイン JSON ペイロード内に含まれない属性も返されます。これには、トークン利用状況に関する情報が含まれます。次に例を示します。

```json
{
  "tokenUsage": {
      "outputCount": 9,
      "totalCount": 18,
      "inputCount": 9
  },
  "additionalAttributes": {}
}
```

- `tokenUsage`
    
    属性として返されるトークン利用状況メタデータ
- `outputCount`
    
    出力の生成で使用されたトークン数
- `totalCount`
    
    入力と出力で使用されたトークンの合計数
- `inputCount`
    
    入力の処理で使用されたトークン数

## [](#関連情報)関連情報

- [Using Anypoint Code Builder to Configure a Connector](https://docs.mulesoft.com/connectors/introduction/intro-config-use-acb)
- [Studio を使用したコネクタの設定](https://docs.mulesoft.com/connectors/introduction/intro-config-use-studio)
- [MuleSoft AI Chain Connector の概要](https://docs.mulesoft.com/jp/mulesoft-ai-chain-connector/1.0/)
- [MuleSoft AI Chain Connector リファレンス](https://docs.mulesoft.com/jp/mulesoft-ai-chain-connector/1.0/mulesoft-ai-chain-connector-reference)
- [MuleSoft ヘルプセンター](https://help.mulesoft.com)