Product Attribute Levels

POST

Generate product levels based on attributes and pricing information.

This endpoint uses Perplexity API to process the input to generate a list of attributes that define the product, generates pricing levels (brand & price pair), and creates levels for the provided attributes per brand/product.

Parameters:

  • req: ProductAttributeRequest object containing:
    • why_prompt: The main question or prompt for the product
    • country: Target country for pricing and attributes
    • attribute_count: Number of attributes to generate (optional)
    • level_count: Number of levels per attribute to generate (optional)

Returns:

  • List of LeveledAttributeBase objects, each containing:
    • attribute: An Attribute object with:
      • name: The name of the attribute
    • levels: List of strings representing the different levels or options for the attribute

Example Response:

1[
2 {
3 "attribute": {
4 "name": "Brands"
5 },
6 "levels": ["Tesla Model 3", "Ford Mustang Mach-E", "Volkswagen ID.4"]
7 },
8 {
9 "attribute": {
10 "name": "Price"
11 },
12 "levels": ["38000 USD", "42000 USD", "46000 USD", "50000 USD", "54000 USD"]
13 }
14]

Raises:

  • HTTPException 404: If an error occurs during the processing of product levels

Note:

  • The number of attributes and levels may vary based on the input parameters and product complexity
  • This function runs attribute generation and price level generation concurrently for efficiency

Request

This endpoint expects an object.
why_promptstringRequired
countrystringRequired
attribute_countintegerOptional>=2<=10Defaults to 7
level_countintegerOptional>=2<=10Defaults to 5

Response

Successful Response

attributestring
levelslist of strings