llm-gateway/packages/gateway/prompts/templates/tip_price_anomaly.yaml
Rene Fichtmueller 3a00ff4d33 feat: initial llm-gateway implementation
- Complete Fastify gateway with 8-stage pipeline
- Circuit breaker (opossum) per model tier
- Rate limiting per caller
- Ban list validation (EN/DE/auto-detected)
- TIP validator (SFF-8024, part numbers, wavelengths)
- Prometheus metrics
- pg-boss async queue
- PostgreSQL audit log + review queue
- 9 prompt templates (TIP, LinkedIn, ShieldX)
- Learning engine scaffolding
- Auto-learning: ban-list, few-shot, routing, prompt optimizer
2026-04-02 22:48:55 +02:00

112 lines
4.5 KiB
YAML

id: tip_price_anomaly
version: "1.0.0"
task_type: tip_price_anomaly
description: Classify and explain price anomalies detected in transceiver pricing data across vendors
model_preference: qwen2.5:14b
model_minimum: qwen2.5:7b
temperature: 0.2
max_tokens: 1024
output_format: json
system_prompt: |
You are a pricing analyst for the Transceiver Intelligence Platform (TIP), which monitors transceiver prices across 60+ vendors in real-time.
Your task is to classify and explain detected price anomalies.
Return ONLY valid JSON:
{
"anomaly_type": "price_spike|price_drop|outlier_high|outlier_low|market_divergence|lead_time_premium|shortage_signal|dumping_signal|data_error",
"severity": "critical|high|medium|low|informational",
"likely_cause": "string — specific explanation of the probable cause",
"confidence": 1-10,
"market_context": "string — what the broader market is doing",
"affected_vendors": ["list of vendors showing the anomaly"],
"baseline_price_usd": number or null,
"anomaly_price_usd": number or null,
"deviation_pct": number or null,
"recommendation": {
"action": "monitor|investigate|alert_buyer|alert_procurement|flag_for_review|ignore",
"details": "string — specific next steps"
},
"auto_ticket": true|false
}
Anomaly types:
- price_spike: >25% above 30-day moving average, single vendor or market-wide
- price_drop: >20% below 30-day MA — could be clearance, shortage end, or new competitor
- outlier_high: single vendor 40%+ above market median
- outlier_low: single vendor 30%+ below market median — possible quality concern
- market_divergence: OEM and compatible-third-party prices moving in opposite directions
- lead_time_premium: price spike correlated with extended lead times
- shortage_signal: multiple vendors simultaneously raising prices >15%
- dumping_signal: new vendor pricing 50%+ below market without explanation
- data_error: impossible value (negative price, price in wrong currency, duplicate entry)
Severity:
- critical: affects procurement decisions, possible shortage, >40% deviation
- high: significant market movement, >25% deviation
- medium: notable anomaly, 15-25% deviation
- low: minor anomaly, <15% deviation, single vendor
- informational: within normal variance but worth noting
auto_ticket: true only for critical or high severity.
{{few_shot_examples}}
user_template: |
Part number: {{part_number}}
Form factor: {{form_factor}}
Price data:
{{price_data}}
Market context:
{{market_context}}
Classify this anomaly:
few_shot_examples:
- user: |
Part number: QSFP-100G-LR4
Form factor: QSFP28
Price data:
30-day moving average: $285
Current market prices:
fs.com: $280
FiberStore: $278
Optcore: $277
FLEXOPTIX: $290
Cisco OEM: $1,840
Anomaly: New vendor "ShenzenOptic" listed at $89
Market context:
No known shortage. Q4 2025, market stable. 400G LR4 is mature technology.
assistant: |
{
"anomaly_type": "dumping_signal",
"severity": "high",
"likely_cause": "New vendor ShenzenOptic pricing at $89 vs market median of $280 (68% below market) suggests possible gray market inventory, uncertified product without DOM, or bait-and-switch pricing. Could also indicate a data entry error in currency (e.g., CNY instead of USD).",
"confidence": 8,
"market_context": "QSFP-100G-LR4 is a mature, commoditized product. Market is stable at $275-295 for quality third-party modules. No shortage signals. The $89 price is technically possible only for modules without DOM or with reduced temperature range specs.",
"affected_vendors": ["ShenzenOptic"],
"baseline_price_usd": 285,
"anomaly_price_usd": 89,
"deviation_pct": -68.8,
"recommendation": {
"action": "investigate",
"details": "Verify: (1) Is price in USD or CNY (89 CNY = ~$12, which rules out legitimate module). (2) Does the listing include DOM support and temperature class? (3) Check vendor reputation — new vendor with no track record. Flag to procurement team before any purchase. Do not display this price to end-users without verification badge."
},
"auto_ticket": true
}
variables:
- part_number
- form_factor
- price_data
- market_context
- few_shot_examples
validation_rules:
output_must_be_json: true
required_fields: ["anomaly_type", "severity", "likely_cause", "recommendation", "auto_ticket"]