CoolFace
Apppublic

umairali64488/multi_llm_debugging_engine

sourceHugging Faceupdated 7mo agoView on Hugging Face
1likes
App README

⚡ CodeDebug — Multi-LLM Debugging Engine (LangChain)

A code debugging assistant that queries 3 LLMs in parallel using LangChain LCEL chains, then uses Qwen3 as a judge to synthesize the best final answer.

Architecture

Your query
    ├──▶ Trinity Large  (arcee-ai)  ─╮
    ├──▶ StepFun Flash  (stepfun)   ─┼──▶ Qwen3 Judge ──▶ Reasoning + Final Answer
    └──▶ Nemotron Nano  (nvidia)   ─╯

LangChain Stack:
  PANEL_PROMPT | ChatOpenAI | StrOutputParser   × 3  (asyncio.gather)
  JUDGE_PROMPT | ChatOpenAI | StrOutputParser   × 1

Setup on Hugging Face Spaces

  1. 1.Fork this Space
  2. 2.Settings → Variables and secrets → New secret
  3. 3.Name: OPENROUTER_API_KEY
  4. 4.Value: your key from openrouter.ai
  5. 5.The Space rebuilds automatically (~2 min)

Local development

bash
# 1. Create .env
echo "OPENROUTER_API_KEY=sk-or-v1-..." > .env

# 2. Install
pip install -r requirements.txt

# 3. Run
uvicorn app.main:app --reload --port 7860

Open http://localhost:7860

File structure

├── app/
│   ├── __init__.py
│   ├── config.py        # pydantic-settings
│   ├── prompts.py       # LangChain ChatPromptTemplates
│   ├── llm_factory.py   # ChatOpenAI factory (OpenRouter)
│   ├── llm_chain.py     # LCEL pipeline (panel + judge)
│   └── main.py          # FastAPI routes
├── frontend/
│   └── index.html       # Single-file UI
├── requirements.txt
├── Dockerfile
└── README.md

API

POST /api/v1/debug

json
{ "question": "Why does my Python function return None?", "temperature": 0.3 }

Response:

json
{
  "question": "...",
  "panel": [
    { "model": "...", "label": "Trinity Large", "response": "...", "latency_ms": 1200, "error": null },
    ...
  ],
  "judge": {
    "reasoning": "...",
    "final_answer": "...",
    "latency_ms": 3100,
    "error": null
  },
  "total_ms": 4300
}