Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
cyfyifanchen committed Dec 21, 2024
2 parents 337b336 + 470b441 commit 241ec6e
Show file tree
Hide file tree
Showing 30 changed files with 979 additions and 61 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,17 @@ Before we get started, be sure to star our repository and get instant notificati
![TEN star us gif](https://github.com/TEN-framework/docs/blob/main/assets/gif/star_us_2.gif?raw=true)

<br>

<h2>Join Community</h2>

- [Discord](https://discord.gg/VnPftUzAMJ): Ideal for sharing your applications and engaging with the community.
- [GitHub Discussion](https://github.com/TEN-framework/ten-agent/discussions): Perfect for providing feedback and asking questions.
- [GitHub Issues](https://github.com/TEN-framework/ten-agent/issues): Best for reporting bugs and proposing new features. Refer to our [contribution guidelines](./docs/code-of-conduct/contributing.md) for more details.
- [X](https://img.shields.io/twitter/follow/TenFramework?logo=X&color=%20%23f5f5f5): Great for sharing your agents and interacting with the community.

<br>
<h2>Star History</h2>

[![Star History Chart](https://api.star-history.com/svg?repos=ten-framework/ten-agent&type=Date)](https://star-history.com/#ten-framework/ten-agent&Date)

<br>
<h2>Code Contributors</h2>
Expand Down
2 changes: 1 addition & 1 deletion agents/examples/default/property.json
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@
"property": {
"api_key": "${env:OPENAI_REALTIME_API_KEY}",
"temperature": 0.9,
"model": "gpt-4o-realtime-preview",
"model": "gpt-4o-realtime-preview-2024-12-17",
"max_tokens": 2048,
"voice": "alloy",
"language": "en-US",
Expand Down
216 changes: 214 additions & 2 deletions agents/examples/demo/property.json
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@
"property": {
"api_key": "${env:OPENAI_REALTIME_API_KEY}",
"temperature": 0.9,
"model": "gpt-4o-realtime-preview",
"model": "gpt-4o-realtime-preview-2024-12-17",
"max_tokens": 2048,
"voice": "alloy",
"language": "en-US",
Expand Down Expand Up @@ -559,7 +559,7 @@
"property": {
"api_key": "${env:OPENAI_REALTIME_API_KEY}",
"temperature": 0.9,
"model": "gpt-4o-realtime-preview",
"model": "gpt-4o-realtime-preview-2024-12-17",
"max_tokens": 2048,
"audio_out": false,
"input_transcript": false,
Expand Down Expand Up @@ -1155,6 +1155,218 @@
]
}
]
},
{
"name": "va_dify_azure",
"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": true,
"agora_asr_vendor_name": "microsoft",
"agora_asr_language": "en-US",
"agora_asr_vendor_key": "${env:AZURE_STT_KEY|}",
"agora_asr_vendor_region": "${env:AZURE_STT_REGION|}",
"agora_asr_session_control_file_path": "session_control.conf"
}
},
{
"type": "extension",
"name": "llm",
"addon": "dify_python",
"extension_group": "chatgpt",
"property": {
"api_key": "${env:DIFY_API_KEY}",
"base_url": "https://api.dify.ai/v1",
"greeting": "TEN Agent connected with Dify. How can I help you today?",
"user_id": "User"
}
},
{
"type": "extension",
"name": "tts",
"addon": "azure_tts",
"extension_group": "tts",
"property": {
"azure_subscription_key": "${env:AZURE_TTS_KEY}",
"azure_subscription_region": "${env:AZURE_TTS_REGION}",
"azure_synthesis_voice_name": "en-US-AndrewMultilingualNeural"
}
},
{
"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": {}
}
],
"connections": [
{
"extension_group": "default",
"extension": "agora_rtc",
"cmd": [
{
"name": "on_user_joined",
"dest": [
{
"extension_group": "chatgpt",
"extension": "llm"
}
]
},
{
"name": "on_user_left",
"dest": [
{
"extension_group": "chatgpt",
"extension": "llm"
}
]
},
{
"name": "on_connection_failure",
"dest": [
{
"extension_group": "chatgpt",
"extension": "llm"
}
]
}
],
"data": [
{
"name": "text_data",
"dest": [
{
"extension_group": "default",
"extension": "interrupt_detector"
},
{
"extension_group": "transcriber",
"extension": "message_collector"
}
]
}
]
},
{
"extension_group": "chatgpt",
"extension": "llm",
"cmd": [
{
"name": "flush",
"dest": [
{
"extension_group": "tts",
"extension": "tts"
}
]
}
],
"data": [
{
"name": "text_data",
"dest": [
{
"extension_group": "tts",
"extension": "tts"
},
{
"extension_group": "transcriber",
"extension": "message_collector"
}
]
}
]
},
{
"extension_group": "transcriber",
"extension": "message_collector",
"data": [
{
"name": "data",
"dest": [
{
"extension_group": "default",
"extension": "agora_rtc"
}
]
}
]
},
{
"extension_group": "tts",
"extension": "tts",
"cmd": [
{
"name": "flush",
"dest": [
{
"extension_group": "default",
"extension": "agora_rtc"
}
]
}
],
"audio_frame": [
{
"name": "pcm_frame",
"dest": [
{
"extension_group": "default",
"extension": "agora_rtc"
}
]
}
]
},
{
"extension_group": "default",
"extension": "interrupt_detector",
"cmd": [
{
"name": "flush",
"dest": [
{
"extension_group": "chatgpt",
"extension": "llm"
}
]
}
],
"data": [
{
"name": "text_data",
"dest": [
{
"extension_group": "chatgpt",
"extension": "llm"
}
]
}
]
}
]
}
],
"log_level": 3
Expand Down
6 changes: 3 additions & 3 deletions agents/examples/experimental/property.json
Original file line number Diff line number Diff line change
Expand Up @@ -2417,7 +2417,7 @@
"property": {
"api_key": "${env:OPENAI_REALTIME_API_KEY}",
"temperature": 0.9,
"model": "gpt-4o-realtime-preview",
"model": "gpt-4o-realtime-preview-2024-12-17",
"max_tokens": 2048,
"voice": "alloy",
"language": "en-US",
Expand Down Expand Up @@ -2538,7 +2538,7 @@
"property": {
"api_key": "${env:OPENAI_REALTIME_API_KEY}",
"temperature": 0.9,
"model": "gpt-4o-realtime-preview",
"model": "gpt-4o-realtime-preview-2024-12-17",
"max_tokens": 2048,
"audio_out": false,
"input_transcript": false,
Expand Down Expand Up @@ -2697,7 +2697,7 @@
"property": {
"api_key": "${env:OPENAI_REALTIME_API_KEY}",
"temperature": 0.9,
"model": "gpt-4o-realtime-preview",
"model": "gpt-4o-realtime-preview-2024-12-17",
"max_tokens": 2048,
"voice": "alloy",
"language": "en-US",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ async def on_stop(self, ten_env: AsyncTenEnv) -> None:
ten_env.log_debug("on_stop")

self.stopped = True
await self.queue.put(None)

async def on_deinit(self, ten_env: AsyncTenEnv) -> None:
await super().on_deinit(ten_env)
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
{}
{
"token": "${env:COZE_TOKEN}",
"bot_id": "${env:COZE_BOT_ID}",
"base_url": "https://api.coze.cn",
"prompt": "",
"greeting": "TEN Agent connected with Coze. How can I help you today?"
}
19 changes: 19 additions & 0 deletions agents/ten_packages/extension/dify_python/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#
# This file is part of TEN Framework, an open source project.
# Licensed under the Apache License, Version 2.0.
# See the LICENSE file for more information.
#
import("//build/feature/ten_package.gni")

ten_package("dify_python") {
package_kind = "extension"

resources = [
"__init__.py",
"addon.py",
"extension.py",
"manifest.json",
"property.json",
"tests",
]
}
29 changes: 29 additions & 0 deletions agents/ten_packages/extension/dify_python/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# dify_python

<!-- brief introduction for the extension -->

## Features

<!-- main features introduction -->

- xxx feature

## API

Refer to `api` definition in [manifest.json] and default values in [property.json](property.json).

<!-- Additional API.md can be referred to if extra introduction needed -->

## Development

### Build

<!-- build dependencies and steps -->

### Unit test

<!-- how to do unit test for the extension -->

## Misc

<!-- others if applicable -->
6 changes: 6 additions & 0 deletions agents/ten_packages/extension/dify_python/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#
# This file is part of TEN Framework, an open source project.
# Licensed under the Apache License, Version 2.0.
# See the LICENSE file for more information.
#
from . import addon
19 changes: 19 additions & 0 deletions agents/ten_packages/extension/dify_python/addon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#
# This file is part of TEN Framework, an open source project.
# Licensed under the Apache License, Version 2.0.
# See the LICENSE file for more information.
#
from ten import (
Addon,
register_addon_as_extension,
TenEnv,
)
from .extension import DifyExtension


@register_addon_as_extension("dify_python")
class DifyExtensionAddon(Addon):

def on_create_instance(self, ten_env: TenEnv, name: str, context) -> None:
ten_env.log_info("DifyExtensionAddon on_create_instance")
ten_env.on_create_instance_done(DifyExtension(name), context)
Loading

0 comments on commit 241ec6e

Please sign in to comment.