From 9954e6760c63fc085262eac51c1f33ed6a268e05 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 22 May 2025 04:34:54 +0000 Subject: [PATCH 1/5] Initial plan for issue From afe58db13ed201c434ba138e60978188c2bd8005 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 22 May 2025 04:37:16 +0000 Subject: [PATCH 2/5] Add comprehensive setup instructions to README.md and sample .env file Co-authored-by: sethjuarez <115409+sethjuarez@users.noreply.github.com> --- README.md | 160 ++++++++++++++++++++++++++++++++++++++++++++++- api/.env.example | 19 ++++++ 2 files changed, 176 insertions(+), 3 deletions(-) create mode 100644 api/.env.example diff --git a/README.md b/README.md index c542c3d7..6c1639b9 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,157 @@ -# sustineo -- magic function calling mapping for generic local function calls (A) -- figure out backchannel with utility function calls (A+S)* \ No newline at end of file +# Sustineo + +Sustineo is an application that combines AI capabilities with real-time interactions for voice and image generation. + +- Magic function calling mapping for generic local function calls (A) +- Backchannel with utility function calls (A+S)* + +## Prerequisites + +- [Python 3.11](https://www.python.org/downloads/) or later for the API +- [Node.js 20](https://nodejs.org/) or later for the web component +- Azure subscription with the following services: + - Azure OpenAI service (for voice capabilities) + - Azure OpenAI service (for image generation) + - Azure Cosmos DB account + - Azure Blob Storage account + +## Environment Setup + +### API Environment Variables + +Create a `.env` file in the `api` directory with the following variables: + +``` +# Azure OpenAI for Voice +AZURE_VOICE_ENDPOINT=https://your-voice-openai-resource.openai.azure.com +AZURE_VOICE_KEY=your-voice-openai-key + +# Azure OpenAI for Image Generation +AZURE_IMAGE_ENDPOINT=https://your-image-openai-resource.openai.azure.com +AZURE_IMAGE_API_KEY=your-image-openai-key + +# Azure Storage +SUSTINEO_STORAGE=https://yourstorageaccount.blob.core.windows.net + +# Azure Cosmos DB +COSMOSDB_CONNECTION=your-cosmosdb-connection-string + +# Optional: Azure Foundry (if using) +FOUNDRY_CONNECTION=your-foundry-connection-string + +# Optional: Local tracing +LOCAL_TRACING_ENABLED=false +``` + +### Web Environment Setup + +The web component uses the API endpoints defined in `web/store/endpoint.ts`. By default, these are set to: +- WebSocket Endpoint: `ws://localhost:8000` +- API Endpoint: `http://localhost:8000` +- Web Endpoint: `http://localhost:5173` + +Modify these values if you're deploying to a different environment. + +## Installation + +### API Setup + +1. Navigate to the API directory: + ```bash + cd api + ``` + +2. Install the required Python packages: + ```bash + pip install -r requirements.txt + ``` + +### Web Setup + +1. Navigate to the web directory: + ```bash + cd web + ``` + +2. Install the required Node.js packages: + ```bash + npm ci + ``` + +## Running the Application + +### Running the API (Backend) + +1. Navigate to the API directory: + ```bash + cd api + ``` + +2. Start the FastAPI application: + ```bash + fastapi run main.py + ``` + + The API will be available at http://localhost:8000. + +### Running the Web Application (Frontend) + +1. Navigate to the web directory: + ```bash + cd web + ``` + +2. Start the development server: + ```bash + npm run dev + ``` + + The web application will be available at http://localhost:5173. + +3. For production builds: + ```bash + npm run build + npm run start + ``` + +## Docker Deployment + +Both components include Dockerfiles for containerized deployment. + +### Building and Running the API Container + +```bash +cd api +docker build -t sustineo-api . +docker run -p 8000:8000 --env-file .env sustineo-api +``` + +### Building and Running the Web Container + +```bash +cd web +docker build -t sustineo-web . +docker run -p 5173:5173 sustineo-web +``` + +## Azure Deployment + +The application requires several Azure services. You can manually create these resources through the Azure Portal or use infrastructure as code (IaC) for automated deployment. + +### Required Azure Resources + +1. **Azure OpenAI Service** (for voice capabilities) + - Deployment: gpt-4o-realtime-preview + +2. **Azure OpenAI Service** (for image generation) + - Deployment: gpt-image-1 + +3. **Azure Cosmos DB** + - Database name: sustineo + - Container name: VoiceConfigurations + - Partition key: /id + +4. **Azure Blob Storage** + - Container: sustineo + +Note: Make sure to update the environment variables with the appropriate connection details after creating these resources. \ No newline at end of file diff --git a/api/.env.example b/api/.env.example new file mode 100644 index 00000000..b938f60d --- /dev/null +++ b/api/.env.example @@ -0,0 +1,19 @@ +# Azure OpenAI for Voice +AZURE_VOICE_ENDPOINT=https://your-voice-openai-resource.openai.azure.com +AZURE_VOICE_KEY=your-voice-openai-key + +# Azure OpenAI for Image Generation +AZURE_IMAGE_ENDPOINT=https://your-image-openai-resource.openai.azure.com +AZURE_IMAGE_API_KEY=your-image-openai-key + +# Azure Storage +SUSTINEO_STORAGE=https://yourstorageaccount.blob.core.windows.net + +# Azure Cosmos DB +COSMOSDB_CONNECTION=your-cosmosdb-connection-string + +# Optional: Azure Foundry (if using) +FOUNDRY_CONNECTION=your-foundry-connection-string + +# Optional: Local tracing +LOCAL_TRACING_ENABLED=false \ No newline at end of file From 62b689c132c226224c8f436c68ff55c8689fca8f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 22 May 2025 04:46:36 +0000 Subject: [PATCH 3/5] Move .env.example from api/ to root directory for VSCode F5 support Co-authored-by: sethjuarez <115409+sethjuarez@users.noreply.github.com> --- api/.env.example => .env.example | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename api/.env.example => .env.example (100%) diff --git a/api/.env.example b/.env.example similarity index 100% rename from api/.env.example rename to .env.example From 0a0564812f4c6b7713ff00b63cf7fd0005233aed Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 22 May 2025 04:49:17 +0000 Subject: [PATCH 4/5] Move setup instructions to SETUP.md and simplify README.md Co-authored-by: sethjuarez <115409+sethjuarez@users.noreply.github.com> --- README.md | 154 +----------------------------------------------------- SETUP.md | 154 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 155 insertions(+), 153 deletions(-) create mode 100644 SETUP.md diff --git a/README.md b/README.md index 6c1639b9..d8907b14 100644 --- a/README.md +++ b/README.md @@ -2,156 +2,4 @@ Sustineo is an application that combines AI capabilities with real-time interactions for voice and image generation. -- Magic function calling mapping for generic local function calls (A) -- Backchannel with utility function calls (A+S)* - -## Prerequisites - -- [Python 3.11](https://www.python.org/downloads/) or later for the API -- [Node.js 20](https://nodejs.org/) or later for the web component -- Azure subscription with the following services: - - Azure OpenAI service (for voice capabilities) - - Azure OpenAI service (for image generation) - - Azure Cosmos DB account - - Azure Blob Storage account - -## Environment Setup - -### API Environment Variables - -Create a `.env` file in the `api` directory with the following variables: - -``` -# Azure OpenAI for Voice -AZURE_VOICE_ENDPOINT=https://your-voice-openai-resource.openai.azure.com -AZURE_VOICE_KEY=your-voice-openai-key - -# Azure OpenAI for Image Generation -AZURE_IMAGE_ENDPOINT=https://your-image-openai-resource.openai.azure.com -AZURE_IMAGE_API_KEY=your-image-openai-key - -# Azure Storage -SUSTINEO_STORAGE=https://yourstorageaccount.blob.core.windows.net - -# Azure Cosmos DB -COSMOSDB_CONNECTION=your-cosmosdb-connection-string - -# Optional: Azure Foundry (if using) -FOUNDRY_CONNECTION=your-foundry-connection-string - -# Optional: Local tracing -LOCAL_TRACING_ENABLED=false -``` - -### Web Environment Setup - -The web component uses the API endpoints defined in `web/store/endpoint.ts`. By default, these are set to: -- WebSocket Endpoint: `ws://localhost:8000` -- API Endpoint: `http://localhost:8000` -- Web Endpoint: `http://localhost:5173` - -Modify these values if you're deploying to a different environment. - -## Installation - -### API Setup - -1. Navigate to the API directory: - ```bash - cd api - ``` - -2. Install the required Python packages: - ```bash - pip install -r requirements.txt - ``` - -### Web Setup - -1. Navigate to the web directory: - ```bash - cd web - ``` - -2. Install the required Node.js packages: - ```bash - npm ci - ``` - -## Running the Application - -### Running the API (Backend) - -1. Navigate to the API directory: - ```bash - cd api - ``` - -2. Start the FastAPI application: - ```bash - fastapi run main.py - ``` - - The API will be available at http://localhost:8000. - -### Running the Web Application (Frontend) - -1. Navigate to the web directory: - ```bash - cd web - ``` - -2. Start the development server: - ```bash - npm run dev - ``` - - The web application will be available at http://localhost:5173. - -3. For production builds: - ```bash - npm run build - npm run start - ``` - -## Docker Deployment - -Both components include Dockerfiles for containerized deployment. - -### Building and Running the API Container - -```bash -cd api -docker build -t sustineo-api . -docker run -p 8000:8000 --env-file .env sustineo-api -``` - -### Building and Running the Web Container - -```bash -cd web -docker build -t sustineo-web . -docker run -p 5173:5173 sustineo-web -``` - -## Azure Deployment - -The application requires several Azure services. You can manually create these resources through the Azure Portal or use infrastructure as code (IaC) for automated deployment. - -### Required Azure Resources - -1. **Azure OpenAI Service** (for voice capabilities) - - Deployment: gpt-4o-realtime-preview - -2. **Azure OpenAI Service** (for image generation) - - Deployment: gpt-image-1 - -3. **Azure Cosmos DB** - - Database name: sustineo - - Container name: VoiceConfigurations - - Partition key: /id - -4. **Azure Blob Storage** - - Container: sustineo - -Note: Make sure to update the environment variables with the appropriate connection details after creating these resources. \ No newline at end of file +For detailed setup and installation instructions, please refer to the [SETUP.md](SETUP.md) guide. \ No newline at end of file diff --git a/SETUP.md b/SETUP.md new file mode 100644 index 00000000..9b5e4551 --- /dev/null +++ b/SETUP.md @@ -0,0 +1,154 @@ +# Sustineo Setup Guide + +Sustineo is an application that combines AI capabilities with real-time interactions for voice and image generation. + +## Prerequisites + +- [Python 3.11](https://www.python.org/downloads/) or later for the API +- [Node.js 20](https://nodejs.org/) or later for the web component +- Azure subscription with the following services: + - Azure OpenAI service (for voice capabilities) + - Azure OpenAI service (for image generation) + - Azure Cosmos DB account + - Azure Blob Storage account + +## Environment Setup + +### API Environment Variables + +Create a `.env` file in the root directory with the following variables: + +``` +# Azure OpenAI for Voice +AZURE_VOICE_ENDPOINT=https://your-voice-openai-resource.openai.azure.com +AZURE_VOICE_KEY=your-voice-openai-key + +# Azure OpenAI for Image Generation +AZURE_IMAGE_ENDPOINT=https://your-image-openai-resource.openai.azure.com +AZURE_IMAGE_API_KEY=your-image-openai-key + +# Azure Storage +SUSTINEO_STORAGE=https://yourstorageaccount.blob.core.windows.net + +# Azure Cosmos DB +COSMOSDB_CONNECTION=your-cosmosdb-connection-string + +# Optional: Azure Foundry (if using) +FOUNDRY_CONNECTION=your-foundry-connection-string + +# Optional: Local tracing +LOCAL_TRACING_ENABLED=false +``` + +### Web Environment Setup + +The web component uses the API endpoints defined in `web/store/endpoint.ts`. By default, these are set to: +- WebSocket Endpoint: `ws://localhost:8000` +- API Endpoint: `http://localhost:8000` +- Web Endpoint: `http://localhost:5173` + +Modify these values if you're deploying to a different environment. + +## Installation + +### API Setup + +1. Navigate to the API directory: + ```bash + cd api + ``` + +2. Install the required Python packages: + ```bash + pip install -r requirements.txt + ``` + +### Web Setup + +1. Navigate to the web directory: + ```bash + cd web + ``` + +2. Install the required Node.js packages: + ```bash + npm ci + ``` + +## Running the Application + +### Running the API (Backend) + +1. Navigate to the API directory: + ```bash + cd api + ``` + +2. Start the FastAPI application: + ```bash + fastapi run main.py + ``` + + The API will be available at http://localhost:8000. + +### Running the Web Application (Frontend) + +1. Navigate to the web directory: + ```bash + cd web + ``` + +2. Start the development server: + ```bash + npm run dev + ``` + + The web application will be available at http://localhost:5173. + +3. For production builds: + ```bash + npm run build + npm run start + ``` + +## Docker Deployment + +Both components include Dockerfiles for containerized deployment. + +### Building and Running the API Container + +```bash +cd api +docker build -t sustineo-api . +docker run -p 8000:8000 --env-file ../.env sustineo-api +``` + +### Building and Running the Web Container + +```bash +cd web +docker build -t sustineo-web . +docker run -p 5173:5173 sustineo-web +``` + +## Azure Deployment + +The application requires several Azure services. You can manually create these resources through the Azure Portal or use infrastructure as code (IaC) for automated deployment. + +### Required Azure Resources + +1. **Azure OpenAI Service** (for voice capabilities) + - Deployment: gpt-4o-realtime-preview + +2. **Azure OpenAI Service** (for image generation) + - Deployment: gpt-image-1 + +3. **Azure Cosmos DB** + - Database name: sustineo + - Container name: VoiceConfigurations + - Partition key: /id + +4. **Azure Blob Storage** + - Container: sustineo + +Note: Make sure to update the environment variables with the appropriate connection details after creating these resources. \ No newline at end of file From 8a841b7258c5a9f78b1a9966366553f5006ac02d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 23 May 2025 16:25:26 +0000 Subject: [PATCH 5/5] Update SETUP.md with additional information about resources and configuration Co-authored-by: sethjuarez <115409+sethjuarez@users.noreply.github.com> --- SETUP.md | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/SETUP.md b/SETUP.md index 9b5e4551..e657748a 100644 --- a/SETUP.md +++ b/SETUP.md @@ -49,6 +49,8 @@ The web component uses the API endpoints defined in `web/store/endpoint.ts`. By Modify these values if you're deploying to a different environment. +> **Note:** This project includes a GitHub Action that automatically rewrites these endpoints using the Azure CLI to query for the correct FQDNs when deploying to Azure Container Apps. + ## Installation ### API Setup @@ -79,17 +81,21 @@ Modify these values if you're deploying to a different environment. ### Running the API (Backend) -1. Navigate to the API directory: - ```bash - cd api - ``` +You can run the API either from the command line or using VSCode's F5 functionality. -2. Start the FastAPI application: - ```bash - fastapi run main.py - ``` +#### Using Command Line + +From the project root directory: + +```bash +uvicorn api.main:app --reload +``` + +The API will be available at http://localhost:8000. + +#### Using VSCode F5 - The API will be available at http://localhost:8000. +This project includes a VSCode launch configuration that allows you to run and debug the API by simply pressing F5. This configuration runs from the root directory and automatically loads environment variables from the `.env` file in the project root. ### Running the Web Application (Frontend) @@ -147,8 +153,10 @@ The application requires several Azure services. You can manually create these r - Database name: sustineo - Container name: VoiceConfigurations - Partition key: /id + - Purpose: Stores application settings and configurations for each scenario 4. **Azure Blob Storage** - Container: sustineo + - Purpose: Stores images generated by the application Note: Make sure to update the environment variables with the appropriate connection details after creating these resources. \ No newline at end of file