Remiscus's picture
Upload folder using huggingface_hub
6bc4708 verified
|
Raw
History Blame Contribute Delete
3.61 kB

A newer version of the Gradio SDK is available: 6.26.0

Upgrade
metadata
title: Customer_Support_Agent
app_file: app.py
sdk: gradio
sdk_version: 5.23.3

πŸ’¬ Customer Support Assistant

An AI-powered voice + text chatbot built with pydantic_ai, powered by Llama 3.3 70B via Cerebras/Groq. It processes customer issues, detects emotional tone, and records support requests into a structured data table. Deployable on Gradio Spaces and usable locally with both text and audio input.


⚑ Features

  • πŸ”₯ LLM-powered form extraction using Agent abstraction from pydantic_ai
  • πŸŽ™οΈ Voice chat with real-time streaming via fastrtc
  • 🧠 Memory-aware responses using message_history
  • πŸ“Š Live DataFrame updates for structured customer requests
  • πŸ’Ύ Persistent CSV logging
  • πŸ› οΈ One-click Gradio UI with tabs for Chat + Customer Data

πŸš€ Getting Started

1. Clone the Repo

git clone https://github.com/your-username/customer-support-assistant
cd customer-support-assistant

2. Install Dependencies

⚠️ Make sure you use uv to ensure proper dependency resolution (especially for pydantic_ai).

uv pip install -r requirements.txt

Or use uv directly:

uv venv
source .venv/bin/activate
uv pip install -r requirements.txt

3. Setup .env File

Create a .env file in the root directory.

Refer to settings.py for required fields. At a minimum, you will need:

CEREBRAS_API_KEY=your_api_key
CEREBRAS_BASE_URL=https://api.groq.com/openai/v1

You can optionally set environment variables for your own STT/TTS models as required by fastrtc.


4. Run the App Locally

python app.py

🌐 Deploy on Gradio Spaces

  1. Add your CEREBRAS_API_KEY and CEREBRAS_BASE_URL as secrets in the Gradio Space.
  2. Make sure fastrtc audio support is configured in the hardware tab.
  3. Gradio Spaces will auto-launch the app via app.py.

πŸ§ͺ Debug Tips

To simulate extraction alone:

python agents.py

Then type messages in the CLI to test how well the form is filled.


πŸ“ File Structure

β”œβ”€β”€ app.py                 # Main Gradio UI
β”œβ”€β”€ agents.py              # Agent config + LLM interaction logic
β”œβ”€β”€ settings.py            # Handles env/config
β”œβ”€β”€ form_prompt.txt        # System prompt for form extraction
β”œβ”€β”€ response_prompt.txt    # System prompt for response generation
β”œβ”€β”€ data.csv               # Auto-generated CSV storage
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ README.md

🧠 What the AI Extracts

The form agent will pull out:

  • customername: Extracted from input or marked as "unknown"
  • requesttype: e.g., "billing", "technical support"
  • issue: 50-line description of the issue
  • emotion: "angry", "happy", etc.

πŸ›‘ Known Limitations

  • Longform audio may require silence-based segmentation tuning.
  • This project assumes inputs are customer support related. General queries may misfire.
  • Error handling is basic β€” add guards if scaling for production use.

πŸ™ Credits


❀️ Made with care by Rikhil