CoolFace
Apppublic

Geraldino07/Meridian-ChatBot

sourceHugging Faceupdated 5mo agoView on Hugging Face
0likes
README.md88 linesDownload Raw Back to root
1---2title: Meridian Electronics Support Bot3emoji: πŸ›’4colorFrom: blue5colorTo: green6sdk: docker7app_port: 78608pinned: false9---10 11# Meridian Electronics customer support chatbot12 13Production-minded prototype: **Gradio** UI β†’ **OpenAI `gpt-4o-mini`** (tool calling) β†’ **MCP Streamable HTTP** β†’ Meridian order backend (`list_products`, `search_products`, `get_product`, customer auth, orders, `create_order`, etc.).14 15## Architecture16 17- [`src/meridian_bot/mcp_client/`](src/meridian_bot/mcp_client/) β€” Streamable HTTP session, `list_tools`, safe `call_tool`.18- [`src/meridian_bot/llm/`](src/meridian_bot/llm/) β€” MCP tool defs β†’ OpenAI tools; agent loop with round limits.19- [`src/meridian_bot/agent/`](src/meridian_bot/agent/) β€” System prompt + history trim + orchestration.20- [`app.py`](app.py) β€” Gradio `Blocks` + `Chatbot(type="messages")`.21 22Discovered tools are documented in [`docs/MCP_TOOLS.md`](docs/MCP_TOOLS.md).23 24## Cost controls25 26- **`gpt-4o-mini`** as default LLM.27- **Max agent rounds** (default 10) to cap tool+LLM iterations.28- **Trimmed chat history** (default last 24 turns worth of messages).29 30## Local setup31 32Requires **Python 3.10+** (3.12 recommended).33 34```bash35python3.12 -m venv .venv36source .venv/bin/activate37pip install -e ".[dev]"38export OPENAI_API_KEY=sk-...39# Optional override:40# export MCP_SERVER_URL=https://order-mcp-74afyau24q-uc.a.run.app/mcp41python app.py42```43 44Open http://127.0.0.1:786045 46## MCP smoke test (no LLM key)47 48```bash49python scripts/smoke_mcp.py50```51 52## Tests53 54```bash55pytest tests/ -q56```57 58## Hugging Face Spaces59 601. Create a **Gradio** Space from this repo.612. **Settings β†’ Secrets:** add `OPENAI_API_KEY` (required). Optionally `MCP_SERVER_URL` if the endpoint changes.623. **Build:** default install uses `requirements.txt` (installs the local package per PEP 508 `.`).634. Ensure the Space **allows outbound HTTPS** to `*.run.app` (default on HF).64 65If `requirements.txt` with `.` does not work in your Space UI, set **Build command** to: `pip install .`66 67## Docker68 69```bash70docker build -t meridian-bot .71docker run -e OPENAI_API_KEY=sk-... -p 7860:7860 meridian-bot72```73 74## Environment variables75 76| Variable | Default | Description |77|----------|---------|-------------|78| `OPENAI_API_KEY` | β€” | OpenAI API key |79| `OPENAI_MODEL` | `gpt-4o-mini` | Chat model |80| `MCP_SERVER_URL` | Cloud Run URL in plan | Streamable HTTP MCP base URL |81| `MAX_AGENT_ROUNDS` | `10` | Max LLM↔tool iterations per message |82| `MAX_HISTORY_MESSAGES` | `24` | Max prior user+assistant messages considered |83| `PORT` | `7860` | Listen port (`app.py`) |84 85## License86 87MIT β€” educational / exam use.88