/v1/batch/filter-search-results

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

Processes batch filtering of search results to identify potential product matches.

This endpoint is part of the AI-only search process. It provides batch AI calls that remove non-matches from sets 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

  • file: JSONL file upload. Each line must be a valid JSON object with the following structure:

{
  "product": {
    "title": "string (required)",
    "brand": "string (optional)",
    "code": "string (optional)",
    "description": "string or dict (optional)",
    "id": "string (optional)",
    "price": "string or float (optional)"
  },
  "results": [
    {
      "product": {
        "title": "string (required)",
        "brand": "string (optional)",
        "code": "string (optional)",
        "description": "string or dict (optional)",
        "id": "string (optional)",
        "price": "string or float (optional)"
      },
      "link": "string (required)"
    }
  ]
}

Optional Parameters (per line in JSONL)

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

AmazonResultItem Format

If using `result_type: "amazon"`, each result should have this structure:

{
  "asin": "string",
  "summaries": [
    {
      "marketplaceId": "string",
      "brandName": "string",
      "browseNode": "string",
      "itemName": "string"
      ...
    }
  ]
}

Request

import requests
with open('filter_requests.jsonl', 'rb') as f:
    response = requests.post(
        "https://api.theproductllm.com/v1/batch/filter-search-results",
        headers={"Authorization": "Bearer YOUR_API_KEY"},
        files={"file": f}
    )
print(response.json())

Example filter_requests.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"}], "stop_at_candidate_count": 5}
{"product": {"title": "Apple AirPods Pro", "brand": "Apple"}, "results": [{"product": {"title": "AirPods Pro 2nd Gen", "brand": "Apple"}, "link": "https://www.amazon.com/example3"}], "result_type": "default"}

Response

{
  "job_id": "550e8400-e29b-41d4-a716-446655440001",
  "total_rows": 2,
  "tokens": 12000,
  "message": "Batch inference job submitted successfully. Processing 2 filter requests.",
}

Last updated