Skip to content

feat: ACP/UCP protocol schema export#56

Merged
antoniomtz merged 1 commit intomainfrom
antoniomtz/protocol-schema-export
Apr 17, 2026
Merged

feat: ACP/UCP protocol schema export#56
antoniomtz merged 1 commit intomainfrom
antoniomtz/protocol-schema-export

Conversation

@antoniomtz
Copy link
Copy Markdown
Collaborator

@antoniomtz antoniomtz commented Apr 17, 2026

Summary

  • Add a Protocols tab to the enrichment UI with ACP/UCP sub-tabs for exporting enriched product data as commerce protocol-compliant JSON
  • New POST /protocols/generate backend endpoint that calls the LLM once to extract structured fields (brand, material, age_group, product_details, etc.) and builds both ACP and UCP schemas
  • UCP follows the Google Merchant Center Product Data Specification with structured_title/structured_description using digital_source_type: "trained_algorithmic_media"
  • Schema generation fires in the background after FAQ generation completes, ensuring FAQs are included in both schemas

Changes

Backend (3 files):

  • src/backend/main.py — Protocol schema builders with DRY helpers, /protocols/generate endpoint
  • src/backend/vlm.py_call_nemotron_extract_schema_fields() for LLM-based attribute extraction

Frontend (4 files):

  • src/ui/components/ProtocolsTabContent.tsx — New component with segmented control, syntax-highlighted JSON, copy button
  • src/ui/components/FieldsCard.tsx — Third tab wired in
  • src/ui/app/page.tsx — Background protocol generation chained after FAQs
  • src/ui/lib/api.tsgenerateProtocolSchemas() API client

Tests (1 file):

  • tests/test_protocol_schemas.py — 31 unit tests covering enriched field population, LLM field merging, deterministic defaults, nested types, edge cases

Docs (4 files):

  • docs/API.md — Section 6 with full endpoint spec, response schema, curl example
  • docs/PRD.md — FR-13 functional requirement + implementation TODO
  • AGENTS.md — Status line + API endpoint entry
  • README.md — Key Features bullet + API Endpoints list

Test plan

  • Upload a product image and run analysis
  • Verify Details and FAQs tabs still work (no regression)
  • Switch to Protocols tab — should show spinner then populated schemas
  • Toggle ACP/UCP — verify different structures with syntax highlighting
  • Verify ACP has brand, product_details, highlights, FAQs populated by LLM
  • Verify UCP has structured_title/description, brand, google_product_category, product_detail, FAQs
  • Click Copy — verify plain JSON copied to clipboard
  • Run pytest tests/ — all 239 tests pass
  • Run pnpm build — clean build, no errors

🤖 Generated with Claude Code

…elds

Add a Protocols tab to the enrichment UI that exports enriched product
data as ACP (Agentic Commerce Protocol) and UCP (Unified Commerce
Protocol) compliant JSON schemas. A single backend endpoint calls the
LLM once to extract structured attributes (brand, material, age_group,
product_details, etc.) and builds both schemas from the same extraction.

Backend:
- POST /protocols/generate endpoint returns { acp, ucp }
- _call_nemotron_extract_schema_fields() in vlm.py for LLM extraction
- _build_acp_schema() and _build_ucp_schema() with DRY helpers
- Deterministic defaults (availability, condition, adult, is_bundle)

Frontend:
- ProtocolsTabContent component with ACP/UCP sub-tabs
- Syntax-highlighted JSON with VS Code dark theme colors
- Copy-to-clipboard with feedback
- Background generation chained after FAQs (same pattern)

Tests:
- 31 unit tests for both schema builders

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@antoniomtz antoniomtz self-assigned this Apr 17, 2026
@antoniomtz antoniomtz added enhancement New feature or request labels Apr 17, 2026
@antoniomtz antoniomtz merged commit d0334a7 into main Apr 17, 2026
4 of 5 checks passed
@antoniomtz antoniomtz deleted the antoniomtz/protocol-schema-export branch April 17, 2026 22:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant