diff --git a/.env.example b/.env.example new file mode 100644 index 00000000..b938f60d --- /dev/null +++ b/.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 diff --git a/README.md b/README.md index c542c3d7..d8907b14 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ -# 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. + +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..e657748a --- /dev/null +++ b/SETUP.md @@ -0,0 +1,162 @@ +# 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. + +> **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 + +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) + +You can run the API either from the command line or using VSCode's F5 functionality. + +#### 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 + +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) + +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 + - 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