Files
ItemSense/python/specs/002-openai-integration.md
2026-01-21 15:41:18 -05:00

1.1 KiB

Feature: OpenAI Vision Integration (PyObjC)

Status: COMPLETE

Description

Implement the logic to capture a frame from the AppKit interface and send it to OpenAI's API.

Requirements

  1. Image Handling:

    • On "Capture" click:
      • Stop/Pause the live feed update.
      • Store the current frame (in memory).
      • Show "Processing..." (maybe change button text or add a label).
  2. OpenAI API Call:

    • Async handling is important to not block the UI thread (spinning beachball).
    • Run the API request in a background thread (threading).
    • Model: gpt-5-mini (fallback gpt-4o-mini).
    • Prompt: "What is this item? Please provide a brief description."
  3. Response Handling:

    • When response returns, schedule a UI update on the main thread (performSelectorOnMainThread: or dispatch_async).
    • Print response to console (UI display comes in Spec 003).

Acceptance Criteria

  • UI remains responsive (no beachball) during API call.
  • "Processing..." indication is shown.
  • Image frame is correctly sent to OpenAI.
  • Text response is received and printed to console.