Geraldino07/Meridian-ChatBot
0
Meridian Electronics customer support chatbot
Production-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.).
Architecture
- `src/meridian_bot/mcp_client/` — Streamable HTTP session,
list_tools, safecall_tool. - `src/meridian_bot/llm/` — MCP tool defs → OpenAI tools; agent loop with round limits.
- `src/meridian_bot/agent/` — System prompt + history trim + orchestration.
- `app.py` — Gradio
Blocks+Chatbot(type="messages").
Discovered tools are documented in `docs/MCP_TOOLS.md`.
Cost controls
- `gpt-4o-mini` as default LLM.
- Max agent rounds (default 10) to cap tool+LLM iterations.
- Trimmed chat history (default last 24 turns worth of messages).
Local setup
Requires Python 3.10+ (3.12 recommended).
python3.12 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
export OPENAI_API_KEY=sk-...
# Optional override:
# export MCP_SERVER_URL=https://order-mcp-74afyau24q-uc.a.run.app/mcp
python app.pyOpen http://127.0.0.1:7860
MCP smoke test (no LLM key)
python scripts/smoke_mcp.pyTests
pytest tests/ -qHugging Face Spaces
- Create a Gradio Space from this repo.
- Settings → Secrets: add
OPENAI_API_KEY(required). OptionallyMCP_SERVER_URLif the endpoint changes. - Build: default install uses
requirements.txt(installs the local package per PEP 508.). - Ensure the Space allows outbound HTTPS to
*.run.app(default on HF).
If requirements.txt with . does not work in your Space UI, set Build command to: pip install .
Docker
docker build -t meridian-bot .
docker run -e OPENAI_API_KEY=sk-... -p 7860:7860 meridian-botEnvironment variables
License
MIT — educational / exam use.
