📋/filter-search-results

Available at https://api.theproductllm.com/filter-search-results

/filter-search-results is part of our AI-only search process; it provides an AI call that removes non-matches from a set of product search results.

Product descriptions in e-commerce search results are usually limited, but they can be used in this function to filter out definite non-matching results. This endpoint returns candidates.

To get matching products, the next steps are to visit candidate pages and match using product page data.

Required Parameters

  • product: dict. Provide a JSON object of your product with key value pairs such as {'title':'value'}. You must define the product title under the 'title' key. You can specify familiar or unfamiliar keys. Familiar keys such as 'code', 'brand', 'description', and 'price' will be added under their own key value pair. All other key value pairs will be added to the 'description' key value pair. See guidelines for input data.

  • results: List[ProductCandidate] or List[AmazonResultItem]

ProductCandidate
{
    link: str
    product: {
        title: str
        brand: Optional[str]
        code: Optional[str] 
        description: Optional[Union[str,dict]] 
        id: Optional[str] 
        price: Optional[Union[str, float]]
    }
}
AmazonResultItem
{
  asin: string
  summaries: [
    {
      marketplaceId: string
      brandName: string
      browseNode: string
      itemName: string
      ...
    }
  ]
}

Optional Parameters

  • result_type: (optional) either "amazon" for AmazonResultItem or "default" for ProductCandidate. default is chosen if left empty

Request

import requests
response = requests.post(
    "https://api.theproductllm.com/filter-search-results",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={
      "product": {
        "title": "Sony WH-1000XM5 Headphones",
        "brand": "Sony"
      },
      "results": [
        {
          "product": {
            "title": "Sony WH-1000XM5 Wireless Headphones",
            "brand": "Sony"
          },
          "link": "https://www.amazon.com/example1"
        },
        {
          "product": {
            "title": "Bose QuietComfort 45",
            "brand": "Bose"
          },
          "link": "https://www.amazon.com/example2"
        }
      ]
    }
)
print(response.json())

Response

{
    "candidates": [
        {
            "link": "https://www.amazon.com/example1",
            "listing_id": null,
            "product": {
                "title": "Sony WH-1000XM5 Wireless Headphones",
                "brand": "Sony",
                "code": null,
                "description": null,
                "id": null,
                "price": null
            }
        }
    ]
}

Last updated