Eleven v4を発表これまでで最も感情豊かなモデル、Eleven v4をご紹介します。

コンテンツへ移動

銅像と会話:マルチモーダルなElevenAgents搭載アプリの構築

執筆者
Joe Reeve
公開日
最終更新日

聴くこの記事を聴く

像を撮影し、描かれている人物を特定します。その後、それぞれの人物が時代に合った個性的な声で話す、リアルタイムの音声会話を楽しめます。

これが、ElevenLabsのボイスデザインAPIとAgent APIで構築できるものです。この記事では、コンピュータビジョンと音声生成を組み合わせ、公共モニュメントをインタラクティブな体験に変えるモバイルWebアプリのアーキテクチャを解説します。ここで紹介する内容はすべて、以下のAPIとコードサンプルで再現できます。

チュートリアルを飛ばして、1つのプロンプトで構築する

以下のアプリ全体は、1つのプロンプトから構築されたものです。空のNextJSプロジェクトでClaude Opus 4.5(high)を使い、 Cursor で一発生成に成功することをテスト済みです。すぐに独自のアプリを作りたい場合は、以下をエディタに貼り付けてください。

We need to make an app that:
- is optimised for mobile
- allows the user to take a picture (of a statue, picture, monument, etc) that includes one or more people
- uses an OpenAI LLM api call to identify the statue/monument/picture, characters within it, the location, and name
- allows the user to check it's correct, and then do either a deep research or a standard search to get information about the characters and the statue's history, and it's current location
- then create an ElevenLabs agent (allowing multiple voices), that the user can then talk to as though they're talking to the characters in the statue. Each character should use voice designer api to create a matching voice.
The purpose is to be fun and educational.

https://elevenlabs.io/docs/eleven-api/guides/how-to/voices/voice-design
https://elevenlabs.io/docs/eleven-agents/quickstart 
https://elevenlabs.io/docs/api-reference/agents/create


ドキュメントへのリンクの代わりに、ElevenLabs Agent Skills も利用できます。これらはドキュメントに基づいており、さらに優れた結果が得られる場合があります。

ここからは、そのプロンプトで生成される内容を詳しく解説します。

仕組み

パイプラインは5つのステップで構成されます。

  1. 画像を撮影する
  2. 作品と登場人物を特定する(OpenAI)
  3. 歴史を調査する(OpenAI)
  4. 各人物に固有の音声を生成する(ElevenAPI)
  5. WebRTC経由でリアルタイムの音声会話を開始する(ElevenAgents)

ビジョンで像を特定する

ユーザーが像を撮影すると、その画像 がOpenAIの画像認識対応モデルに送信されます。構造化されたシステムプロンプトにより、作品名、場所、作者、制作年、そして重要な情報である各人物の詳細な音声説明を抽出します。システムプロンプトには、想定するJSON出力形式が含まれています。

{
  "statueName": "string - name of the statue, monument, or artwork",
  "location": "string - where it is located (city, country)",
  "artist": "string - the creator of the artwork",
  "year": "string - year completed or unveiled",
  "description": "string - brief description of the artwork and its historical significance",
  "characters": [
    {
      "name": "string - character name",
      "description": "string - who this person was and their historical significance",
      "era": "string - time period they lived in",
      "voiceDescription": "string - detailed voice description for Voice Design API (include audio quality marker, age, gender, vocal qualities, accent, pacing, and personality)"
    }
  ]
}
const response = await openai.chat.completions.create({
  model: "gpt-5.2",
  response_format: { type: "json_object" },
  messages: [
    { role: "system", content: SYSTEM_PROMPT },
    {
      role: "user",
      content: [
        {
          type: "text",
          text: "Identify this statue/monument/artwork and all characters depicted.",
        },
        {
          type: "image_url",
          image_url: {
            url: `data:image/jpeg;base64,${base64Data}`,
            detail: "high",
          },
        },
      ],
    },
  ],
  max_completion_tokens: 2500,
});

ロンドンのウェストミンスター橋にあるブーディカ像の写真では、応答は次のようになります。

{
  "statueName": "Boudica and Her Daughters",
  "location": "Westminster Bridge, London, UK",
  "artist": "Thomas Thornycroft",
  "year": "1902",
  "description": "Bronze statue depicting Queen Boudica riding a war chariot with her two daughters, commemorating her uprising against Roman occupation of Britain.",
  "characters": [
    {
      "name": "Boudica",
      "description": "Queen of the Iceni tribe who led an uprising against Roman occupation",
      "era": "Ancient Britain, 60-61 AD",
      "voiceDescription": "Perfect audio quality. A powerful woman in her 30s with a deep, resonant voice and a thick Celtic British accent. Her tone is commanding and fierce, with a booming quality that projects authority. She speaks at a measured, deliberate pace with passionate intensity."
    },
    // Other characters in the statue
  ]
}

効果的な音声説明を書く

音声説明の品質は、生成される音声の品質を直接左右します。 ボイスデザインのプロンプトガイド で詳しく解説していますが、含めるべき主な属性は、音質マーカー("Perfect audio quality.")、年齢と性別、トーン/声質(低い、響きのある、しゃがれた声)、正確なアクセント(単に"British"ではなく"thick Celtic British accent")、話すペースです。より具体的なプロンプトほど、正確な結果が得られます。たとえば、"a tired New Yorker in her 60s with a dry sense of humor"は、常に"an older female voice"より優れた結果をもたらします。

