Skip to content

Commit 6ecb09a

Browse files
committed
feat: add amazon nova sonic realtime to demo
1 parent bac5e6b commit 6ecb09a

File tree

2 files changed

+152
-2
lines changed

2 files changed

+152
-2
lines changed

agents/examples/demo/property.json

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2552,6 +2552,144 @@
25522552
]
25532553
}
25542554
]
2555+
},
2556+
{
2557+
"name": "va_bedrock_v2v",
2558+
"auto_start": true,
2559+
"nodes": [
2560+
{
2561+
"type": "extension",
2562+
"name": "agora_rtc",
2563+
"addon": "agora_rtc",
2564+
"extension_group": "rtc",
2565+
"property": {
2566+
"app_id": "${env:AGORA_APP_ID}",
2567+
"token": "",
2568+
"channel": "ten_agent_test",
2569+
"stream_id": 1234,
2570+
"remote_stream_id": 123,
2571+
"subscribe_audio": true,
2572+
"publish_audio": true,
2573+
"publish_data": true,
2574+
"subscribe_audio_sample_rate": 24000
2575+
}
2576+
},
2577+
{
2578+
"type": "extension",
2579+
"name": "v2v",
2580+
"addon": "bedrock_v2v_python",
2581+
"extension_group": "llm",
2582+
"property": {
2583+
"access_key_id": "${env:AWS_ACCESS_KEY_ID}",
2584+
"channels": 1,
2585+
"max_tokens": 512,
2586+
"model": "amazon.nova-sonic-v1:0",
2587+
"prompt": "Now you are an intelligent assistant with real-time interaction capabilities. I will provide you with a series of real-time video image information. Please understand these images as video frames. Based on the images and the user's input, engage in a conversation with the user, remembering the dialogue content in a concise and clear manner.",
2588+
"region": "us-east-1",
2589+
"sample_rate": 16000,
2590+
"sample_size_bits": 16,
2591+
"secret_access_key": "${env:AWS_SECRET_ACCESS_KEY}",
2592+
"temperature": 0.7,
2593+
"topK": 20,
2594+
"topP": 0.5,
2595+
"voice_id": "matthew"
2596+
}
2597+
},
2598+
{
2599+
"type": "extension",
2600+
"name": "message_collector",
2601+
"addon": "message_collector",
2602+
"extension_group": "transcriber",
2603+
"property": {}
2604+
}
2605+
],
2606+
"connections": [
2607+
{
2608+
"extension": "agora_rtc",
2609+
"cmd": [
2610+
{
2611+
"name": "on_user_joined",
2612+
"dest": [
2613+
{
2614+
"extension": "v2v"
2615+
}
2616+
]
2617+
},
2618+
{
2619+
"name": "on_user_left",
2620+
"dest": [
2621+
{
2622+
"extension": "v2v"
2623+
}
2624+
]
2625+
},
2626+
{
2627+
"name": "on_connection_failure",
2628+
"dest": [
2629+
{
2630+
"extension": "v2v"
2631+
}
2632+
]
2633+
}
2634+
],
2635+
"audio_frame": [
2636+
{
2637+
"name": "pcm_frame",
2638+
"dest": [
2639+
{
2640+
"extension": "v2v"
2641+
}
2642+
]
2643+
}
2644+
]
2645+
},
2646+
{
2647+
"extension": "v2v",
2648+
"cmd": [
2649+
{
2650+
"name": "flush",
2651+
"dest": [
2652+
{
2653+
"extension": "agora_rtc"
2654+
}
2655+
]
2656+
}
2657+
],
2658+
"data": [
2659+
{
2660+
"name": "text_data",
2661+
"dest": [
2662+
{
2663+
"extension": "message_collector"
2664+
}
2665+
]
2666+
}
2667+
],
2668+
"audio_frame": [
2669+
{
2670+
"name": "pcm_frame",
2671+
"dest": [
2672+
{
2673+
"extension": "agora_rtc"
2674+
}
2675+
]
2676+
}
2677+
]
2678+
},
2679+
{
2680+
"extension": "message_collector",
2681+
"data": [
2682+
{
2683+
"name": "data",
2684+
"dest": [
2685+
{
2686+
"extension": "agora_rtc"
2687+
}
2688+
]
2689+
}
2690+
]
2691+
}
2692+
]
25552693
}
25562694
],
25572695
"log_level": 3

demo/src/app/api/agents/start/graph.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ export const voiceNameMap: LanguageMap = {
3939
openai: {
4040
male: "ash",
4141
female: "shimmer"
42+
},
43+
novasonic: {
44+
male: "matthew",
45+
female: "tiffany"
4246
}
4347
},
4448
"ja-JP": {
@@ -288,8 +292,16 @@ export const getGraphProperties = (
288292
"azure_synthesis_voice_name": voiceNameMap[language]["azure"][voiceType]
289293
}
290294
}
295+
} else if (graphName === "va_bedrock_v2v") {
296+
return {
297+
"v2v": {
298+
"model": "amazon.nova-sonic-v1:0",
299+
"voice": voiceNameMap[language]["novasonic"][voiceType],
300+
"language": language,
301+
"prompt": prompt,
302+
"greeting": combined_greeting,
303+
}
304+
}
291305
}
292-
293-
294306
return {}
295307
}

0 commit comments

Comments
 (0)