mcpField
T
tavus-cvi-interactions

tavus-cvi-interactions

github.com/tavus-engineering開発961 回インストール40 週間前に更新
リポジトリ

tavus-cvi-interactions について

tavus-cvi-interactionsは、WebRTCデータチャネル経由でTavus CVIのライブ会話を操作するスキルです。発話やコンテキストの注入、ターン制御、会話イベントの監視を行う開発者向けです。

主な機能

  1. 01テキストや音声をレプリカに発話させる
  2. 02テキストをユーザー入力としてLLMに渡す
  3. 03レプリカの発話を中断する
  4. 04会話コンテキストを置換・追加する
  5. 05ターン交代の感度を調整する
  6. 06発話や会話イベントを受信する

活用シーン

  1. 01echoモードでレプリカの発話を手動制御する
  2. 02LLM主導の会話中にコンテキストを追加する
  3. 03ツール呼び出しイベントを処理して応答する
  4. 04参加者の発話開始・終了を追跡する

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/tavus-engineering/tavus-skills --skill tavus-cvi-interactions

インストール後、Claude Code で/tavus-cvi-interactionsを入力して読み込まれたか確認します。

詳細

Tavus CVI インタラクションプロトコル

WebRTC データチャネルを介して、ライブ会話をプログラムから制御します。

セットアップ:Daily.js クライアント

<script src="https://unpkg.com/@daily-co/daily-js"></script>
<script>
const call = window.Daily.createFrame();

// Listen for events from CVI
call.on('app-message', (event) => {
  console.log('CVI event:', event.data);
});

// Join the conversation
call.join({ url: 'YOUR_CONVERSATION_URL' });

// Send interaction
function send(interaction) {
  call.sendAppMessage(interaction, '*');
}
</script>

送信できるインタラクション

Echo:レプリカにテキストを話させる

LLM を介さず、指定した内容をそのままレプリカに話させます。

send({
  "message_type": "conversation",
  "event_type": "conversation.echo",
  "conversation_id": "YOUR_CONVERSATION_ID",
  "properties": {
    "modality": "text",
    "text": "Hello! Let me tell you about our product."
  }
});

ストリーミング音声(base64)の場合:

send({
  "message_type": "conversation",
  "event_type": "conversation.echo",
  "conversation_id": "YOUR_CONVERSATION_ID",
  "properties": {
    "modality": "audio",
    "audio": "BASE64_ENCODED_AUDIO",
    "sample_rate": 24000,
    "inference_id": "unique-id",
    "done": "true"
  }
});
Respond:ユーザー入力を注入する

テキストをユーザーが話したかのように扱います(LLM を介します)。

send({
  "message_type": "conversation",
  "event_type": "conversation.respond",
  "conversation_id": "YOUR_CONVERSATION_ID",
  "properties": {
    "text": "What are your pricing plans?"
  }
});
Interrupt:レプリカの発話を停止する
send({
  "message_type": "conversation",
  "event_type": "conversation.interrupt",
  "conversation_id": "YOUR_CONVERSATION_ID"
});
コンテキストを上書きする

会話のコンテキスト全体を置き換えます。

send({
  "message_type": "conversation",
  "event_type": "conversation.overwrite_context",
  "conversation_id": "YOUR_CONVERSATION_ID",
  "properties": {
    "context": "User is now asking about enterprise features."
  }
});
コンテキストを追加する

既存のコンテキストを置き換えずに追加します。

send({
  "message_type": "conversation",
  "event_type": "conversation.append_context",
  "conversation_id": "YOUR_CONVERSATION_ID",
  "properties": {
    "context": "User mentioned they have a team of 50 people."
  }
});
感度を調整する

会話中にターンテイキングの感度を変更します。

send({
  "message_type": "conversation",
  "event_type": "conversation.sensitivity",
  "conversation_id": "YOUR_CONVERSATION_ID",
  "properties": {
    "participant_pause_sensitivity": "high",
    "participant_interrupt_sensitivity": "low"
  }
});

値:low、medium、high

受信するイベント

発話(話された内容)
{
  "event_type": "conversation.utterance",
  "properties": {
    "role": "user",
    "content": "Tell me about your product"
  }
}

役割:user または replica

レプリカの発話開始/停止
{
  "event_type": "conversation.replica.started_speaking",
  "properties": {
    "inference_id": "inf-123"
  }
}
{
  "event_type": "conversation.replica.stopped_speaking",
  "properties": {
    "inference_id": "inf-123",
    "duration": 4.5
  }
}
ユーザーの発話開始/停止
{
  "event_type": "conversation.user.started_speaking"
}
ツール呼び出し(関数呼び出し)

LLM がツールを呼び出したとき:

{
  "event_type": "conversation.tool_call",
  "properties": {
    "tool_name": "get_weather",
    "arguments": {
      "location": "San Francisco, CA"
    },
    "inference_id": "inf-123"
  }
}

処理後、echo または respond インタラクションで応答します。

知覚分析

Raven がユーザーを分析したとき:

{
  "event_type": "conversation.perception_analysis",
  "properties": {
    "analysis": "User appears engaged, smiling, looking at camera"
  }
}
レプリカの割り込み

レプリカが割り込まれたときに発生します。

{
  "event_type": "conversation.replica.interrupted",
  "properties": {
    "inference_id": "inf-123"
  }
}

Python クライアント(Daily-Python)

from daily import Daily, CallClient

Daily.init()
client = CallClient()

def on_app_message(message, sender):
    print(f"Received: {message}")

client.set_user_name("bot")
client.join(meeting_url, completion=on_join)

# Send interaction
client.send_app_message({
    "message_type": "conversation",
    "event_type": "conversation.echo",
    "conversation_id": "xxx",
    "properties": {"text": "Hello!"}
})

よくあるパターン

手動制御による Echo モード
  1. pipeline_mode: "echo" でペルソナを作成します
  2. Daily クライアントで会話に参加します
  3. conversation.echo イベントを送信して発話を制御します
  4. conversation.interrupt を送信して停止します
  5. イベントをリッスンして状態を追跡します
ハイブリッド:LLM + 手動注入
  1. 通常の会話では pipeline_mode: "full" を使用します
  2. conversation.append_context でコンテキストを注入します
  3. 必要に応じて conversation.echo で上書きします
  4. すぐに制御を引き継ぐには、conversation.interrupt と conversation.echo を使用します

コメント