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

add fashionai #329

Merged
merged 18 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from 13 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
219 changes: 218 additions & 1 deletion agents/property.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,223 @@
"_ten": {
"log_level": 3,
"predefined_graphs": [
{
"name": "va.openai.azure.fashionai",
"auto_start": true,
"connections": [
{
"app": "localhost",
"data": [
{
"dest": [
{
"app": "localhost",
"extension": "interrupt_detector",
"extension_group": "default"
},
{
"app": "localhost",
"extension": "openai_chatgpt",
"extension_group": "chatgpt"
},
{
"app": "localhost",
"extension": "message_collector",
"extension_group": "transcriber"
}
],
"name": "text_data"
}
],
"extension": "agora_rtc",
"extension_group": "default"
},
{
"app": "localhost",
"cmd": [
{
"dest": [
{
"app": "localhost",
"extension": "azure_tts",
"extension_group": "tts"
},
{
"app": "localhost",
"extension": "fashionai",
"extension_group": "default"
}
],
"name": "flush"
}
],
"data": [
{
"dest": [
{
"app": "localhost",
"extension": "message_collector",
"extension_group": "transcriber"
},
{
"app": "localhost",
"extension": "fashionai",
"extension_group": "default"
}
],
"name": "text_data"
}
],
"extension": "openai_chatgpt",
"extension_group": "chatgpt"
},
{
"app": "localhost",
"audio_frame": [
{
"dest": [
{
"app": "localhost",
"extension": "agora_rtc",
"extension_group": "default"
}
],
"name": "pcm_frame"
}
],
"cmd": [
{
"dest": [
{
"app": "localhost",
"extension": "agora_rtc",
"extension_group": "default"
}
],
"name": "flush"
}
],
"extension": "azure_tts",
"extension_group": "tts"
},
{
"app": "localhost",
"data": [
{
"dest": [
{
"app": "localhost",
"extension": "agora_rtc",
"extension_group": "default"
}
],
"name": "data"
}
],
"extension": "message_collector",
"extension_group": "transcriber"
},
{
"app": "localhost",
"cmd": [
{
"dest": [
{
"app": "localhost",
"extension": "openai_chatgpt",
"extension_group": "chatgpt"
}
],
"name": "flush"
}
],
"extension": "interrupt_detector",
"extension_group": "default"
}
],
"nodes": [
{
"addon": "agora_rtc",
"app": "localhost",
"extension_group": "default",
"name": "agora_rtc",
"property": {
"agora_asr_language": "en-US",
"agora_asr_session_control_file_path": "session_control.conf",
"agora_asr_vendor_key": "$AZURE_STT_KEY",
"agora_asr_vendor_name": "microsoft",
"agora_asr_vendor_region": "$AZURE_STT_REGION",
"app_id": "$AGORA_APP_ID",
"channel": "astra_agents_test",
"enable_agora_asr": true,
"publish_audio": true,
"publish_data": true,
"remote_stream_id": 123,
"stream_id": 1234,
"subscribe_audio": true,
"token": "<agora_token>"
},
"type": "extension"
},
{
"addon": "interrupt_detector",
"app": "localhost",
"extension_group": "default",
"name": "interrupt_detector",
"type": "extension"
},
{
"addon": "openai_chatgpt",
"app": "localhost",
"extension_group": "chatgpt",
"name": "openai_chatgpt",
"property": {
"api_key": "$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": "gpt-4o-mini",
"prompt": "",
"proxy_url": "$OPENAI_PROXY_URL"
},
"type": "extension"
},
{
"addon": "azure_tts",
"app": "localhost",
"extension_group": "tts",
"name": "azure_tts",
"property": {
"azure_subscription_key": "$AZURE_TTS_KEY",
"azure_subscription_region": "$AZURE_TTS_REGION",
"azure_synthesis_voice_name": "en-US-JaneNeural"
},
"type": "extension"
},
{
"addon": "message_collector",
"app": "localhost",
"extension_group": "transcriber",
"name": "message_collector",
"type": "extension"
},
{
"addon": "fashionai",
"app": "localhost",
"extension_group": "default",
"name": "fashionai",
"property": {
"app_id": "$AGORA_APP_ID",
"channel": "astra_agents_test",
"stream_id": 12345,
"token": ""
},
"type": "extension"
}
]
},
{
"name": "va.openai.azure",
"auto_start": false,
Expand Down Expand Up @@ -2444,4 +2661,4 @@
}
]
}
}
}
22 changes: 22 additions & 0 deletions agents/ten_packages/extension/fashionai/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#
#
# Agora Real Time Engagement
# Created by Wei Hu in 2022-11.
# Copyright (c) 2024 Agora IO. All rights reserved.
#
#
import("//build/feature/ten_package.gni")

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

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

<!-- 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 -->
11 changes: 11 additions & 0 deletions agents/ten_packages/extension/fashionai/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#
#
# Agora Real Time Engagement
# Created by Wei Hu in 2024-08.
# Copyright (c) 2024 Agora IO. All rights reserved.
#
#
from .src import addon
from .src.log import logger

logger.info("fashionai extension loaded")
60 changes: 60 additions & 0 deletions agents/ten_packages/extension/fashionai/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"type": "extension",
"name": "fashionai",
"version": "0.1.0",
"dependencies": [
{
"type": "system",
"name": "ten_runtime_python",
"version": "0.1.0"
}
],
"package": {
"include": [
"manifest.json",
"property.json",
"BUILD.gn",
"**.tent",
"**.py",
"src/**.tent",
"src/**.py",
"README.md"
]
},
"api": {
"property": {
"app_id": {
"type": "string"
},
"token": {
"type": "string"
},
"channel": {
"type": "string"
},
"stream_id": {
"type": "uint32"
}
},
"data_in": [
{
"name": "text_data",
"property": {
"text": {
"type": "string"
}
}
}
],
"cmd_in": [
{
"name": "flush"
}
],
"cmd_out": [
{
"name": "flush"
}
]
}
}
1 change: 1 addition & 0 deletions agents/ten_packages/extension/fashionai/property.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions agents/ten_packages/extension/fashionai/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
websockets
Empty file.
22 changes: 22 additions & 0 deletions agents/ten_packages/extension/fashionai/src/addon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#
#
# Agora Real Time Engagement
# Created by Wei Hu in 2024-08.
# Copyright (c) 2024 Agora IO. All rights reserved.
#
#
from ten import (
Addon,
register_addon_as_extension,
TenEnv,
)
from .extension import FashionAIExtension
from .log import logger


@register_addon_as_extension("fashionai")
class FashionAIExtensionAddon(Addon):

def on_create_instance(self, ten_env: TenEnv, name: str, context) -> None:
logger.info("FashionAIExtensionAddon on_create_instance")
ten_env.on_create_instance_done(FashionAIExtension(name), context)
Loading
Loading