אתם יכולים להשתמש ב-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 למטען ייעודי (payload)
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 מציע שתי אפשרויות:
אפשר לבחור מתוך רשימה של סגנונות כדי ליצור תיאורים חדשים. הרשימה כוללת את סגנונות הטון הבאים:
- ברירת מחדל
- שובבות
- רשמי
- משכנע
- שיחה
אתם יכולים לספק תיאורים קיימים או נכסי טקסט אחרים בסגנון הכתיבה של המותג. מודל ה-LLM ינתח את הטון של הטקסט וייצור 'תיאור של סגנון הכתיבה' בהתאם להיבטים הבאים:
- רמת הנימוס (למשל, רשמית, לא רשמית)
- רמת המלל (למשל, תמציתי, מפורט מאוד)
- גוון (למשל, מקצועי, אינפורמטיבי, חיובי, משכנע)
- מבנה המשפט (למשל, 'משפט פשוט עם מעט מילות קישור')
- המילים והביטויים הנפוצים ביותר