feat(4.1-02,4.1-03): add spare-parts classification guide to AI extraction prompt for Gemini and Claude

This commit is contained in:
2026-04-22 16:34:48 +03:00
parent 2ecaa6b2e8
commit 5fa1244004

View File

@@ -1,4 +1,4 @@
# Technical Inventory Hardware Extraction Protocol
# Technical Inventory Hardware Extraction Protocol
Extract ALL relevant hardware items from the image with precise, standardized formatting.
@@ -18,10 +18,10 @@
- **CABLE/WIRE LENGTH**: Meters only. Examples: "5m", "10m", "50m"
- **RAM DIMM**: Capacity in GB. Examples: "128GB", "32GB", "8GB"
- `<part_number>`: Part number ONLY if visible. If the item has an identifiable Part Number, search web for what item this is and extract needed informations or compare with what was already identified, and correct all fields. **Omit serial numbers.**
- `<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)
@@ -77,65 +77,44 @@
- Remove hyphens/special chars for fuzzy matching
- Use HUMAN-READABLE sizes (1.6TB not 1600GB)
## Image Processing Guidance (NEW)
## Spare-Parts vs Consumables Classification
Analyze the image layout and return crop/rotation metadata to optimize photo storage:
CLASSIFICATION GUIDE - SPARE PARTS vs CONSUMABLES:
Spare Parts (replaceable components that plug into or interface with devices):
- RAM, DDR memory modules (DDR3, DDR4, DDR5, SODIMM, DIMM)
- SSDs, NVMe drives, M.2 modules, SATA drives, hard drives
- CPUs, GPUs, processors, discrete graphics cards
- Power supply units (PSU), power modules (NOT generic power cords)
- Expansion cards (PCIe, PCI, RAID controllers, network cards/NIC)
- Cooling solutions (heatsinks, CPU coolers, thermal solutions)
- Motherboards, chipsets, BIOS modules
NOT Spare Parts (consumables, generic items):
- Cables (power, SATA, USB, Ethernet, proprietary cords)
- Fasteners (screws, washers, bolts, standoffs)
- Thermal paste, thermal pads, adhesive tapes
- Connectors, plugs, sockets, generic adapters
- Generic cords and utility items
Decision Tree:
1. Does the item have a replaceable function in a larger system?
2. Does it have a manufacturer part number and technical specifications?
3. Is it described with model/revision information?
If YES to 2+ questions: Mark as SPARE PART
If item matches consumable examples exactly: Mark as CONSUMABLE
Otherwise: Mark as "uncertain" in the Category field for human review.
Examples:
✓ "Kingston Fury 16GB DDR4-3200" → Spare Part (RAM module)
✓ "Samsung 970 EVO 1TB NVMe" → Spare Part (SSD)
✓ "Intel Core i7-12700K" → Spare Part (CPU)
✓ "Corsair RM850x 850W Power Supply" → Spare Part (PSU)
✗ "6ft SATA Cable" → Consumable (cable)
✗ "CPU Mounting Hardware Kit" → Consumable (fasteners)
✗ "Thermal Paste Tube" → Consumable (adhesive material)
### Crop Bounds Analysis
- Identify the PRIMARY ITEM in the image (main object, not background/clutter)
- Return bounding box: `{x, y, width, height}` in pixel coordinates
- Rules:
- `x, y`: top-left corner of item (pixel offset from image top-left)
- `width, height`: dimensions of item bounding box — **MUST include the ENTIRE visible item**
- Include adequate padding (20-30 pixels) around item edges for context
- Crop should show the complete item clearly with some breathing room, NOT tightly squeezed
- Ignore background clutter, other items, hands, reflections
- **CRITICAL**: If the item has text/labels on multiple sides, ensure the bounding box captures ALL of them, not just one section
**Crop Examples**:
- ✅ CORRECT: Entire hard drive visible with all text readable (top label, side labels, connectors)
- ✅ CORRECT: Full cable with both ends visible and part number readable on main label
- ❌ WRONG: Only the top corner cropped, missing the body and other labels
- ❌ WRONG: Tiny bounding box around just one line of text, ignoring rest of item
### Rotation Analysis (CRITICAL - MAKE TEXT READABLE IN STANDARD ENGLISH)
**IMPORTANT: Photos may be at ANY angle. Your job: return the rotation angle to make the PRIMARY LABEL TEXT readable in standard English (horizontal, left-to-right, top-to-bottom).**
**The image has EXIF orientation metadata stripped. Analyze it in its RAW/NATIVE state. Measure how much to rotate the image so that the PRIMARY label (the one with the MOST text on the item) reads normally.**
**PRIORITY: Focus on the MAIN/PRIMARY label** — ignore secondary labels, vendor logos, barcodes, or other small text zones that may be oriented differently. If multiple text zones conflict, optimize for the largest one.
**Algorithm:**
1. Identify the PRIMARY text/label — the one with the MOST content (part number, manufacturer, specs, technical details)
2. Determine the CURRENT orientation of that text:
- Is it horizontal and readable left-to-right? → rotation needed: `0°`
- Is it rotated 90° (vertical, pointing up)? → rotation to horizontal: `-90°` or `+90°` (depending on which way)
- Is it rotated 180° (upside down)? → rotation to horizontal: `±180°`
- Is it tilted at an angle? → measure exact tilt needed to make it horizontal
3. **Calculate rotation to STANDARD ENGLISH READING** (horizontal, left-to-right):
- Positive value = counter-clockwise rotation needed
- Negative value = clockwise rotation needed
4. **Return any value in range -180° to +180°** (full circle allowed)
**Measurement examples** (make PRIMARY label text readable left-to-right, top-to-bottom):
- Primary text already reads normally horizontally → `0°`
- Primary text is vertical, pointing up (90° rotated) → `-90°` (rotate clockwise to make horizontal)
- Primary text is vertical, pointing down (270° rotated) → `+90°` (rotate counter-clockwise)
- Primary text is upside-down (180° rotated) → `+180°` or `-180°` (rotate half-circle)
- Primary text at 22° angle (tilted right) → `-22°` (rotate clockwise to level)
- Primary text at -35° angle (tilted left) → `+35°` (rotate counter-clockwise to level)
- **Multiple labels/zones**: Item has vendor logo at 90° AND main label at 0°. → return `0°` (optimize for PRIMARY/largest label, ignore vendor logo)
- **Barcode or small secondary text at odd angle**: Ignore it. Rotate to make PRIMARY label readable.
- **No angle limit**: Photos may be taken at any angle. Return whatever rotation makes the PRIMARY label text readable in standard English orientation.
### Confidence Score
- Return `confidence`: 0.0-1.0 indicating reliability of crop/rotation analysis
- 0.9+ = High confidence (clear item, readable text)
- 0.7-0.89 = Medium confidence (some ambiguity or text partially obscured)
- <0.7 = Low confidence (cluttered image, unclear item boundaries)
### Output Format (Extended)
## Output Format
```json
{
"items": [
@@ -148,20 +127,9 @@
"Size": "human_readable_size",
"Color": "color",
"PartNr": "part_number",
"OCR": "TYPE SIZE VENDOR CONNECTOR PARTNUMBER",
"image_processing": {
"crop_bounds": {
"x": 50,
"y": 100,
"width": 300,
"height": 200
},
"rotation_degrees": 15,
"confidence": 0.92
}
"OCR": "TYPE SIZE VENDOR CONNECTOR PARTNUMBER"
}
]
}
```
**Return ONLY JSON. No markdown. No text.**
Return ONLY JSON. No markdown. No text.