Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multilingual Support Agent

An open-source AI customer support agent that automatically detects the customer's language, searches a knowledge base, and responds in the customer's native language — all through a single REST API.

Built with FastAPI and the Anthropic Claude API. Designed to be dropped into any existing support stack.


How it works

Customer message (any language)
        ↓
Language detection        — identifies the language automatically
        ↓
Query translation         — translates to English for KB search
        ↓
Knowledge base search     — semantic search finds relevant articles
        ↓
Claude agent              — generates a response using KB context
        ↓
Reply in customer's language

Conversation history is maintained per session so the agent understands follow-up questions.


Features

  • Auto language detection — English, German, French (more trivially addable)
  • Semantic knowledge base search using Voyage AI embeddings
  • Multi-turn conversation memory (in-memory or Redis)
  • Analytics endpoint — language distribution, top KB articles, gaps report
  • Fully configurable via environment variables
  • Docker ready

Quickstart

git clone https://github.com/yourusername/multilingual-support-agent.git
cd multilingual-support-agent

python3 -m venv venv
source venv/bin/activate

pip install -r requirements.txt

cp .env.example .env
# Add your ANTHROPIC_API_KEY and VOYAGE_API_KEY to .env
uvicorn app.main:app --reload

API docs available at http://localhost:8000/docs


Send a message

curl -X POST http://localhost:8000/api/v1/chat \
  -H "Content-Type: application/json" \
  -d '{
    "message": "Wie kann ich mein Passwort zurücksetzen?",
    "session_id": "user-123"
  }'
{
  "response": "Um Ihr Passwort zurückzusetzen, gehen Sie zur Anmeldeseite...",
  "detected_language": { "code": "de", "name": "German", "confidence": 0.998 },
  "knowledge_base_hits": [
    { "question": "How do I reset my password?", "score": 0.91 }
  ]
}

Bring your own knowledge base

Replace app/data/knowledge_base.json with your own FAQ data:

[
  {
    "id": "kb_001",
    "category": "Returns",
    "question": "What is your return policy?",
    "answer": "We accept returns within 30 days of purchase.",
    "keywords": ["return", "refund", "policy", "30 days"]
  }
]

Then call POST /api/v1/kb/reload — no restart needed.


API endpoints

Method Endpoint Description
POST /api/v1/chat Send a customer message
GET /api/v1/analytics Usage report — languages, KB hits, gaps
GET /api/v1/sessions List active sessions
DELETE /api/v1/sessions/{id} Clear a session
POST /api/v1/kb/reload Reload knowledge base from disk
GET /api/v1/languages List supported languages

Configuration

All settings via .env:

Variable Default Description
ANTHROPIC_API_KEY Required
VOYAGE_API_KEY Required — get free key at voyageai.com
SUPPORTED_LANGUAGES ["en","de","fr"] Languages to handle
SESSION_BACKEND memory memory or redis
KB_TOP_K 3 KB articles retrieved per query
MAX_HISTORY_TURNS 10 Conversation turns kept in context

Docker

docker-compose up --build

Running tests

pytest tests/ -v

No API keys needed — all tests use mocks.


Tech stack

  • FastAPI — REST API framework
  • Anthropic Claude — response generation and translation
  • Voyage AI — semantic embeddings for KB search
  • langdetect — offline language detection
  • Redis (optional) — persistent session storage

About

Multilingual Customer Support Agent AI-powered support agent with automatic language detection and real-time translation across English, German, and French. Built a RAG pipeline over a structured knowledge base with multi-turn conversation memory. Reduced simulated translation overhead by routing all KB queries through a single base language.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages