> This is a page from the ElevenLabs documentation. For a complete page index, fetch https://elevenlabs.io/docs/llms.txt. For the full documentation in a single file, fetch https://elevenlabs.io/docs/llms-full.txt.

# オーバーライド

> **Warning**
>
> オーバーライドはシステムプロンプトや最初のメッセージを完全に置き換える場合にも引き続き利用できますが、
> エージェントの応答をカスタマイズし、リアルタイムデータを挿入するには、推奨される方法である[動的 変数](/docs/ja/eleven-agents/customization/personalization/dynamic-variables)の使用をおすすめします。動的変数は、より優れた
> 保守性と、パーソナライズのためのより構造化されたアプローチを提供します。

**オーバーライド**を使うと、アシスタントの動作をユーザーごとのやり取りに合わせて調整できます。各会話の開始時にカスタムデータと設定を渡すことで、リアルタイムのコンテキストに基づき、アシスタントの応答や知識をパーソナライズできます。オーバーライドは、エージェントの[ダッシュボード](https://elevenlabs.io/app/agents/agents)で定義されたデフォルト値を完全に上書きします。

## 概要

オーバーライドを使用すると、複数のエージェントを作成せずに、AIエージェントの動作をリアルタイムで変更できます。これにより、ユーザー固有のデータを使って応答をパーソナライズできます。

エージェントのセキュリティ設定では、以下のフィールドに対してオーバーライドを有効にできます。

* システムプロンプト
* 最初のメッセージ
* 言語
* 音声ID
* LLM（大規模言語モデル）
* ツール
* ナレッジベース
* テキストのみモード
* 安定性
* 速度
* 類似性ブースト
* ASRキーワード

フィールドのオーバーライドを有効にしても、オーバーライドの指定は任意です。指定しない場合、エージェントは[ダッシュボード](https://elevenlabs.io/app/agents/agents)で定義されたデフォルト値を使用します。ほとんどのフィールドでは、そのフィールドのオーバーライドが有効でない状態でオーバーライドを指定するとエラーになります。

> **Warning**
>
> **ASRキーワード**にはソフトな拒否処理が適用されます。セキュリティトグルがオフでもクライアントが
> `asr.keywords`を送信した場合、会話は継続され、キーワードは無視されます（エラーにはなりません）。会話ごとのキーワードブーストを
> 適用するには、セキュリティ設定で**ASRキーワード**のオーバーライドを有効にしてください。1会話あたり最大50個のキーワードをサポートします。

オーバーライドが役立つ例をいくつか紹介します。

* **ユーザーを名前で**あいさつする
* 応答に**アカウント固有の詳細**を含める
* ユーザーの好みに応じてエージェントの**言語**やトーンを調整する
* アカウント残高や注文状況などの**リアルタイムデータを渡す**
* ASRキーワードを通じて、通話ごとの名前や用語（CRMの会社名など）の**文字起こし精度を高める**

> **Info**
>
> オーバーライドは、パーソナライズされた対話が必要なアプリケーションや、エージェントの基本設定に保存すべきでない
> 機密性の高いユーザーデータを扱う場合に特に役立ちます。

## ガイド

### 前提条件

* [ElevenLabsアカウント](https://elevenlabs.io)
* 設定済みのElevenLabs会話型エージェント（[こちらから作成](/docs/ja/eleven-agents/quickstart)）

このガイドでは、デフォルトのエージェントの**システムプロンプト**、**最初のメッセージ**、**LLM**、**ツール**、**ナレッジベース**、**TTS設定**、**ASRキーワード**をオーバーライドする方法を説明します。

#### オーバーライドを有効にする

セキュリティ上の理由から、オーバーライドはデフォルトで無効になっています。`first_message`、`prompt.prompt`、`prompt.tool_ids`、`prompt.knowledge_base`、`language`、`asr.keywords`など、オーバーライドを許可するフィールドを有効にしてください。

#### ダッシュボードで更新

エージェントの設定に移動し、**Security**タブを選択します。`First message`、`System prompt`、`Tools`、`Knowledge base`、`ASR keywords`、および`LLM`など必要なその他のオーバーライドを有効にします。

![オーバーライドを有効化](/docs/_fern-img/496f20380ffe29fc46275bbfe5c6eaabdb5e211c780188243a018b38715ea779.webp)

#### CLIで更新

#### エージェント設定を取得

```bash
elevenlabs agents pull --agent "<agent-name>"
```

#### \`agent_configs/\<agent-name>.json\`を編集

`platform_settings.overrides.conversation_config_override`配下のフィールドを`true`に設定すると、そのフィールドのランタイムオーバーライドを許可できます。

```json
{
  "platform_settings": {
    "overrides": {
      "conversation_config_override": {
        "agent": {
          "first_message": true,
          "language": true,
          "prompt": {
            "prompt": true,
            "tool_ids": true,
            "knowledge_base": true
          }
        },
        "tts": { "voice_id": true },
        "asr": { "keywords": true }
      }
    }
  }
}
```

#### 変更をプッシュ

```bash
elevenlabs agents push --agent "<agent-name>"
```

#### APIで更新

```python
from elevenlabs import ElevenLabs

elevenlabs = ElevenLabs()

elevenlabs.conversational_ai.agents.update(
    agent_id="agent_7101k5zvyjhmfg983brhmhkd98n6",
    platform_settings={
        "overrides": {
            "conversation_config_override": {
                "agent": {
                    "first_message": True,
                    "language": True,
                    "prompt": {
                        "prompt": True,
                        "tool_ids": True,
                        "knowledge_base": True,
                    },
                },
                "tts": {"voice_id": True},
                "asr": {"keywords": True},
            },
        },
    },
)
```

```typescript
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";

const elevenlabs = new ElevenLabsClient();

await elevenlabs.conversationalAi.agents.update("agent_7101k5zvyjhmfg983brhmhkd98n6", {
  platformSettings: {
    overrides: {
      conversationConfigOverride: {
        agent: {
          firstMessage: true,
          language: true,
          prompt: {
            prompt: true,
            toolIds: true,
            knowledgeBase: true,
          },
        },
        tts: { voiceId: true },
        asr: { keywords: true },
      },
    },
  },
});
```

#### 会話をオーバーライド

会話を開始するコードで、オーバーライドをパラメータとして渡します。ツールとナレッジベースのオーバーライドは、その会話のデフォルト配列を置き換えます。ASRキーワードのオーバーライドは、その会話におけるエージェントのデフォルトキーワードリストを置き換えます（最大50キーワード）。

**`Conversation initiation payload`**

```json title="Conversation initiation payload" focus={4-15}
{
  "conversation_config_override": {
    "agent": {
      "prompt": {
        "tool_ids": ["tool_7101k5zvyjhmfg983brhmhkd98n6"],
        "knowledge_base": [
          {
            "type": "file",
            "name": "Unladen Swallow Facts",
            "id": "5xM3yVvZQKV0EfqQpLrJ",
            "usage_mode": "auto"
          }
        ]
      }
    },
    "asr": {
      "keywords": ["Acme Corp", "Contoso", "Globex"]
    }
  }
}
```

> **Tip**
>
> 最新バージョンの[SDK](/docs/ja/eleven-agents/libraries/python)がインストールされていることを確認してください。

**`Python`**

```python title="Python" focus={3-28} maxLines=28
from elevenlabs.conversational_ai.conversation import Conversation, ConversationInitiationData
...
conversation_override = {
    "agent": {
        "prompt": {
            "prompt": f"The customer's bank account balance is {customer_balance}. They are based in {customer_location}.", # Optional: override the system prompt.
            "llm": "gpt-4o", # Optional: override the LLM model.
            "tool_ids": [
                "tool_7101k5zvyjhmfg983brhmhkd98n6"
            ], # Optional: replace the tools available to the agent.
            "knowledge_base": [
                {
                    "type": "file",
                    "name": "Unladen Swallow Facts",
                    "id": "5xM3yVvZQKV0EfqQpLrJ",
                    "usage_mode": "auto",
                }
            ], # Optional: replace the knowledge base available to the agent.
        },
        "first_message": f"Hi {customer_name}, how can I help you today?", # Optional: override the first_message.
        "language": "en" # Optional: override the language.
    },
    "tts": {
        "voice_id": "custom_voice_id", # Optional: override the voice.
        "stability": 0.7, # Optional: override stability (0.0 to 1.0).
        "speed": 1.1, # Optional: override speed (0.7 to 1.2).
        "similarity_boost": 0.9 # Optional: override similarity boost (0.0 to 1.0).
    },
    "conversation": {
        "text_only": True # Optional: enable text-only mode (no audio).
    },
    "asr": {
        "keywords": ["Acme Corp", "Contoso"] # Optional: boost ASR for per-call terms (max 50). Requires Security → ASR keywords.
    }
}

config = ConversationInitiationData(
    conversation_config_override=conversation_override
)
conversation = Conversation(
    ...
    config=config,
    ...
)
conversation.start_session()
```

**`JavaScript`**

```javascript title="JavaScript" focus={4-29} maxLines=29
...
const conversation = await Conversation.startSession({
  ...
  overrides: {
      agent: {
          prompt: {
              prompt: `The customer's bank account balance is ${customer_balance}. They are based in ${customer_location}.`, // Optional: override the system prompt.
              llm: "gpt-4o", // Optional: override the LLM model.
              toolIds: [
                  "tool_7101k5zvyjhmfg983brhmhkd98n6"
              ], // Optional: replace the tools available to the agent.
              knowledgeBase: [
                  {
                      type: "file",
                      name: "Unladen Swallow Facts",
                      id: "5xM3yVvZQKV0EfqQpLrJ",
                      usageMode: "auto",
                  }
              ], // Optional: replace the knowledge base available to the agent.
          },
          firstMessage: `Hi ${customer_name}, how can I help you today?`, // Optional: override the first message.
          language: "en" // Optional: override the language.
      },
      tts: {
          voiceId: "custom_voice_id", // Optional: override the voice.
          stability: 0.7, // Optional: override stability (0.0 to 1.0).
          speed: 1.1, // Optional: override speed (0.7 to 1.2).
          similarityBoost: 0.9 // Optional: override similarity boost (0.0 to 1.0).
      },
      conversation: {
          textOnly: true // Optional: enable text-only mode (no audio).
      },
      asr: {
          keywords: ["Acme Corp", "Contoso"] // Optional: boost ASR for per-call terms (max 50). Requires Security → ASR keywords.
      }
  },
  ...
})
```

**`Swift`**

```swift title="Swift" focus={3-16} maxLines=16
import ElevenLabsSDK

let promptOverride = ElevenLabsSDK.AgentPrompt(
    prompt: "The customer's bank account balance is \(customer_balance). They are based in \(customer_location).", // Optional: override the system prompt.
    llm: "gpt-4o" // Optional: override the LLM model.
)
let agentConfig = ElevenLabsSDK.AgentConfig(
    prompt: promptOverride, // Optional: override the system prompt.
    firstMessage: "Hi \(customer_name), how can I help you today?", // Optional: override the first message.
    language: .en // Optional: override the language.
)
let ttsConfig = ElevenLabsSDK.TTSConfig(
    voiceId: "custom_voice_id", // Optional: override the voice.
    stability: 0.7, // Optional: override stability (0.0 to 1.0).
    speed: 1.1, // Optional: override speed (0.7 to 1.2).
    similarityBoost: 0.9 // Optional: override similarity boost (0.0 to 1.0).
)
let conversationConfig = ElevenLabsSDK.ConversationConfig(
    textOnly: true // Optional: enable text-only mode (no audio).
)
let overrides = ElevenLabsSDK.ConversationConfigOverride(
    agent: agentConfig, // Optional: override agent settings.
    tts: ttsConfig, // Optional: override TTS settings.
    conversation: conversationConfig // Optional: override conversation settings.
)

let config = ElevenLabsSDK.SessionConfig(
    agentId: "",
    overrides: overrides
)

let conversation = try await ElevenLabsSDK.Conversation.startSession(
  config: config,
  callbacks: callbacks
)
```

**`Widget`**

```html title="Widget"
  <elevenlabs-convai
    agent-id="agent_7101k5zvyjhmfg983brhmhkd98n6"
    override-language="es"         <!-- Optional: override the language -->
    override-prompt="Custom system prompt for this user"  <!-- Optional: override the system prompt -->
    override-first-message="Hi! How can I help you today?"  <!-- Optional: override the first message -->
    override-voice-id="custom_voice_id"  <!-- Optional: override the voice -->
  ></elevenlabs-convai>
```

> **Note**
>
> オーバーライドを使用する場合は、空文字列やnull値を設定するのではなく、オーバーライドしたくないフィールドを省略してください。カスタマイズしたいフィールドのみを含めてください。

> **Tip**
>
> 正しいLLMモデル文字列を確認するには、対応するすべてのLLMモデルとその正確な文字列識別子が記載されている[Agent APIリファレンス](/docs/ja/api-reference/agents/create#request.body.conversation_config.agent.prompt.llm)を参照してください。