Catalog
Catalog(self, description, batchSize=10000, model=None, processor=None, tokenizer=None)
Represents a collection of products by one or more brands.
Attributes
Name | Type | Description |
---|---|---|
productVibes | ProductVibes | Object containing product vibes. |
model | PreTrainedModel | Pre-trained model for embeddings. |
processor | ProcessorMixin | Processor for handling inputs. |
tokenizer | PreTrainedTokenizer | Tokenizer for processing text inputs. |
Methods
Name | Description |
---|---|
Pack | Pack Catalog object using FlatBuffers. |
addProduct | Add a product to the Catalog. |
addProductCategory | Add a product category to the Catalog. |
addProductVibe | Add a product vibe to the Catalog. |
renderProductFlatBatch | Render product embeddings in flat batch format. |
to_hcf | Convert Catalog object to HCF file format. |
Pack
Catalog.Pack(builder)
Pack Catalog object using FlatBuffers.
Parameters
Name | Type | Description | Default |
---|---|---|---|
builder |
flatbuffers.Builder | FlatBuffer builder object. | required |
Returns
Type | Description |
---|---|
int | Offset of the packed Catalog object. |
addProduct
Catalog.addProduct(p)
Add a product to the Catalog.
Parameters
Name | Type | Description | Default |
---|---|---|---|
p |
Product | Product object to add. | required |
addProductCategory
Catalog.addProductCategory(c)
Add a product category to the Catalog.
Parameters
Name | Type | Description | Default |
---|---|---|---|
c |
Category | Category object to add. | required |
addProductVibe
Catalog.addProductVibe(v)
Add a product vibe to the Catalog.
Parameters
Name | Type | Description | Default |
---|---|---|---|
v |
Vibe | Vibe object to add. | required |
renderProductFlatBatch
Catalog.renderProductFlatBatch()
Render product embeddings in flat batch format.
to_hcf
Catalog.to_hcf(filename)
Convert Catalog object to HCF file format.
Parameters
Name | Type | Description | Default |
---|---|---|---|
filename |
str | Name of the HCF file. | required |