ガイドから注目すべきポイントをいくつか紹介します。アクセントの強さを表すには"strong"ではなく"thick"を使い、"foreign"のような曖昧な表現は避けてください。架空または歴史上の人物には、実在するアクセントを参考として指定できます(例:"an ancient Celtic queen with a thick British accent, regal and commanding")。

次のボイスデザイン

ボイスデザインAPI は、テキスト説明から新しい合成音声を生成します。音声サンプル やクローンは必要ありません。そのため、元となる音声が存在しない歴史上の人物に適しています。

手順は2ステップです。

プレビューを生成する

const { previews } = await elevenlabs.textToVoice.design({
  modelId: "eleven_multilingual_ttv_v2",
  voiceDescription: character.voiceDescription,
  text: sampleText,
});

textパラメータは重要です。より長く、人物に合ったサンプルテキスト(50語以上)を使うと、より安定した結果が得られます。一般的な挨拶ではなく、その人物に合った台詞にしてください。 ボイスデザインのプロンプトガイド で、さらに詳しく解説しています。

音声を保存する

プレビューを生成したら、その中から1つを選び、永続的な音声を作成します。

const voice = await elevenlabs.textToVoice.create({
  voiceName: `StatueScanner - ${character.name}`,
  voiceDescription: character.voiceDescription,
  generatedVoiceId: previews[0].generatedVoiceId,
});

複数の人物がいる像では、音声作成を並列で実行します。5人分の音声でも、ほぼ1人分と同じ時間で生成できます。

const results = await Promise.all(
  characters.map((character) => createVoiceForCharacter(character))
);

複数音声対応のElevenLabs Agentを構築する

音声を作成したら、次はリアルタイムで人物ごとの音声を切り替えられる ElevenLabs Agent を設定します。

const agent = await elevenlabs.conversationalAi.agents.create({
  name: `Statue Scanner - ${statueName}`,
  tags: ["statue-scanner"],
  conversationConfig: {
    agent: {
      firstMessage,
      language: "en",
      prompt: {
        prompt: systemPrompt,
        temperature: 0.7,
      },
    },
    tts: {
      voiceId: primaryCharacter.voiceId,
      modelId: "eleven_v3",
      supportedVoices: otherCharacters.map((c) => ({
        voiceId: c.voiceId,
        label: c.name,
        description: c.voiceDescription,
      })),
    },
    turn: {
      turnTimeout: 10,
    },
    conversation: {
      maxDurationSeconds: 600,
    },
  },
});

複数音声の切り替え

supportedVoices配列で、エージェントが利用できる音声を指定します。Agentsプラットフォームが音声の切り替えを自動で処理します。LLMの応答から別の人物が話していると判断されると、TTS エンジンがそのセグメントを正しい音声に振り分けます。

グループ会話のためのプロンプトエンジニアリング

複数の人物を、順番に進むQ&Aではなく本物のグループのように感じさせるには、意図的なプロンプト設計が必要です。

const multiCharacterRules = `
MULTI-CHARACTER DYNAMICS:
You are playing ALL ${characters.length} characters simultaneously.
Make this feel like a group conversation, not an interview.

- Characters should interrupt each other:
  "Actually, if I may -" / "Wait, I must say -"

- React to what others say:
  "Well said." / "I disagree with that..." / "Always so modest..."

- Have side conversations:
  "Do you remember when -" / "Tell them about the time you -"

The goal is for users to feel like they are witnessing a real exchange
between people who happen to include them.
`;

WebRTCによるリアルタイム音声会話

最後の要素はクライアント接続です。ElevenLabs Agentsは、低レイテンシーの音声会話にWebRTCをサポートしています。WebSocketベースの接続より明らかに高速で、自然な会話のターンテイキングに重要です。

サーバー側:会話トークンを取得する

const { token } = await client.conversationalAi.conversations.getWebrtcToken({
    agentId,
});

クライアント側:セッションを開始する

import { useConversation } from "@elevenlabs/react";

const conversation = useConversation({
  onConnect: () => setIsSessionActive(true),
  onDisconnect: () => setIsSessionActive(false),
  onMessage: (message) => {
    if (message.source === "ai") {
      setMessages((prev) => [...prev, { role: "agent", text: message.message }]);
    }
  },
});

await conversation.startSession({
  agentId,
  conversationToken: token,
  connectionType: "webrtc",
});

useConversationフックは、音声のキャプチャ、ストリーミング、音声アクティビティ検出、再生を処理します。

Web検索で調査を深める

会話を始める前に、より詳しい歴史的背景を知りたいユーザー向けに、OpenAIのWeb検索ツールを使った強化リサーチモードを追加できます。

const response = await openai.responses.create({
  model: "gpt-5.2",
  instructions: RESEARCH_SYSTEM_PROMPT,
  tools: [{ type: "web_search_preview" }],
  input: `Research ${identification.statueName}. Search for current information
including location, visiting hours, and recent news about the artwork.`,
});

得られた知見

このプロジェクトは、テキスト、リサーチ、ビジョン、オーディオといった異なるAIモダリティを組み合わせることで、デジタルと現実世界の両方にまたがる体験を構築できることを示しています。教育、仕事、そして楽しみのために、より多くの人がマルチモーダルエージェントの未開拓の可能性を探求することを期待しています。

構築を始める

このプロジェクトで使用したAPI、 ボイスデザイン、 ElevenAgents、OpenAIは、すべて現在利用できます。

執筆者

ジョーはElevenLabsの成長チームで働いており、デベロッパーがElevenLabsの最先端オーディオモデルを最大限に活用できるよう支援しています

関連記事

最高品質のAIオーディオで創造する