Cookbook Blueprint
Customer Support Bot
Train a specialized domain language model on private knowledge base articles and deploy it locally with zero cloud dependencies.
What You'll Build
- A localized Qwen2.5 or Llama-3.2 model fine-tuned on company policies and FAQs
- A deterministic evaluation suite to ensure 100% adherence to company refund and password procedures
- An instant local REST endpoint served via Ollama and queried with Python
Step 1: Prepare Training Data
Format your customer support FAQ into structured multi-turn conversation JSONL:
cat > support_data.jsonl << 'EOF'
{"messages": [{"role": "system", "content": "You are a helpful support assistant for Acme Corp."}, {"role": "user", "content": "How do I reset my password?"}, {"role": "assistant", "content": "To reset your password, go to Settings > Security > Reset Password. You'll receive a confirmation email within 2 minutes."}]}
{"messages": [{"role": "system", "content": "You are a helpful support assistant for Acme Corp."}, {"role": "user", "content": "What is your refund policy?"}, {"role": "assistant", "content": "We offer a 30-day money-back guarantee on all purchases. To request a refund, go to Orders > Select Order > Request Refund."}]}
{"messages": [{"role": "system", "content": "You are a helpful support assistant for Acme Corp."}, {"role": "user", "content": "How do I contact emergency support?"}, {"role": "assistant", "content": "You can reach our 24/7 priority support team at priority@acme.com or by calling 1-800-ACME-HELP."}]}
EOF
Step 2: Initialize Project & Copy Data
moro init support-bot --template support-bot cd support-bot cp ../support_data.jsonl data/raw/
Step 3: Configure moro.yaml
name: "support-bot" version: "1.0.0" dataset: source: ./data/raw/support_data.jsonl format: jsonl mi_guard_threshold: 0.85 model: base: "Qwen/Qwen2.5-1.5B" quantization: "nf4" training: learning_rate: 2.0e-4 micro_batch_size: 2 gradient_accumulation_steps: 8 auto_heal: true
Step 4: Build & Train
# 1. Compile dataset with MI Guard moro data build # 2. Start self-healing training moro train
Step 5: Run Evaluation Suite
Create an evaluation definition to verify accurate answers:
cat > eval/support_eval.yaml << 'EOF'
name: "support-eval"
tests:
- id: "test_password_reset"
prompt: "How do I reset my password?"
expected_keywords: ["Settings", "Security", "Reset Password"]
forbidden_terms: ["call the CEO", "I don't know"]
- id: "test_refund"
prompt: "Can I get my money back?"
expected_keywords: ["30-day", "money-back"]
EOF
# Execute evaluation
moro eval run --checkpoint ./runs/best/ --suite eval/support_eval.yaml
Step 6: Deploy to Local Ollama Runtime
moro release export --run-id best --version v1.0.0 --quant Q4_K_M moro release deploy --target ollama --version v1.0.0 --name support-bot
Step 7: Production Query Example (Python)
import httpx
def query_support_bot(user_question: str) -> str:
"""Send customer query to locally running Ollama instance."""
response = httpx.post(
"http://localhost:11434/api/generate",
json={
"model": "support-bot:v1.0.0",
"prompt": user_question,
"stream": False,
},
timeout=30.0,
)
return response.json()["response"]
# Example usage:
answer = query_support_bot("How do I reset my password?")
print("Support Bot Response:\n", answer)