-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from sternakt/prepare-demo
Prepare demo
- Loading branch information
Showing
18 changed files
with
884 additions
and
2 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
OPENAI_API_KEY = sk-*************** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Pre-commit Checks | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- '**' # Runs on all branches | ||
|
||
jobs: | ||
pre-commit: | ||
name: Run Pre-commit Hooks | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.9' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install ".[dev]" | ||
- name: Run pre-commit | ||
run: | | ||
pre-commit install | ||
pre-commit run --all-files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Run Pytest | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.9 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -e ".[dev]" | ||
- name: Run pytest | ||
run: pytest tests/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# See https://pre-commit.com for more information | ||
# See https://pre-commit.com/hooks.html for more hooks | ||
default_stages: [pre-commit, pre-merge-commit] | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v5.0.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
stages: [pre-commit, pre-merge-commit, manual] | ||
- id: end-of-file-fixer | ||
stages: [pre-commit, pre-merge-commit, manual] | ||
- id: check-yaml | ||
stages: [pre-commit, pre-merge-commit, manual] | ||
- id: check-added-large-files | ||
stages: [pre-commit, pre-merge-commit, manual] | ||
|
||
- repo: https://github.com/codespell-project/codespell | ||
rev: v2.3.0 | ||
hooks: | ||
- id: codespell | ||
stages: [pre-commit, pre-merge-commit, manual] | ||
args: [--ignore-words=.codespell-whitelist.txt] | ||
|
||
- repo: local | ||
hooks: | ||
- id: lint | ||
name: Linter | ||
stages: [pre-commit, pre-merge-commit, manual] | ||
entry: "scripts/lint-pre-commit.sh" | ||
language: python | ||
types: [python] | ||
require_serial: true | ||
verbose: true | ||
|
||
- repo: local | ||
hooks: | ||
- id: static-analysis | ||
name: Static analysis | ||
entry: "scripts/static-pre-commit.sh" | ||
language: python | ||
types: [python] | ||
require_serial: true | ||
verbose: true | ||
|
||
- repo: https://github.com/Yelp/detect-secrets | ||
rev: v1.5.0 | ||
hooks: | ||
- id: detect-secrets | ||
args: ['--baseline', '.secrets.baseline'] | ||
exclude: package.lock.json | ||
stages: [pre-commit, pre-merge-commit, manual] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
{ | ||
"version": "1.5.0", | ||
"plugins_used": [ | ||
{ | ||
"name": "ArtifactoryDetector" | ||
}, | ||
{ | ||
"name": "AWSKeyDetector" | ||
}, | ||
{ | ||
"name": "AzureStorageKeyDetector" | ||
}, | ||
{ | ||
"name": "Base64HighEntropyString", | ||
"limit": 4.5 | ||
}, | ||
{ | ||
"name": "BasicAuthDetector" | ||
}, | ||
{ | ||
"name": "CloudantDetector" | ||
}, | ||
{ | ||
"name": "DiscordBotTokenDetector" | ||
}, | ||
{ | ||
"name": "GitHubTokenDetector" | ||
}, | ||
{ | ||
"name": "GitLabTokenDetector" | ||
}, | ||
{ | ||
"name": "HexHighEntropyString", | ||
"limit": 3.0 | ||
}, | ||
{ | ||
"name": "IbmCloudIamDetector" | ||
}, | ||
{ | ||
"name": "IbmCosHmacDetector" | ||
}, | ||
{ | ||
"name": "IPPublicDetector" | ||
}, | ||
{ | ||
"name": "JwtTokenDetector" | ||
}, | ||
{ | ||
"name": "KeywordDetector", | ||
"keyword_exclude": "" | ||
}, | ||
{ | ||
"name": "MailchimpDetector" | ||
}, | ||
{ | ||
"name": "NpmDetector" | ||
}, | ||
{ | ||
"name": "OpenAIDetector" | ||
}, | ||
{ | ||
"name": "PrivateKeyDetector" | ||
}, | ||
{ | ||
"name": "PypiTokenDetector" | ||
}, | ||
{ | ||
"name": "SendGridDetector" | ||
}, | ||
{ | ||
"name": "SlackDetector" | ||
}, | ||
{ | ||
"name": "SoftlayerDetector" | ||
}, | ||
{ | ||
"name": "SquareOAuthDetector" | ||
}, | ||
{ | ||
"name": "StripeDetector" | ||
}, | ||
{ | ||
"name": "TelegramBotTokenDetector" | ||
}, | ||
{ | ||
"name": "TwilioKeyDetector" | ||
} | ||
], | ||
"filters_used": [ | ||
{ | ||
"path": "detect_secrets.filters.allowlist.is_line_allowlisted" | ||
}, | ||
{ | ||
"path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies", | ||
"min_level": 2 | ||
}, | ||
{ | ||
"path": "detect_secrets.filters.heuristic.is_indirect_reference" | ||
}, | ||
{ | ||
"path": "detect_secrets.filters.heuristic.is_likely_id_string" | ||
}, | ||
{ | ||
"path": "detect_secrets.filters.heuristic.is_lock_file" | ||
}, | ||
{ | ||
"path": "detect_secrets.filters.heuristic.is_not_alphanumeric_string" | ||
}, | ||
{ | ||
"path": "detect_secrets.filters.heuristic.is_potential_uuid" | ||
}, | ||
{ | ||
"path": "detect_secrets.filters.heuristic.is_prefixed_with_dollar_sign" | ||
}, | ||
{ | ||
"path": "detect_secrets.filters.heuristic.is_sequential_string" | ||
}, | ||
{ | ||
"path": "detect_secrets.filters.heuristic.is_swagger_file" | ||
}, | ||
{ | ||
"path": "detect_secrets.filters.heuristic.is_templated_secret" | ||
} | ||
], | ||
"results": {}, | ||
"generated_at": "2025-01-03T09:53:36Z" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,49 @@ | ||
# RealtimeAgent-WebSocketAudioAdapter | ||
Basic demo of AG2 RealtimeAgent communication over WebSocketAudioAdapter | ||
|
||
# **RealtimeAgent over WebSockets** | ||
|
||
This project demonstrates how to create a voice assistant using Python, FastAPI, WebSockets, and an AG2 RealtimeAgent. The application streams audio from a browser to a FastAPI server and enables real-time voice communication with the RealtimeAgent. | ||
|
||
## **Key Features** | ||
- **WebSocket Audio Streaming**: Direct real-time audio streaming between the browser and server. | ||
- **FastAPI Integration**: A lightweight Python backend for handling WebSocket traffic. | ||
|
||
## **Prerequisites** | ||
|
||
Before you begin, ensure you have the following: | ||
- **Python 3.9+**: The project was tested with `3.9`. Download [here](https://www.python.org/downloads/). | ||
- **API Access**: Access to the OpenAI API (credentials required). | ||
|
||
## **Local Setup** | ||
|
||
Follow these steps to set up the project locally: | ||
|
||
### **1. Clone the Repository** | ||
```bash | ||
git clone https://github.com/sternakt/RealtimeAgent-WebSocketAudioAdapter.git | ||
cd RealtimeAgent-WebSocketAudioAdapter | ||
``` | ||
|
||
### **2. Set Up Environment Variables** | ||
Create a `.env` file based on the provided `.env.example`: | ||
```bash | ||
cp .env.example .env | ||
``` | ||
Add your OPENAI API credentials to the `.env` file. | ||
|
||
### **3. Install Dependencies** | ||
Install the required Python packages using `pip`: | ||
```bash | ||
pip install . | ||
``` | ||
|
||
### **4. Start the Server** | ||
Run the application with Uvicorn: | ||
```bash | ||
uvicorn realtime_over_websockets.main:app --port 5050 | ||
``` | ||
|
||
## **Test the App** | ||
With the server running, open the client application in your browser. Speak into your microphone, and the AI assistant will respond in real time. | ||
|
||
## **License** | ||
This project is licensed under the [MIT License](LICENSE). |
Oops, something went wrong.