Google 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는 두 가지 옵션을 제공합니다.
톤 목록에서 선택하여 새 설명을 생성할 수 있습니다. 목록에는 다음 어조 스타일이 포함됩니다.
- 기본값
- 장난
- 정중하게
- 설득력 있음
- 대화형
브랜드의 어조로 기존 설명이나 기타 텍스트 애셋을 제공할 수 있습니다. LLM은 텍스트의 어조를 분석하고 다음 측면에 따라 '글쓰기 스타일 설명자'를 생성합니다.
- 높임말 정도 (예: 격식체, 비격식체)
- 상세 출력 (예: 간결함, 매우 장황함)
- 어조 (예: 전문적, 유익, 긍정적, 설득력)
- 문장 구조 (예: '접속사가 적은 간단한 문장')
- 가장 자주 사용되는 단어 및 구문