Skip to main content
Loading navigation

Build a Multilingual Logistics Service Request Router and Triage Dispatcher — implementation

Prompt source

implementation75 lines11 sectionsNo variables1 code block
## Build
Process unstructured cross-border freight inquiries in English, Malay, Mandarin, and Tamil into standardized service orders. Route logistics bookings to port-adjacent terminal handlers based on customs urgency.

## User
Regional freight forwarding dispatch coordinator

## Workflow
1. Ingest incoming multilingual customer transport requests submitted via web forms or message payloads.
2. Detect language, extract cargo dimensions, hazardous classifications, and destination delivery milestones.
3. Normalize extracted attributes into structured logistics routing specifications with confidence scores.
4. Dispatch validated booking manifests to designated container depot handling queues with simulated terminal slots.

## Interface
Multi-pane dispatcher console displaying original request text, auto-detected language, normalized cargo fields, and queue routing badges.

## Data
Curated multilingual corpus of 50 realistic Singapore logistics service inquiries across English, Simplified Chinese, Malay, and Tamil.
Starter examples below are synthetic. They are not downloaded records.

## Source
[Singapore government FormSG](https://raw.githubusercontent.com/opengovsg/FormSG/develop/README.md)
Leverages FormSG multi-field intake design principles and webhooks functionality for structured service request parsing.

## Tools
dspy, fastapi, pydantic.
DSPy compiles robust prompt pipelines that accurately map unstructured multilingual text into deterministic JSON extraction schemas.
Multilingual reasoning model supporting Asian languages via API with temperature set to zero.

## Deliverables
Submit runnable source, pinned dependencies, setup commands, a working interface, example outputs, and a recorded end-to-end demo. Include tests and an action log.

## Acceptance
- Accurately extracts cargo type, weight, and destination across English, Mandarin, Malay, and Tamil inputs.
- Flags unparseable or ambiguous delivery windows for manual coordinator triage.
- Assigns priority routing tiers based on perishable or dangerous goods classifications.
- Outputs normalized booking tickets compliant with simulated port gate staging formats.

## Starter Examples
```json
[
  {
    "input": {
      "request_id": "REQ-401",
      "raw_text": "Sila aturkan penghantaran 2 kontena kering dari Pelabuhan Jurong ke Tuas West Avenue pada 14 Mac jam 10 pagi.",
      "source_channel": "web_portal"
    },
    "expected_output": {
      "detected_language": "ms",
      "origin": "Jurong Port",
      "destination": "Tuas West Avenue",
      "container_count": 2,
      "container_type": "DRY",
      "scheduled_time": "2025-03-14T10:00:00+08:00",
      "priority": "STANDARD",
      "triage_queue": "TUAS_HAULAGE_DEPOT"
    }
  },
  {
    "input": {
      "request_id": "REQ-402",
      "raw_text": "需要紧急运送一批冷冻海鲜到巴西班让,没有写具体的箱型大小,请尽快安排司机。",
      "source_channel": "email_inbound"
    },
    "expected_output": {
      "detected_language": "zh",
      "origin": "UNSPECIFIED",
      "destination": "Pasir Panjang",
      "container_count": null,
      "container_type": "REEFER_COLD_CHAIN",
      "scheduled_time": null,
      "priority": "HIGH",
      "triage_queue": "MANUAL_DISPATCH_TRIAGE",
      "missing_fields": [
        "origin",
        "container_count",
        "container_dimensions"
      ]
    }
  }
]
```

## Safety
Operates purely on mock logistics booking data. Hauler bookings are recorded in sandbox tables without real-world fleet commands.
Use mock external writes. Require human review before any real deployment.