Files
tfm_ainventory/config/ai_prompt.md
Daniel Bedeleanu 6aabf3eac1 feat(ai): refine extraction prompt with human-readable size conversions
- Add SIZE CONVERSION RULES section (critical) with explicit thresholds
- Convert ≥1600GB to TB format (e.g., 1600GB → 1.6TB)
- Convert memory ≥1024MB to GB format
- Update Item field examples with human-readable sizes
- Update Size field definition to emphasize HUMAN-READABLE format
- Update OCR key definition with size conversion examples
- Apply rules consistently across all size-related fields

This ensures AI-extracted items display sizes in user-friendly format
and improves OCR matching accuracy with normalized size representations.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-04-17 12:57:06 +03:00

4.0 KiB

Technical Inventory Hardware Extraction Protocol

Extract ALL relevant hardware items from the image with precise, standardized formatting.

Filtering Rules

  • INCLUDE: Physical hardware, modules, cables, servers, storage, transceivers
  • EXCLUDE: Generic mounting hardware (screws, brackets, rails), paper licenses, empty packaging
  • Multi-item labels: Treat each SKU/variant as a separate item (e.g., "5m cable" and "7m cable" = 2 items)

Item Field Format (CRITICAL)

[]

Component Rules:

  • <size_or_length>:

    • STORAGE CAPACITY - HUMAN READABLE: Convert to largest unit (TB/MB).
      • Examples: "1600GB" → "1.6TB", "256GB" → "256GB", "512MB" → "512MB"
      • Rule: If ≥1000GB, use TB. If ≥1000MB, use GB. Otherwise use MB.
    • CABLE/WIRE LENGTH: Meters only. Examples: "5m", "10m", "50m"
    • RAM DIMM: Capacity in GB. Examples: "128GB", "32GB", "8GB"
  • <type>: Asset class. One of: DDR3/DDR4/DDR5, SSD/HDD/NVMe, SATA/SAS, Patchcord/Fiber/Cable, SFP/Transceiver, DIMM, etc.

  • <vendor>: Manufacturer (HP, HPE, Dell, Samsung, Cisco, Hynix, Intel, Broadcom)

  • <connector>: Physical interface (RJ45, LC-LC, MPO, U.3, SATA, SAS, ST, SC). Omit if N/A.

  • <part_number>: Part number ONLY if visible. Omit serial numbers.

Item Examples (WITH HUMAN-READABLE SIZES):

  • 1.6TB NVMe HPE U.3 P66093-002 (not 1600GB)
  • 256GB SSD Dell SATA SK-8765 (already human-readable)
  • 5m Patchcord LC-LC
  • 128GB DDR4 Hynix
  • 512MB Cache Samsung SATA (stays MB if under 1GB)

Size Conversion Examples:

  • 1600GB → 1.6TB
  • 2048GB → 2TB
  • 512GB → 512GB (under 1TB threshold)
  • 256MB → 256MB
  • 1024MB → 1GB

Restrictions:

  • No comments in parenthesis
  • No measurement units in Item field (e.g., "1.6TB" not "1.6TB Storage")
  • No secondary vendors
  • No diameter/mm in Item field
  • ONE vendor only (primary manufacturer)

Other Fields

  • Type: Repeat the asset class (DDR4, SSD, NVMe, Patchcord, etc.)
  • Description: Technical summary, max 5 words. Examples: "High-speed fiber optic", "Enterprise Gen4 storage"
  • Category: Memory, Storage, Network, Cabling, Compute, Optical, Transceiver
  • Connector: Interface type from Item field. Examples: "LC-LC", "RJ45", "U.3"
  • Size: HUMAN-READABLE capacity or length. Examples: "1.6TB", "256GB", "5m" (NOT "1600GB")
  • Color: Physical color if distinguishing
  • PartNr: Part number only (no serial numbers)
  • OCR: Robust matching key for OCR tolerance

OCR Field Rules (CRITICAL)

Generate a SHORT, clean matching key:

  • Format: UPPERCASE space-separated, NO special chars, NO duplicates
  • Include ONLY: Type + Size + Primary Vendor + Connector + Part Number
  • EXCLUDE: Serial numbers, secondary vendors, duplicate tokens, EMC/SK labels
  • USE HUMAN-READABLE SIZE: Use TB/GB from Item field, not original notation

OCR Format: TYPE SIZE VENDOR CONNECTOR PARTNUMBER

OCR Examples (WITH HUMAN-READABLE SIZES):

  • Item: 1.6TB NVMe HPE U.3 P66093-002 → OCR: NVME 1.6TB HPE U3 P66093002
  • Item: 5m Patchcord LC-LC → OCR: PATCHCORD 5M LC LC
  • Item: 256GB SSD Samsung SAS SK-8765 → OCR: SSD 256GB SAMSUNG SAS SK8765
  • Item: 128GB DDR4 Hynix → OCR: DDR4 128GB HYNIX

OCR Constraints:

  • NO duplicate part numbers
  • NO secondary vendor names
  • NO extraneous labels
  • Each token appears ONE time only
  • Remove hyphens/special chars for fuzzy matching
  • Use HUMAN-READABLE sizes (1.6TB not 1600GB)

Output Format

{
  "items": [
    {
      "Item": "[size] type vendor connector partnumber",
      "Type": "type",
      "Description": "technical details (max 5 words)",
      "Category": "category",
      "Connector": "connector_type",
      "Size": "human_readable_size",
      "Color": "color",
      "PartNr": "part_number",
      "OCR": "TYPE SIZE VENDOR CONNECTOR PARTNUMBER"
    }
  ]
}

Return ONLY JSON. No markdown. No text.