CoolFace
Apppublic

Fade0510/CallCenterSummarizationAgent

sourceHugging Facemitupdated 5mo agoView on Hugging Face
0likes
App README

Call Center Data Analysis Agent

This project implements a multi-agent workflow using LangGraph to process, transcribe, summarize, and score call center data. It comes with a Streamlit user interface to easily upload .csv, .json, .mp3, or .wav files and view the resulting insights.

Workflow Flow & Agent Classes

The core analysis logic is driven by a LangGraph StateGraph defined in src/workflow.py. The state moves sequentially between several agent classes located in the src/agents/ directory.

Workflow Architecture

text
                  [ IntakeAgent ]
                        |
                        v
               [ Router (file type) ]
              /         |           \
 (CSV invalid)/     (If Audio)     (If Text)
          v          v               v
        (END) [ TranscriptionAgent ] |
                  |                  |
                  v                  |
            [ ModerationAgent ] <-----/
                  |
                  v
          [ SummarizationAgent ]
                  |
                  v
     [ PostSummarizeRouter (output) ]
              |                |
           (END)        [ QualityScoringAgent ]
                               |
                               v
                             (END)

Notes:

  • —The workflow uses a LangGraph memory checkpointer (MemorySaver) and fallbacks on critical nodes (summarization/scoring) to avoid UI breakage on transient API/parse errors.
  • —If CSV headers are invalid, the workflow terminates immediately and the UI shows a validation error.
  • —After summarization, the workflow can short-circuit to END if the transcript is too short or the model output is missing/empty.

Agent Classes

  1. 1.`IntakeAgent` (`src/agents/IntakeAgent.py`)
  2. 2.Entry Point.
  3. 3.Reads the uploaded file, validates the file format and schema, extracts basic metadata, and runs a first-pass clean-up (using an LLM).
  4. 4.CSV requirement: headers must include id and transcript (case-insensitive).
  5. 5.JSON supported shapes: a list of {id, transcript} objects, a single {id, transcript} object, or a dict with transcripts/calls arrays containing {id, transcript} objects.
  1. 1.`Router` (`src/agents/Router.py`)
  2. 2.Conditional Routing Node.
  3. 3.Determines the next step based on the file type and intake validation state.
  4. 4.If Audio (`.mp3`, `.wav`): Routes to the TranscriptionAgent.
  5. 5.If Text (`.csv`): Routes to the ModerationAgent then summarization/scoring.
  6. 6.If CSV invalid: Routes to END (the UI displays metadata.intake_error).

`PostSummarizeRouter` (`src/agents/Router.py`)

  • —Routes based on model output quality (e.g., short transcript or missing summary can skip scoring).
  1. 1.`TranscriptionAgent` (`src/agents/TranscriptionAgent.py`)
  2. 2.Utilizes openai-whisper to convert audio files into text.
  3. 3.Also scrubs the resulting transcript of profanity before passing it down the pipeline.
  1. 1.`ModerationAgent` (`src/agents/ModerationAgent.py`)
  2. 2.Receives text either directly from the Router (if text upload) or from the TranscriptionAgent (if audio upload).
  3. 3.Identifies any obscene words or profanity using an LLM and replaces them entirely with a *** mask to safely prepare the text for downstream analysis.
  1. 1.`SummarizationAgent` (`src/agents/SummarizationAgent.py`)
  2. 2.Takes the redacted text from the ModerationAgent.
  3. 3.Generates a concise summary, key points, action items, tags, and highlights using OpenAI (gpt-4o) with Pydantic-structured output.
  1. 1.`QualityScoringAgent` (`src/agents/QualityScoringAgent.py`)
  2. 2.Takes the clean text and evaluates it against a predefined rubric.
  3. 3.Scores the transcript based on Tone, Professionalism, and Structured Resolution using Pydantic structured output (function calling when supported). Automatically applies a 3-point penalty to each score and logs a count of policy violations if the ModerationAgent detected and masked any profanity (***).

Prerequisites

  • —Python 3.9+
  • —An OpenAI API key
  • —ffmpeg installed on your system (required for openai-whisper audio transcription).
  • —On macOS: brew install ffmpeg
  • —On Ubuntu/Debian: sudo apt update && sudo apt install ffmpeg

Installation

  1. 1.Create a virtual environment and activate it (if you haven't already):
bash
   python3 -m venv .venv
   source .venv/bin/activate
  1. 1.Install the required dependencies:
bash
   pip install -r requirements.txt

Running the Application

  1. 1.Ensure your OpenAI API key is set in your environment variables:
bash
   export OPENAI_API_KEY="your_api_key_here"
  1. 1.Start the Streamlit application:
bash
   streamlit run src/streamlit_app.py
  1. 1.Open your browser to the local URL provided by Streamlit (usually http://localhost:8501).
  2. 2.Use the sidebar to upload a .csv, .mp3, or .wav file and watch the agents analyze your data!

Processed Files

Note: The following sample data can be used for analysis: