in experiments/legacy/backend/api.py [0:0]
def suggest_attributes(product: Product) -> dict[str,str]:
"""Suggests attributes for product.
Args:
- description: Sparse description of product
- category (optional): If provided will only consider products in the same
category for attributes grounding. Supports partial categories as well.
Experiment with passing different levels of categories for exploration vs.
exploitation trade-off.
- main_image_base64 (optional): base64 encoded string representing product
image.
Returns:
JSON dictionary representing attributes as key value pairs e.g.
{'color':'green', 'pattern': 'striped'}
"""
return attributes.retrieve_and_generate_attributes(
product.description,
product.category,
product.main_image_base64,
base64=True,
filters=product.category)