How induseuro-labs/intern-assignment-llm-cost-optimization works
ShopAssist is an e-commerce Tier-1 support copilot: it loads a ticket and its order, chooses a resolution, cites a help-center policy, and (in Q1) drafts a customer reply. Q1 makes one model-simulator call; Q2 orchestrates triage, retrieval, composition, and audit calls before parsing a resolution. Shared runtime modules provide ticket/order access, article loading, simulated decisions, token counting, and per-call cost accounting. The README documents these capabilities; edges below reflect shown calls and data reads, not an assumed live-model integration.
Main entry points: llm.py Local LLM simulator · question2/agent.py Pipeline controller · question1/agent.py Single-call copilot · tools.py Ticket and order access
Components 16
Support workflows
- Single-call copilot
question1/agent.py - Pipeline controller
question2/agent.py - Triage stage
question2/agent.py - Article retrieval
question2/agent.py - Reply composition
question2/agent.py - Policy audit
question2/agent.py
Shared runtime
- Ticket and order access
shared/tools.py - Local LLM simulator
shared/llm.py - Resolution rules
eval/reference.py - Help-center loader
shared/kb.py - Token counter
shared/tokens.py
Policy and case data
- Ticket records
data/tickets - Order records
data/orders - Policy articles
data/kb
Cost accounting
- Call cost session
shared/billing.py
Other components
- Support operator
Connections 26
- Support operator → Single-call copilot: submits ticket
README.md - Support operator → Pipeline controller: submits ticket
README.md - Single-call copilot → Ticket and order access: loads case
question1/agent.py - Single-call copilot → Help-center loader: loads articles
question1/agent.py - Single-call copilot → Local LLM simulator: requests resolution
question1/agent.py - Single-call copilot → Call cost session: creates session
question1/agent.py - Pipeline controller → Ticket and order access: loads case
question2/agent.py - Pipeline controller → Help-center loader: loads help center
question2/agent.py - Pipeline controller → Triage stage: runs
question2/agent.py - Triage stage → Local LLM simulator: requests triage
question2/agent.py - Triage stage → Article retrieval: passes triage
question2/agent.py - Article retrieval → Local LLM simulator: requests articles
question2/agent.py - Article retrieval → Reply composition: passes articles
question2/agent.py - Reply composition → Local LLM simulator: requests draft
question2/agent.py - Reply composition → Policy audit: passes draft
question2/agent.py - Policy audit → Local LLM simulator: requests audit
question2/agent.py - Pipeline controller → Call cost session: creates session
question2/agent.py - Ticket and order access → Ticket records: reads tickets
shared/tools.py - Ticket and order access → Order records: reads orders
shared/tools.py - Help-center loader → Policy articles: reads articles
shared/kb.py - Local LLM simulator → Resolution rules: gets outcome
shared/llm.py - Local LLM simulator → Call cost session: records call
shared/llm.py - Local LLM simulator → Token counter: counts prefix
shared/llm.py - Call cost session → Token counter: counts tokens
shared/billing.py - Help-center loader → Token counter: sizes articles
shared/kb.py - Pipeline controller → Single-call copilot: parses resolution
question2/agent.py