Skip to content

Commit

Permalink
Feature/seperate graphs (#147)
Browse files Browse the repository at this point in the history
* chore(): update devcontainer.json with additional VS Code extensions and settings for c++/golang/python

* feat(): configuration uses .env, supporting dynamic setting of Graph

* fix(): fix

* fix(): fix type

* chore(): specify platform

* chore(): adjust manifest.json to property.json

* chore(): modify docker-compose.yml

* chore(): restore the previous VSCode extensions

* chore(): delete property.json.graphs_examples

* chore(): rename PROXY_URL to OPENAI_PROXY_URL
  • Loading branch information
sunshinexcode authored Aug 1, 2024
1 parent 1dc1302 commit d467300
Show file tree
Hide file tree
Showing 16 changed files with 648 additions and 325 deletions.
22 changes: 7 additions & 15 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,21 @@
{
"name": "astra",
"image": "ghcr.io/rte-design/astra_agents_build",

"customizations": {
"vscode": {
"extensions": ["golang.go"]
"extensions": [
"golang.go"
]
}
},

"workspaceMount": "source=${localWorkspaceFolder},target=/app,type=bind",
"workspaceMount": "source=${localWorkspaceFolder},target=/app,type=bind",
"workspaceFolder": "/app",

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [8080],

"forwardPorts": [
8080
],
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/git:1": {}
}

// Uncomment the next line to run commands after the container is created.
// "postCreateCommand": ""

// Configure tool-specific properties.
// "customizations": {},
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "devcontainer"
}
64 changes: 64 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# ------------------------------
# Environment Variables for server & worker
# ------------------------------

# ------------------------------
# Server Configuration
# ------------------------------

# Log path
LOG_PATH=/tmp
# Server port
SERVER_PORT=8080
# Maximum number of workers
WORKERS_MAX=100
# Worker quit timeout in seconds
WORKER_QUIT_TIMEOUT_SECONDES=60

# Agora App ID and Agora App Certificate
# required: this variable must be set
AGORA_APP_ID=
AGORA_APP_CERTIFICATE=

# ------------------------------
# Worker Configuration
# ------------------------------

# Extension: bedrock_llm
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_BEDROCK_MODEL=
AWS_REGION=

# Extension: agora_rtc
# Azure STT key and region
AZURE_STT_KEY=
AZURE_STT_REGION=

# Extension: azure_tts
# Azure TTS key and region
AZURE_TTS_KEY=
AZURE_TTS_REGION=

# Extension: cosy_tts
# Cosy TTS key
COSY_TTS_KEY=

# Extension: elevenlabs_tts
# ElevenLabs TTS key
ELEVENLABS_TTS_KEY=

# Extension: openai_chatgpt
# OpenAI API key
OPENAI_API_KEY=
# OpenAI base URL
# if using OpenAI, keep default. using other OpenAI-compatible providers, then set it to the other provider's address
OPENAI_BASE_URL=
# OpenAI Model
OPENAI_MODEL=gpt-4o-mini
# OpenAI proxy URL
OPENAI_PROXY_URL=

# Extension: qwen_llm
# Qwen API key
QWEN_API_KEY=
6 changes: 1 addition & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ bin/
core
crash_context_v1
.deps/
docker-compose.yml
.DS_Store
.env
/.gn
Expand All @@ -22,9 +21,6 @@ include/
interface/
lib/
lib64
agents/manifest.elevenlabs.json
agents/manifest.cn.json
agents/manifest.en.json
node_modules/
/out/
*.pcm
Expand All @@ -35,4 +31,4 @@ xdump_config
speechsdk/
SpeechSDK-Linux.tar.gz
pyvenv.cfg
xdump_config
xdump_config
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ ARG SESSION_CONTROL_CONF=session_control.conf
WORKDIR /app

COPY . .
COPY agents/manifest.json.example agents/manifest.json
COPY agents/manifest.json.elevenlabs.example agents/manifest.elevenlabs.json
COPY agents/property.json.example agents/property.json
COPY agents/${SESSION_CONTROL_CONF} agents/session_control.conf

RUN make build && \
RUN make clean && make build && \
cd agents && ./scripts/package.sh

FROM ubuntu:22.04
Expand Down
227 changes: 226 additions & 1 deletion agents/property.json.graphs_examples → agents/property.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"rte": {
"predefined_graphs": [
{
"name": "astra_agents",
"name": "astra_agents_cn",
"auto_start": true,
"nodes": [
{
Expand Down Expand Up @@ -230,6 +230,231 @@
]
}
]
},
{
"name": "astra_agents_en",
"auto_start": false,
"nodes": [
{
"type": "extension",
"extension_group": "default",
"addon": "agora_rtc",
"name": "agora_rtc",
"property": {
"app_id": "<agora_appid>",
"token": "<agora_token>",
"channel": "astra_agents_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": "<azure_stt_key>",
"agora_asr_vendor_region": "<azure_stt_region>",
"agora_asr_session_control_file_path": "session_control.conf"
}
},
{
"type": "extension",
"extension_group": "default",
"addon": "interrupt_detector",
"name": "interrupt_detector"
},
{
"type": "extension",
"extension_group": "chatgpt",
"addon": "openai_chatgpt",
"name": "openai_chatgpt",
"property": {
"base_url": "",
"api_key": "<openai_api_key>",
"frequency_penalty": 0.9,
"model": "gpt-3.5-turbo",
"max_tokens": 512,
"prompt": "",
"proxy_url": "",
"greeting": "ASTRA agent connected. How can i help you today?",
"max_memory_length": 10
}
},
{
"type": "extension",
"extension_group": "tts",
"addon": "elevenlabs_tts",
"name": "elevenlabs_tts",
"property": {
"api_key": "<elevenlabs_tts_key>",
"model_id": "eleven_multilingual_v2",
"optimize_streaming_latency": 0,
"request_timeout_seconds": 30,
"similarity_boost": 0.75,
"speaker_boost": false,
"stability": 0.5,
"style": 0.0,
"voice_id": "pNInz6obpgDQGcFmaJgB"
}
},
{
"type": "extension",
"extension_group": "transcriber",
"addon": "chat_transcriber",
"name": "chat_transcriber"
},
{
"type": "extension_group",
"addon": "default_extension_group",
"name": "default"
},
{
"type": "extension_group",
"addon": "default_extension_group",
"name": "chatgpt"
},
{
"type": "extension_group",
"addon": "default_extension_group",
"name": "tts"
},
{
"type": "extension_group",
"addon": "default_extension_group",
"name": "transcriber"
}
],
"connections": [
{
"extension_group": "default",
"extension": "agora_rtc",
"data": [
{
"name": "text_data",
"dest": [
{
"extension_group": "default",
"extension": "interrupt_detector"
},
{
"extension_group": "chatgpt",
"extension": "openai_chatgpt"
},
{
"extension_group": "transcriber",
"extension": "chat_transcriber"
}
]
}
]
},
{
"extension_group": "chatgpt",
"extension": "openai_chatgpt",
"data": [
{
"name": "text_data",
"dest": [
{
"extension_group": "tts",
"extension": "elevenlabs_tts"
},
{
"extension_group": "transcriber",
"extension": "chat_transcriber",
"cmd_conversions": [
{
"cmd": {
"type": "per_property",
"keep_original": true,
"rules": [
{
"path": "is_final",
"type": "fixed_value",
"value": "bool(true)"
},
{
"path": "stream_id",
"type": "fixed_value",
"value": "uint32(999)"
}
]
}
}
]
}
]
}
],
"cmd": [
{
"name": "flush",
"dest": [
{
"extension_group": "tts",
"extension": "elevenlabs_tts"
}
]
}
]
},
{
"extension_group": "tts",
"extension": "elevenlabs_tts",
"pcm_frame": [
{
"name": "pcm_frame",
"dest": [
{
"extension_group": "default",
"extension": "agora_rtc"
}
]
}
],
"cmd": [
{
"name": "flush",
"dest": [
{
"extension_group": "default",
"extension": "agora_rtc"
}
]
}
]
},
{
"extension_group": "transcriber",
"extension": "chat_transcriber",
"data": [
{
"name": "data",
"dest": [
{
"extension_group": "default",
"extension": "agora_rtc"
}
]
}
]
},
{
"extension_group": "default",
"extension": "interrupt_detector",
"cmd": [
{
"name": "flush",
"dest": [
{
"extension_group": "chatgpt",
"extension": "openai_chatgpt"
}
]
}
]
}
]
}
]
}
Expand Down
Loading

0 comments on commit d467300

Please sign in to comment.