Skip to content

shayan74/ea-task-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

-- Backend for Engineered Arts Task by Shayan Ebrahimi --

.:: README ::.

This service exposes a WebSocket endpoint that receives text, sends it to OpenAI (gpt-4o-mini) then converts the response to speech (gpt-4o-mini-tts) and finally returns the audio answer to the client.  
A /health endpoint is available for basic service checks and a set of internal Pytests is included for validating core backend functionality.

--> Tech Stack: Python, Starlette, Uvicorn, OpenAI SDK, Docker


Setup
--------
1. Create & activate virtual environment  
   Create venv:  
       python3 -m venv .venv  

   Activate venv:  
       macOS / Linux:  
           source .venv/bin/activate  
       Windows:  
           .venv\Scripts\activate  

2. Install dependencies  
       pip install -r requirements.txt  

3. Environment (local testing)  
   Create a .env file in the Backend folder:  
       OPENAI_API_KEY=YOUR_OPENAI_API_KEY

4. Run  
   Option 1 — Local:  
       uvicorn app:app --host 0.0.0.0 --port 8000  
       → WebSocket will be available at ws://localhost:8000/ws  
        

   Option 2 — Docker:  
       docker build -t ea-task-backend .  
       docker run -p 8000:8000 -e OPENAI_API_KEY=YOUR_OPENAI_API_KEY ea-task-backend

5. Tests  
   Run in the Backend folder:  
       pytest
   Or when application is running open health endpoint: 
   → Health endpoint: http://localhost:8000/health     

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages