A FastAPI-based backend service for analyzing interview transcripts using LLM. The service provides different levels of analysis (basic, pro, and advanced) and processes them asynchronously using Celery.
interviewai-be/
├── app/
│ ├── api/ # API endpoints
│ │ ├── v1/ # API version 1
│ │ │ ├── endpoints/ # Individual endpoint modules
│ │ │ │ ├── analyze.py # Analysis endpoints
│ │ │ │ └── hello.py # Hello world endpoint
│ │ │ └── router.py # API router configuration
│ │ ├── core/ # Core functionality
│ │ │ └── config.py # Application settings
│ │ ├── services/ # Business logic
│ │ │ └── analysis.py # Analysis service
│ │ └── tasks/ # Celery tasks
│ │ └── celery_tasks.py # Task definitions
│ ├── tests/ # Test files
│ ├── .env # Environment variables
│ ├── docker-compose.yml # Docker services configuration
│ ├── Dockerfile # Docker image configuration
│ └── requirements.txt # Python dependencies
- Asynchronous processing of interview analysis
- Multiple analysis levels (basic, pro, advanced)
- Task status tracking
- Dockerized deployment
- Redis for task queue and results backend
- Celery for task management
- Clone the repository:
git clone <repository-url>
cd interviewai-be- Create a
.envfile with the following variables:
APP_HOST=0.0.0.0
APP_PORT=8000
DEBUG=True
REDIS_HOST=redis
REDIS_PORT=6379
REDIS_DB=0
LOG_LEVEL=INFO- Run with Docker Compose:
docker compose up --buildGET /api/v1/hello- Returns a welcome page
-
POST /api/v1/analyze- Request body:
{ "transcript": "Interview transcript text...", "userId": "user123", "requestedReports": ["basic", "pro", "advanced"], "metadata": { "interviewId": "interview456", "timestamp": "2023-10-01T12:00:00Z" } } - Returns task IDs for tracking
- Request body:
-
GET /api/v1/analyze/status/{taskId}- Returns task status and result if completed
- Create a new file in
app/api/v1/endpoints/:
from fastapi import APIRouter
router = APIRouter()
@router.get("/")
async def new_endpoint():
return {"message": "New endpoint"}- Add the router to
app/api/v1/router.py:
from app.api.v1.endpoints import new_endpoint
api_router.include_router(new_endpoint.router, prefix="/new", tags=["new"])- Create a new file in
app/services/:
def new_service():
# Business logic here
return result- Import and use in your endpoints or tasks:
from app.services.new_service import new_service- Add the task to
app/tasks/celery_tasks.py:
@celery.task
def new_task():
# Task logic here
return result- Import and use in your endpoints:
from app.tasks.celery_tasks import new_task# Add test commands here when tests are implemented- Follow PEP 8 guidelines
- Use type hints
- Document functions and classes
- Add to
requirements.txt - Rebuild Docker containers:
docker compose up --build- Set
DEBUG=Falsein.env - Configure proper CORS settings
- Set up proper logging
- Configure proper security measures
- The application is designed to scale horizontally
- Celery workers can be scaled independently
- Redis can be configured for high availability
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request