Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/story telling #553

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@
"editor.defaultFormatter": "ms-python.black-formatter"
},
"git.ignoreLimitWarning": true,
"pylint.ignorePatterns": [
"*/ten_runtime_python/**/*",
"/usr/lib/**/*"
],
}
5 changes: 5 additions & 0 deletions agents/examples/default/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@
"type": "extension",
"name": "coze_python_async",
"version": "=0.1.0"
},
{
"type": "extension",
"name": "openai_image_generate_tool",
"version": "=0.1.0"
}
]
}
322 changes: 313 additions & 9 deletions agents/examples/default/property.json
Original file line number Diff line number Diff line change
Expand Up @@ -546,35 +546,35 @@
"connections": [
{
"extension": "agora_rtc",
"audio_frame": [
"cmd": [
{
"name": "pcm_frame",
"name": "on_user_joined",
"dest": [
{
"extension": "v2v"
}
]
}
],
"cmd": [
},
{
"name": "on_user_joined",
"name": "on_user_left",
"dest": [
{
"extension": "v2v"
}
]
},
{
"name": "on_user_left",
"name": "on_connection_failure",
"dest": [
{
"extension": "v2v"
}
]
},
}
],
"audio_frame": [
{
"name": "on_connection_failure",
"name": "pcm_frame",
"dest": [
{
"extension": "v2v"
Expand Down Expand Up @@ -651,6 +651,310 @@
]
}
]
},
{
"name": "story_teller",
"auto_start": true,
"nodes": [
{
"type": "extension",
"name": "agora_rtc",
"addon": "agora_rtc",
"extension_group": "default",
"property": {
"app_id": "${env:AGORA_APP_ID}",
"token": "<agora_token>",
"channel": "ten_agent_test",
"stream_id": 1234,
"remote_stream_id": 123,
"subscribe_audio": true,
"publish_audio": true,
"publish_data": true,
"enable_agora_asr": false
}
},
{
"type": "extension",
"name": "stt",
"addon": "deepgram_asr_python",
"extension_group": "stt",
"property": {
"api_key": "${env:DEEPGRAM_API_KEY}",
"language": "en-US",
"model": "nova-2",
"sample_rate": 16000
}
},
{
"type": "extension",
"name": "llm",
"addon": "openai_chatgpt_python",
"extension_group": "chatgpt",
"property": {
"api_key": "${env:OPENAI_API_KEY}",
"base_url": "",
"frequency_penalty": 0.9,
"greeting": "TEN Agent connected. How can I help you today?",
"max_memory_length": 10,
"max_tokens": 512,
"model": "${env:OPENAI_MODEL}",
"prompt": "You are an ai agent bot producing child picture books. Each response should be short and no more than 50 words as it's for child. \nFor each response, you will use the 'image_generate' tool to create an image based on the description or key moment in that part of the story. The story should be set in a fantasy world. Try asking questions relevant to the story to decide how the story should proceed. Each response should include rich, vivid descriptions that will guide the 'image_generate' tool to produce an image that aligns with the scene or mood.\n Whether it’s the setting, a character’s expression, or a dramatic moment, the paragraph should give enough detail for a meaningful visual representation.",
"proxy_url": "${env:OPENAI_PROXY_URL}"
}
},
{
"type": "extension",
"name": "tts",
"addon": "fish_audio_tts",
"extension_group": "tts",
"property": {
"api_key": "${env:FISH_AUDIO_TTS_KEY}",
"model_id": "d8639b5cc95548f5afbcfe22d3ba5ce5",
"optimize_streaming_latency": true,
"request_timeout_seconds": 30,
"base_url": "https://api.fish.audio"
}
},
{
"type": "extension",
"name": "interrupt_detector",
"addon": "interrupt_detector_python",
"extension_group": "default",
"property": {}
},
{
"type": "extension",
"name": "message_collector",
"addon": "message_collector",
"extension_group": "transcriber",
"property": {}
},
{
"type": "extension",
"name": "message_collector2",
"addon": "message_collector",
"extension_group": "transcriber",
"property": {}
},
{
"type": "extension",
"name": "weatherapi_tool_python",
"addon": "weatherapi_tool_python",
"extension_group": "default",
"property": {
"api_key": "${env:WEATHERAPI_API_KEY|}"
}
},
{
"type": "extension",
"name": "openai_image_generate_tool",
"addon": "openai_image_generate_tool",
"extension_group": "default",
"property": {
"api_key": "${env:OPENAI_API_KEY}"
}
}
],
"connections": [
{
"extension": "agora_rtc",
"cmd": [
{
"name": "on_user_joined",
"dest": [
{
"extension": "llm"
}
]
},
{
"name": "on_user_left",
"dest": [
{
"extension": "llm"
}
]
},
{
"name": "on_connection_failure",
"dest": [
{
"extension": "llm"
}
]
}
],
"audio_frame": [
{
"name": "pcm_frame",
"dest": [
{
"extension": "stt"
}
]
}
]
},
{
"extension": "stt",
"data": [
{
"name": "text_data",
"dest": [
{
"extension": "interrupt_detector"
},
{
"extension": "message_collector"
}
]
}
]
},
{
"extension": "llm",
"cmd": [
{
"name": "flush",
"dest": [
{
"extension": "tts"
}
]
},
{
"name": "tool_call",
"dest": [
{
"extension": "weatherapi_tool_python"
},
{
"extension": "openai_image_generate_tool"
}
]
}
],
"data": [
{
"name": "text_data",
"dest": [
{
"extension": "tts"
},
{
"extension": "message_collector"
}
]
},
{
"name": "raw_text_data",
"dest": [
{
"extension": "message_collector2"
}
]
}
]
},
{
"extension": "message_collector",
"data": [
{
"name": "data",
"dest": [
{
"extension": "agora_rtc"
}
]
}
]
},
{
"extension": "message_collector2",
"data": [
{
"name": "data",
"dest": [
{
"extension": "agora_rtc"
}
]
}
]
},
{
"extension": "tts",
"cmd": [
{
"name": "flush",
"dest": [
{
"extension": "agora_rtc"
}
]
}
],
"audio_frame": [
{
"name": "pcm_frame",
"dest": [
{
"extension": "agora_rtc"
}
]
}
]
},
{
"extension": "interrupt_detector",
"cmd": [
{
"name": "flush",
"dest": [
{
"extension": "llm"
}
]
}
],
"data": [
{
"name": "text_data",
"dest": [
{
"extension": "llm"
}
]
}
]
},
{
"extension": "weatherapi_tool_python",
"cmd": [
{
"name": "tool_register",
"dest": [
{
"extension": "llm"
}
]
}
]
},
{
"extension": "openai_image_generate_tool",
"cmd": [
{
"name": "tool_register",
"dest": [
{
"extension": "llm"
}
]
}
]
}
]
}
],
"log_level": 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
StatusCode,
CmdResult,
Data,
TenError,
)
from ten.audio_frame import AudioFrameDataFmt
from ten_ai_base.const import CMD_PROPERTY_RESULT, CMD_TOOL_CALL
Expand Down
Loading
Loading