Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
19 changes: 19 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -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
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# sustineo
- magic function calling mapping for generic local function calls (A)
- figure out backchannel with utility function calls (A+S)*
# 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.
162 changes: 162 additions & 0 deletions SETUP.md
Original file line number Diff line number Diff line change
@@ -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`
Comment on lines +46 to +48

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can mention here that there is a GitHub Action in this project that rewrites these to match the Azure Container App by using the Azure CLI to query for the correct FQDNs

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a note in the Web Environment Setup section about the GitHub Action that automatically rewrites the endpoints using Azure CLI to query for the correct FQDNs when deploying to Azure Container Apps. The change is in commit 8a841b7.


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.