Repository navigation
catalog_ids: rank several catalogs together - #53
Merged
Merged
Conversation
complete, sections and similar_items take catalog_ids instead of catalog_id to rank up to 5 catalogs as one, e.g. your own next to retail_catalog. Every Item now has catalog_id, from the response or the request's catalog, since an id is unique only within its catalog. History events name their item's catalog with catalog_id=, or take an Item of a response, which knows its own; an order of items from several catalogs is sent as one order per catalog. In filters, catalog_id is the item's catalog. An item that names a catalog the request does not read is refused before anything is sent. Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ranks several catalogs together, on unbox-api's new
x-catalog-ids(unbox-api#594).complete,sectionsandsimilar_items, sync and async, takecatalog_ids=[...]in place ofcatalog_id. The first catalog is the request's own.Item.catalog_idis always filled: the catalog the item comes from, also with a single catalog.View("a0", catalog_id="outlet"),CartItem("a0", 1, catalog_id="outlet"). They also accept anItem, which brings its catalog along, so a result can go straight back into a history. An event without one is in the first catalog.similar_items(item, catalog_id=..., catalog_ids=[...])finds products like one catalog's item across all of them.similar_itemsalso takesfiltersnow.catalog_idfilter picks one catalog's products.CartItemis exported at the top level, so an order line can name its catalog.UNBOXAI_CATALOG_IDsets the default catalog, so calls need nocatalog_id. An explicitdefault_catalog_id=still wins, and without either it staysretail_catalog.Passing both
catalog_idandcatalog_ids(except forsimilar_items), an empty list, or a plain string is aValueErrorthat says what to pass instead.The README and
docs/catalogs.md("Several catalogs at once") document it. Tests:tests/test_multi_catalog.py, 14 tests; 188 passed in all. Ruff is clean and mypy is at its baseline.Insights needs this released (behaviorgpt-insights-app#1); the version is not bumped here.