Skip to content

Add focused multimodal catalog agent example - #226

Merged
svonava merged 5 commits into
mainfrom
agent/ecommerce-taxonomy-verifier
Aug 3, 2026
Merged

Add focused multimodal catalog agent example#226
svonava merged 5 commits into
mainfrom
agent/ecommerce-taxonomy-verifier

Conversation

@svonava

@svonava svonava commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a focused catalog agent to the existing taxonomy-classification example
  • rank candidate paths from copy and from image plus copy
  • ask Qwen3.6-27B to select from the union and return a review flag
  • add single-listing and 100-row evaluation commands
  • document the 55 initial misses and the measured improvement
  • update the example to sie-sdk 0.6.24

Measured result

The current recorded run moves exact-path matches from 42/100 for copy alone to 54/100 for the agent. Macro hierarchical F1 moves from 0.6710 to 0.7446. These values came from real model outputs.

Validation

  • uv run ruff format --check .
  • uv run ruff check .
  • uv run pytest -q
  • predict-catalog-agent --help
  • eval-catalog-agent --help

Before merge

  • replay the full example through one stable SIE Cloud instance
  • replace the compact result summary with that Cloud run
  • confirm the documented metrics remain unchanged

Summary by CodeRabbit

  • New Features

    • Added a multimodal catalog classification example using product text and images.
    • Added commands for evaluating datasets and predicting individual listings with JSON output.
    • Added candidate ranking, verification, review flags, caching, resumable evaluations, and classification metrics.
    • Added documented benchmark results and guidance for reviewing uncertain classifications.
  • Documentation

    • Expanded the taxonomy classification guide with setup, workflow, CLI usage, and analysis details.
  • Tests

    • Added coverage for candidate selection, verification, caching, resumption, prediction limits, and evaluation metrics.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 86a018e0-6854-466a-9822-396d5d5ff112

📥 Commits

Reviewing files that changed from the base of the PR and between beba7a6 and e197293.

📒 Files selected for processing (2)
  • examples/taxonomy-classification/taxonomy_classification/catalog_agent.py
  • examples/taxonomy-classification/tests/test_catalog_agent.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • examples/taxonomy-classification/tests/test_catalog_agent.py
  • examples/taxonomy-classification/taxonomy_classification/catalog_agent.py

📝 Walkthrough

Walkthrough

Changes

The example adds a multimodal Shopify taxonomy agent. It loads and caches listings, ranks taxonomy candidates with text and image-plus-copy calls, verifies the candidate union, computes hierarchical metrics, and exposes evaluation and prediction commands.

Catalog agent workflow

Layer / File(s) Summary
Listing contracts and ingestion
examples/taxonomy-classification/taxonomy_classification/catalog_agent.py, examples/taxonomy-classification/pyproject.toml, examples/taxonomy-classification/tests/test_catalog_agent.py
Defines listing and decision dataclasses. Loads revision-pinned Shopify rows, caches images, builds listing queries, and prepares verifier image data. Adds Pillow and related test helpers.
Candidate ranking and verification
examples/taxonomy-classification/taxonomy_classification/catalog_agent.py, examples/taxonomy-classification/tests/test_catalog_agent.py
Runs text and image-plus-copy rerankers. Unions ranked candidates and verifies the selection with a structured multimodal response. Tests validate ordering, payloads, review flags, response IDs, and empty-candidate validation.
Evaluation and command-line outputs
examples/taxonomy-classification/taxonomy_classification/catalog_agent.py, examples/taxonomy-classification/pyproject.toml, examples/taxonomy-classification/results/catalog-agent-summary.json, examples/taxonomy-classification/tests/test_catalog_agent.py, examples/taxonomy-classification/README.md
Computes exact-path, top-level, and hierarchical F1 metrics. Adds resumable evaluation, atomic JSON output, evaluation and prediction commands, benchmark results, and workflow analysis. Tests validate caching, checkpoint resumption, metrics, and prediction limits.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ShopifyDataset
  participant catalog_agent
  participant SIEClient
  participant JSONOutput
  ShopifyDataset->>catalog_agent: load CatalogListing
  catalog_agent->>SIEClient: rank text and image-plus-copy candidates
  SIEClient-->>catalog_agent: return ranking scores
  catalog_agent->>SIEClient: verify candidate union
  SIEClient-->>catalog_agent: return selected index and review flag
  catalog_agent->>JSONOutput: write CatalogDecision and metrics
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding a focused multimodal catalog agent example.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/ecommerce-taxonomy-verifier

Comment @coderabbitai help to get the list of available commands.

@svonava

svonava commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
examples/taxonomy-classification/taxonomy_classification/catalog_agent.py (2)

103-147: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Include the dataset revision in the image cache key.

The cache filename at Line 125 uses only row_idx. If DATASET_REVISION changes later, a stale image from the old revision is silently reused for the same row_idx, desynchronizing cached bytes from the current row's title, description, and ground truth. Add the revision to the cache key.

♻️ Proposed fix
-        image_path = cache_dir / f"shopify-train-{row_idx}.image"
+        image_path = cache_dir / f"shopify-train-{DATASET_REVISION[:12]}-{row_idx}.image"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/taxonomy-classification/taxonomy_classification/catalog_agent.py`
around lines 103 - 147, Update the image cache key in load_shopify_rows to
include DATASET_REVISION alongside row_idx, ensuring revisions use distinct
cache files while preserving the existing cache read and write behavior.

379-439: 🩺 Stability & Availability | 🔵 Trivial | 🏗️ Heavy lift

Persist evaluation progress incrementally.

eval_main only writes args.output after the full loop finishes (Line 434-438). A network error or model failure on a later row discards every earlier successful classification, and rerunning repeats potentially expensive, capacity-waited model calls (PROVISION_TIMEOUT_S = 900.0). Write a checkpoint after each row (or every N rows) so a restart can resume.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/taxonomy-classification/taxonomy_classification/catalog_agent.py`
around lines 379 - 439, The eval_main classification loop currently persists
output only after all listings complete; update it to checkpoint results
incrementally after each successful classify_listing call (or a small fixed
batch), preserving completed decisions and enabling restart/resume without
reprocessing them. Reuse the existing output construction and args.output
writing flow, and ensure resumed runs skip already recorded row_idx values.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@examples/taxonomy-classification/taxonomy_classification/catalog_agent.py`:
- Around line 442-450: Update predict_main to pass args.limit to
load_shopify_rows instead of hardcoding limit=1, preserving the default of one
listing from parser.set_defaults(limit=1). Leave the existing
classify_listing(listings[0]) behavior unchanged.
- Around line 226-289: Update verify_candidates to reject an empty candidates
list before constructing candidate_lines or the verifier response schema,
raising a clear ValueError that identifies the missing candidates. Preserve the
existing schema and selection validation for non-empty candidate lists.

---

Nitpick comments:
In `@examples/taxonomy-classification/taxonomy_classification/catalog_agent.py`:
- Around line 103-147: Update the image cache key in load_shopify_rows to
include DATASET_REVISION alongside row_idx, ensuring revisions use distinct
cache files while preserving the existing cache read and write behavior.
- Around line 379-439: The eval_main classification loop currently persists
output only after all listings complete; update it to checkpoint results
incrementally after each successful classify_listing call (or a small fixed
batch), preserving completed decisions and enabling restart/resume without
reprocessing them. Reuse the existing output construction and args.output
writing flow, and ensure resumed runs skip already recorded row_idx values.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f40bf948-2b8b-4daa-93f2-050ff733c8e5

📥 Commits

Reviewing files that changed from the base of the PR and between 8b7d3dd and 520c1e1.

⛔ Files ignored due to path filters (1)
  • examples/taxonomy-classification/uv.lock is excluded by !**/*.lock
📒 Files selected for processing (5)
  • examples/taxonomy-classification/README.md
  • examples/taxonomy-classification/pyproject.toml
  • examples/taxonomy-classification/results/catalog-agent-summary.json
  • examples/taxonomy-classification/taxonomy_classification/catalog_agent.py
  • examples/taxonomy-classification/tests/test_catalog_agent.py

@svonava
svonava marked this pull request as ready for review August 3, 2026 05:32

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
examples/taxonomy-classification/tests/test_catalog_agent.py (1)

13-13: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Drop the redundant module alias.

import taxonomy_classification.catalog_agent as catalog_agent aliases the submodule to its own name. Use from taxonomy_classification import catalog_agent instead.

♻️ Proposed fix
-import taxonomy_classification.catalog_agent as catalog_agent
+from taxonomy_classification import catalog_agent
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/taxonomy-classification/tests/test_catalog_agent.py` at line 13,
Update the catalog_agent import in test_catalog_agent.py to use the
package-level from taxonomy_classification import catalog_agent form, removing
the redundant self-alias while preserving all existing references.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@examples/taxonomy-classification/taxonomy_classification/catalog_agent.py`:
- Around line 425-444: Update _write_evaluation_output so temporary_path is
assigned immediately after NamedTemporaryFile creates the file, before json.dump
and temporary.write execute. Keep the existing finally cleanup and atomic
replace behavior unchanged.

---

Nitpick comments:
In `@examples/taxonomy-classification/tests/test_catalog_agent.py`:
- Line 13: Update the catalog_agent import in test_catalog_agent.py to use the
package-level from taxonomy_classification import catalog_agent form, removing
the redundant self-alias while preserving all existing references.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 67140d46-2165-44f9-9c66-70d34a5ddba6

📥 Commits

Reviewing files that changed from the base of the PR and between 520c1e1 and beba7a6.

📒 Files selected for processing (2)
  • examples/taxonomy-classification/taxonomy_classification/catalog_agent.py
  • examples/taxonomy-classification/tests/test_catalog_agent.py

@svonava svonava added the coderabbit-direct Opt in CodeRabbit for direct examples and root README changes label Aug 3, 2026
@svonava
svonava merged commit 6f36be8 into main Aug 3, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

coderabbit-direct Opt in CodeRabbit for direct examples and root README changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant