Перейти к содержимому

LLM Prompt Router for Intent Classification — Python Flask & OpenAI

Laharika Sabbella

0:00 / 0:00

LLM Prompt Router for Intent Classification — Python Flask & OpenAI

27 просмотров · 3 мес. назад
Laharika Sabbella
1 подписчик
27 просмотров · 3 мес. назад
Keywords: LLM, Prompt Routing, Intent Classification, Python, Flask, OpenAI, Groq, Docker, Prompt Engineering 🚀 Project Overview A compact Python application that classifies user intent with an LLM and routes prompts to specialized expert personas (code, data, writing, career). The system supports provider detection (OpenAI or Groq), JSONL observability, and multiple interfaces (web UI, CLI, batch tests). ✨ Key Features Intent classification using an LLM with a configurable confidence threshold (CONFIDENCE_THRESHOLD = 0.7) Persona-driven prompt routing stored in prompts.json (code, data, writing, career) Manual intent override via @intent prefixes (e.g., @code) for deterministic routing Provider-agnostic API selection: OpenAI SDK with optional Groq routing detected from API key Defensive JSON parsing and error handling to fall back to an "unclear" flow JSON Lines logging of routing decisions to route_log.jsonl for observability Multiple interfaces: Flask web UI (templates/ and static/), interactive CLI (main.py), and batch test runner (test_router.py) Docker and docker-compose support for containerized deployment 🛠️ Technology Stack Python (3.9+ noted in README) Flask + flask-cors OpenAI Python SDK (openai) with optional Groq base_url switch python-dotenv for environment configuration Docker & docker-compose JSON Lines (route_log.jsonl) and prompts.json for configuration 📂 GitHub Repository https://github.com/SabbellaLaharika/L... 🎥 About This Demo This demo shows the repository’s intent-classification and prompt-routing flow: how messages are classified, manual overrides handled, and how the app routes to persona prompts defined in prompts.json. You’ll see the Flask web UI (templates/static), the interactive CLI, the batch test runner, the JSONL logging behavior, and the provider detection logic. The video also demonstrates how to run the project locally and via docker-compose. ⭐ If you found this project useful, consider starring the repository and subscribing for more software engineering projects. #Python #Flask #FlaskCORS #OpenAI #Groq #LLM #PromptRouting #IntentClassification #PromptEngineering #Docker #DockerCompose #JSONL #PythonDotenv #WebUI