Skip to content

This FastAPI application provides an endpoint for analyzing chat messages and generating insights for CEO reporting.

Notifications You must be signed in to change notification settings

kyleaquino/audr-project

Repository files navigation

Chat Analysis API

This FastAPI application provides an endpoint for analyzing chat messages and generating insights for CEO reporting.

Features

  • Extracts top 3 frequently mentioned topics from messages
  • Generates CEO-friendly summaries
  • Performs sentiment analysis on messages
  • Uses OpenAI's GPT-3.5 for advanced text analysis
  • Uses TextBlob for sentiment analysis

Prerequisites

  • Python 3.12 or higher
  • Docker (optional, for containerized deployment)
  • OpenAI API key

Setup

Local Development

  1. Create a virtual environment:
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
  1. Install dependencies using uv:
pip install uv
uv pip install -e .
  1. Create a .env file in the project root with your OpenAI API key:
OPENAI_API_KEY=your_api_key_here

Docker Setup

  1. Build the Docker image:
docker build -t audr-project .
  1. Run the container:
docker run -p 8000:8000 --env-file .env audr-project

Running the Application

Local Development

Start the server:

uvicorn app.main:app --reload

Docker

The application will automatically start when running the container as shown above.

The API will be available at http://localhost:8000

API Documentation

Once the server is running, you can access:

  • Swagger UI documentation: http://localhost:8000/docs
  • ReDoc documentation: http://localhost:8000/redoc

Example Request

{
  "messages": [
    {
      "employee_id": "EMP001",
      "message_text": "The new project timeline looks good, but we need more resources.",
      "timestamp": "2024-03-27T10:00:00Z"
    },
    {
      "employee_id": "EMP002",
      "message_text": "I'm concerned about the budget constraints for Q2.",
      "timestamp": "2024-03-27T10:15:00Z"
    }
  ]
}

Example Response

{
  "top_topics": [
    {
      "topic": "Project Timeline",
      "frequency": 5
    },
    {
      "topic": "Resources",
      "frequency": 3
    },
    {
      "topic": "Budget",
      "frequency": 2
    }
  ],
  "ceo_summary": "Key concerns raised include project timeline management and resource allocation. Budget constraints for Q2 need attention.",
  "sentiment_breakdown": {
    "positive": 1,
    "negative": 1,
    "neutral": 0
  }
}

Development

Running Tests

pytest

Code Quality

The project uses several tools for code quality:

  • ruff for linting and formatting
  • mypy for type checking
  • pytest for testing
  • pre-commit hooks for automated checks

Project Structure

audr-project/
├── app/                    # Main application package
│   ├── main.py            # FastAPI application entry point
│   ├── models.py          # Pydantic models
│   └── services.py        # Business logic
├── tests/                 # Test files
├── scripts/               # Utility scripts
├── pyproject.toml         # Project dependencies and configuration
├── Dockerfile            # Docker configuration
└── .env.example          # Example environment variables

About

This FastAPI application provides an endpoint for analyzing chat messages and generating insights for CEO reporting.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors