ตำราอาหาร

คุณสามารถใช้ API ของเราเพื่อสร้างชื่อและรายละเอียดผลิตภัณฑ์โดยใช้ข้อมูลผลิตภัณฑ์ที่มีอยู่ API ยอมรับข้อมูลต่อไปนี้

  • พจนานุกรม JSON ที่ไม่บังคับซึ่งมีแอตทริบิวต์ผลิตภัณฑ์ เช่น {"brand": "MyBrand", "title": "White Tee", "size": "XL"}
  • รูปภาพผลิตภัณฑ์ที่ไม่บังคับ เช่น {"uri": "https://my-store.com/img/1.png"}
  • ตัวเลือกการจัดรูปแบบชื่อ เช่น attribute_separator, target_language, attribute_order
  • ตัวอย่างการติดป้ายกำกับข้อมูล (ดูด้านล่าง)

ก่อนอื่นให้ตั้งค่าข้อกำหนดเบื้องต้น

import requests
API_KEY=""
API_ENDPOINT=""

เร่งการสร้างผลิตภัณฑ์โดยรับชื่อที่แนะนำจากรูปภาพเพียงอย่างเดียว

my_product_image = 'https://cdn.shopify.com/s/files/1/0653/5879/0892/products/1672082339438_550x825.jpg?v=1672082415'

payload = {}
payload |= {'output_spec': {'workflow_id': 'title', 'attribute_separator': '-'}}
payload |= {'product_info':{}}
payload['product_info'] |= {'product_image':{'uri': my_product_image}}

response = requests.post(API_ENDPOINT, params={'key': API_KEY}, json=payload)
suggested_title = response.json()['title']['text']
print(suggested_title)
Rustic Ceramic & Leather Leaves Necklace

สร้างผลิตภัณฑ์ได้เร็วขึ้นโดยรับชื่อที่แนะนำจากคำอธิบาย

หากขั้นตอนการสร้างผลิตภัณฑ์แจ้งให้ผู้ใช้ระบุรูปภาพและคำอธิบายสั้นๆ คุณสามารถใช้รูปแบบต่อไปนี้เพื่อแนะนำชื่อผลิตภัณฑ์แก่ผู้ใช้

my_product_description = 'selling size 12 nike dunks. oh they are red by the way!'

payload = {}
payload |= {'output_spec': {'workflow_id': 'title'}}
payload |= {'product_info':{'product_attributes': {'description': my_product_description}}}

response = requests.post(API_ENDPOINT, params={'key': API_KEY}, json=payload)
print(response.json()['title']['text'])
Nike Dunks Red Size 12

สร้างผลิตภัณฑ์ได้เร็วขึ้นโดยรับชื่อที่แนะนำจากชื่อและคำอธิบาย

ในตัวอย่างนี้ เราติดป้ายกำกับแอตทริบิวต์ผลิตภัณฑ์ที่ต้องการให้ AI ระบุอย่างชัดเจน

title = 'Volumizing & Lengthening Mascara - Dark Brown'
description = "This high-impact mascara delivers both voluptuous volume and dramatic length without clumping or smudging."

payload = {}
payload |= {'output_spec': {'workflow_id': 'title'}}
payload |= {'product_info':{'product_attributes': {'title': title, 'description': description, 'brand': 'Luxe Beauty'}}}
payload |= {
  "title_examples": [
    {
      "product_info": {
        "title": "Lash Paradise Volumizing & Lengthening Mascara - Waterproof - Blackest Black",
        "colour": "Black"
      },
      "title_format": "product",
      "category": "mascara",
      "final_product_info": {
        "product": "Mascara",
        "brand": "Lash Paradise",
        "mascara_type": "Volumizing & Lengthening",
        "colour": "Blackest Black",
        "waterproof": "Waterproof",
      }
    },
    {
      "product_info": {
        "title": "Hypnose Drama Instant Full Body Volume Mascara - Black",
        "colour": "Black"
      },
      "title_format": "product",
      "category": "mascara",
      "final_product_info": {
        "product": "Mascara",
        "brand": "Hypnose",
        "sub_brand": "Drama",
        "mascara_type": "Full Body Volume",
        "colour": "Black",
        "eye_lash_type": "All lash types"
      }
    }
  ]
}

response = requests.post(API_ENDPOINT, params={'key': API_KEY}, json=payload)
print(response.json())
{
  "title": {
    "text": "Luxe Beauty Dark Brown Volumizing & Lengthening Mascara"
  },
  "metadata": {
    "metadata": {
      "attributes": {
        "brand": "Luxe Beauty",
        "colour": "Dark Brown",
        "mascara_type": "Volumizing & Lengthening",
        "product": "Mascara"
      },
    }
  }
}

เร่งการสร้างผลิตภัณฑ์โดยรับคำอธิบายที่แนะนำจากชื่อ

หากขั้นตอนการสร้างผลิตภัณฑ์แจ้งให้ผู้ใช้ระบุรูปภาพและชื่อ คุณสามารถ ใช้รูปแบบต่อไปนี้เพื่อแนะนำรายละเอียดผลิตภัณฑ์แก่ผู้ใช้

my_product_title = 'Rustic Ceramic & Leather Leaves Necklace'

payload = {}
payload |= {'output_spec': {'workflow_id': 'description'}}
payload |= {'product_info':{'product_attributes': {'title': my_product_title}}}

response = requests.post(API_ENDPOINT, params={'key': API_KEY}, json=payload)
print(response.json()['description']['text'])
Rustic Ceramic & Leather Leaves Necklace is a beautiful necklace made from high-quality ceramic and leather. It features a unique design that is sure to turn heads.

เร่งการสร้างผลิตภัณฑ์โดยรับทั้งชื่อและคำอธิบายจากยี่ห้อและสี

โปรดสังเกตว่าในตัวอย่างนี้ เราตั้งค่า workflow_id เป็น "tide" เพื่อให้ได้ทั้งชื่อ และคำอธิบาย

payload = {}
payload |= {'output_spec': {'workflow_id': 'tide'}}
payload |= {'product_info':{'product_attributes': {'brand': 'Mr. Beast', 'color': 'purple'}}}
payload['product_info'] |= {'product_image':{'uri':'https://mrbeast.store/cdn/shop/files/0015dlv_0000_327.jpg?v=1702754475&width=500'}}

response = requests.post(API_ENDPOINT, params={'key': API_KEY}, json=payload)
print(response.text)
{
  "title": {
    "text": "Pajamas - Mr. Beast | Purple"
  },
  "description": {
    "text": "Slip into the ultimate comfort and style with these Mr. Beast pajamas in a vibrant shade of purple. Crafted from the softest materials, these pajamas will envelop you in a cozy embrace, ensuring a restful night's sleep. The shorts feature a relaxed fit, allowing for easy movement, while the top boasts a classic design with a comfortable neckline. Whether you're lounging at home or drifting off to dreamland, these Mr. Beast pajamas are the perfect choice for a peaceful and stylish slumber."
  },
}

การรองรับภาษาเป้าหมาย

ฟิลด์นี้ระบุภาษาของข้อความคำอธิบายที่สร้างขึ้นในการตอบกลับของ API โดยจะเพิ่มเป็นส่วนหนึ่งของพารามิเตอร์ output_spec

{"output_spec": {"target_language": "language"}}

ค่าตัวอย่าง

"korean" (Korean)
"english" (English)
"spanish" (Spanish)
"french" (French)
"pirate" (Pirate)

ตัวอย่าง JSON สำหรับเพย์โหลด

title = "Granos de café negro"
description = "Los granos de café negro en California"

payload = {}
payload |= {"output_spec":
  {
    "workflow_id": "description",
    "target_language":"japanese", # specify language here
    "attribute_order": ["scent", "product"],
    "tone":"playful"}
}
payload |= {"product_info":{"product_attributes": {"description": description, "brand": "Parfums de Paris", "scent": "Floral"}}}

ตัวอย่างเอาต์พุต

{
  "description": {
    "text": "カリフォルニアの黒いコーヒー豆は、あなたの鼻をくすぐる、甘く、フローラルな香りです。この香りは、コーヒー豆の豊かな香りと、ジャスミンとバラの繊細な花の香りをブレンドしたものです。カリフォルニアの黒いコーヒー豆は、あなたの家を居心地の良いカフェに変え、あなたをリラックスした気分にさせてくれるでしょう。この香りは、コーヒー好きにも、フローラルな香り好きにも最適です。カリフォルニアの黒いコーヒー豆で、あなたの家を幸せな香りで満たしましょう!"
  }
}

การป้อนรหัสภาษาที่ไม่ถูกต้องอาจทำให้เกิดข้อผิดพลาด

หากระบบไม่รองรับภาษาหรือค่า ข้อความคำอธิบายจะเป็นภาษาอังกฤษโดยค่าเริ่มต้น

การปรับเปลี่ยนโทนเสียงให้เหมาะกับผู้ใช้สำหรับการสร้างคำอธิบาย

คุณปรับเปลี่ยนน้ำเสียงของคำอธิบายที่สร้างขึ้นได้เพื่อช่วยสร้างแบรนด์และสร้างความแตกต่างให้ร้านค้าออนไลน์ของคุณจากร้านอื่นๆ Text API มีตัวเลือก 2 แบบดังนี้

คุณเลือกจากรายการโทนเสียงเพื่อสร้างคำอธิบายใหม่ได้ รายการ มีรูปแบบน้ำเสียงต่อไปนี้

  • ค่าเริ่มต้น
  • ขี้เล่น
  • เป็นทางการ
  • โน้มน้าวใจ
  • สนทนา

คุณระบุคำอธิบายที่มีอยู่หรือชิ้นงานข้อความอื่นๆ ในน้ำเสียงของแบรนด์ได้ LLM จะวิเคราะห์น้ำเสียงของข้อความและสร้าง "ตัวอธิบายรูปแบบ การเขียน" ตามลักษณะต่อไปนี้

  • ระดับความเป็นทางการ (เช่น เป็นทางการ ไม่เป็นทางการ)
  • การพูดรายละเอียด (เช่น กระชับ ละเอียดมาก)
  • โทนเสียง (เช่น เป็นมืออาชีพ ให้ข้อมูล เป็นบวก โน้มน้าว)
  • โครงสร้างประโยค (เช่น "simple sentence with few conjunctions")
  • คำและวลีที่ใช้บ่อยที่สุด