আপনি উপলব্ধ পণ্যের তথ্য ব্যবহার করে পণ্যের শিরোনাম এবং বিবরণ তৈরি করতে আমাদের 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.
একটি ব্র্যান্ড এবং রঙ থেকে একটি শিরোনাম এবং একটি বিবরণ পেয়ে পণ্য তৈরির গতি বাড়ান৷
লক্ষ্য করুন কিভাবে এই উদাহরণে আমরা শিরোনাম এবং বিবরণ উভয়ই পেতে "tide"
এ workflow_id
সেট করেছি।
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": "カリフォルニアの黒いコーヒー豆は、あなたの鼻をくすぐる、甘く、フローラルな香りです。この香りは、コーヒー豆の豊かな香りと、ジャスミンとバラの繊細な花の香りをブレンドしたものです。カリフォルニアの黒いコーヒー豆は、あなたの家を居心地の良いカフェに変え、あなたをリラックスした気分にさせてくれるでしょう。この香りは、コーヒー好きにも、フローラルな香り好きにも最適です。カリフォルニアの黒いコーヒー豆で、あなたの家を幸せな香りで満たしましょう!"
}
}
একটি ভুল ভাষা কোড লিখলে একটি ত্রুটি হতে পারে।
ভাষা বা মান সমর্থিত না হলে, বর্ণনা পাঠ্য ইংরেজিতে ডিফল্ট হবে।
বর্ণনা জেনারেশনের জন্য ভয়েস ব্যক্তিগতকরণের টোন
আপনার ব্র্যান্ড প্রতিষ্ঠা করতে এবং আপনার অনলাইন স্টোরকে অন্যদের থেকে আলাদা করতে সাহায্য করতে, আপনি আপনার তৈরি করা বর্ণনার স্বরকে ব্যক্তিগতকৃত করতে পারেন। পাঠ্য API দুটি বিকল্প অফার করে:
আপনি নতুন বর্ণনা তৈরি করতে টোনগুলির একটি তালিকা থেকে নির্বাচন করতে পারেন। তালিকায় এই টোন শৈলীগুলি অন্তর্ভুক্ত রয়েছে:
- ডিফল্ট
- কৌতুকপূর্ণ
- আনুষ্ঠানিক
- প্ররোচিত
- কথোপকথনমূলক
আপনি আপনার ব্র্যান্ডের কণ্ঠস্বরে বিদ্যমান বিবরণ বা অন্যান্য পাঠ্য সম্পদ প্রদান করতে পারেন। এলএলএম পাঠ্যের স্বর বিশ্লেষণ করবে এবং এই দিকগুলি অনুসারে একটি "লেখার শৈলী বর্ণনাকারী" তৈরি করবে:
- আনুষ্ঠানিকতা (যেমন, আনুষ্ঠানিক, নৈমিত্তিক)
- শব্দভাষা (যেমন, সংক্ষিপ্ত, খুব শব্দবাচক)
- স্বর (যেমন, পেশাদার, তথ্যপূর্ণ, ইতিবাচক, প্ররোচিত)
- বাক্যের গঠন (যেমন, "কিছু সংযোজন সহ সরল বাক্য")
- সবচেয়ে ঘন ঘন ব্যবহৃত শব্দ এবং বাক্যাংশ