price-tag-extraction / config.json
raphael0202's picture
Update JSON schema
6558776 verified
Raw
History Blame
10.3 kB
{
"instructions": "Here is one picture containing a price label, extract the required information from it.",
"json_schema": {
"$defs": {
"DiscountType": {
"enum": [
"QUANTITY",
"SALE",
"SEASONAL",
"LOYALTY_PROGRAM",
"EXPIRES_SOON",
"PICK_IT_YOURSELF",
"SECOND_HAND",
"OTHER",
"NO_DISCOUNT"
],
"title": "DiscountType",
"type": "string"
},
"LabelPrice": {
"description": "One of the prices displayed on a price tag.\n\nFor raw products (without barcode), if the price is indicated per weight\nbut is not per kilogram (example: per 100g or per 500g), the price per\nkilogram should be calculated.",
"properties": {
"price": {
"description": "Price in the local currency",
"title": "Price",
"type": "number"
},
"with_vat": {
"description": "True if the price includes VAT (Value Added Tax), false otherwise. If there is no VAT in the country, set to false. In most cases, this should be set to true.",
"title": "With Vat",
"type": "boolean"
},
"currency": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "Currency of the price. Set to null if unknown. Examples: 'EUR', 'USD', 'GBP'",
"title": "Currency"
},
"price_per": {
"$ref": "#/$defs/Unit",
"description": "Unit of the price. Can be one of: KILOGRAM: price is per kg, only if type = CATEGORY; LITER: price is per liter, only if type = CATEGORY; UNIT: price is per unit (available for both CATEGORY and PRODUCT types)"
},
"price_is_discounted": {
"description": "true if this particular price entry is a discounted price, false otherwise",
"title": "Price Is Discounted",
"type": "boolean"
},
"discount_type": {
"$ref": "#/$defs/DiscountType",
"description": "The type of discount applied to the price, if any. If no discount is applied, this should be set to NO_DISCOUNT. Possible discount types are: - QUANTITY: example: buy 1 get 1 free, - SALE: example: 50% off, - SEASONAL: example: Christmas sale, - LOYALTY_PROGRAM: example: 10% off for members, - EXPIRES_SOON: example: 30% off expiring soon, - PICK_IT_YOURSELF: example: 5% off for pick-up, - SECOND_HAND: example: second hand books or clothes, - OTHER: other types of discounts."
},
"uncertain": {
"description": "true if the price is uncertain: 1) if the price is occluded (even partially), or blurred, 2) if there is a reflection preventing accurate price reading, 3) if the image quality is not good enough to read the price. Otherwise, the value must be false.",
"title": "Uncertain",
"type": "boolean"
}
},
"required": [
"price",
"with_vat",
"currency",
"price_per",
"price_is_discounted",
"discount_type",
"uncertain"
],
"title": "LabelPrice",
"type": "object"
},
"Unit": {
"enum": [
"KILOGRAM",
"LITER",
"UNIT"
],
"title": "Unit",
"type": "string"
}
},
"description": "A label (also called price tag) indicates in a store the price of the\nproduct and possibly other information such as the category, price per kg,\norigins, etc.\n\nWe distinguish between two types of labels:\n\n- Labels for packaged products, with barcode (type: PRODUCT): these are\nproducts that have a barcode, which is usually displayed on the price tag.\nFor this type of label, the category and origins should be set to null.\n- Raw products, without barcode (type: CATEGORY): these are usually fruits\nand vegetables, but it can also be any product sold per weight (kg, 100g,\netc.). For this type of label, the category should be set to the\ncorresponding category, the origins should be set to the countries of\norigin of the product (if indicated) and the barcode should be null.",
"properties": {
"type": {
"anyOf": [
{
"enum": [
"PRODUCT",
"CATEGORY"
],
"type": "string"
},
{
"type": "null"
}
],
"description": "The type of product the label is referring to. It should be `PRODUCT` for packaged products with barcode, and `CATEGORY` for raw products without barcode. If the type is unknown, this should be set to null.",
"title": "Type"
},
"category": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "The category of the product. If type=CATEGORY, this should be set to the category of the product, such as Apples, Bananas, Tomatoes, etc. The category must be in English, even if the category is displayed in another language on the price tag. The category must be the most precise category possible: for example, if the label says 'Red Onions', category should be 'Red onions', and not 'Onions'. If more than one category is present on the price tag, only the first category should be considered, and `has_multiple_categories` should be set to true. If unknown, or if TYPE=PRODUCT, this should be set to null.",
"title": "Category"
},
"has_multiple_categories": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"description": "If type is CATEGORY: if more than one category is present on the price tag, this should be true, false otherwise. If type is PRODUCT: it should be null",
"title": "Has Multiple Categories"
},
"prices": {
"description": "All prices found on the label. Depending on the type of price tag, there can be multiple prices displayed. For packaged products (type=PRODUCT), the price per unit is the most common one. The price per kg is also often included. For raw products (type=CATEGORY), the price per kg is the most common one. There can also be a discount applied to the price. In such a case, both the original price and the discounted price should be included in the list.",
"items": {
"$ref": "#/$defs/LabelPrice"
},
"title": "Prices",
"type": "array"
},
"origins": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"description": "The countries of origin of the product, in English. If type=PRODUCT, this should be set to null. If type=CATEGORY, this should be set to the countries of origin of the product, such as [\"France\"], [\"Italy\"], [\"Spain\"], etc. Most of the time, there is only one country of origin indicated on the label, but sometimes there can be multiple countries (for example: 'France and Spain'), in which case all countries should be included in the list. If type=CATEGORY and the origin is unknown, it should be set to null.",
"title": "Origins"
},
"organic": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"description": "true if the product is organic, false otherwise. If true, there should be evidence on the label suggesting that the product is organic, such as the EU organic logo or other recognized organic certifications. If the organic status is unknown, it should be set to null.",
"title": "Organic"
},
"barcode": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "The barcode of the product, if available. The barcode is usually a number with 13 (EAN13) or 8 (EAN8) digits. You should *NOT* try to decode the barcode stripe (also called modules), but use the barcode number displayed on the label. If type=CATEGORY, this should be null.",
"title": "Barcode"
},
"product_name": {
"description": "The name of the product, as displayed on the label. For raw products (type=CATEGORY), this is usually the name of the fruit or vegetable. For products with barcode (type=PRODUCT), it usually includes the brand, a short description of the product, and optionally the quantity. If no product name is displayed on the label, this should be an empty string. examples: 'NOCCIOLATA BIO 650G', 'Simpson Donuts', 'GERBLE BISCUIT PIST ABRICOT160G', 'Radis Blanc', 'Concombre lisse', 'Courget Butternut', 'Tomatoes', 'Organic Bananas'",
"title": "Product Name",
"type": "string"
},
"uncertain_barcode_or_product_name": {
"description": "true if the barcode (for type=PRODUCT) or category (for TYPE=CATEGORY) is uncertain: 1) if the barcode (respectively the product name) is occluded (even partially), or blurred,2) if there is a reflection preventing accurate reading, 3) if the image quality is not good enough to read the barcode (respectively the product name). Otherwise, the value must be false.",
"title": "Uncertain Barcode Or Product Name",
"type": "boolean"
},
"is_price_tag": {
"description": "indicates whether the image shows a physical price tag attached to a product. For example, if the image seems to come from a receipt or a catalogue (or is a random image), this should be set to false.",
"title": "Is Price Tag",
"type": "boolean"
}
},
"required": [
"type",
"category",
"has_multiple_categories",
"prices",
"origins",
"organic",
"barcode",
"product_name",
"uncertain_barcode_or_product_name",
"is_price_tag"
],
"title": "Label",
"type": "object"
}
}