สร้างคำแนะนำข้อความ

Text Suggestions API ใช้ประโยชน์จากเครื่องมือ Generative AI ของ Product Studio API เพื่อสร้างและเพิ่มประสิทธิภาพชื่อและคำอธิบายผลิตภัณฑ์ คุณสามารถใช้เครื่องมือนี้เพื่อปรับปรุงการมีส่วนร่วมของลูกค้าและ Conversion รวมถึงปรับปรุงกระบวนการจัดการและอัปเดตข้อมูลสินค้าให้มีประสิทธิภาพยิ่งขึ้น ฟีเจอร์ของ Product Studio API จะช่วยเพิ่มประสิทธิภาพการค้าปลีกได้

คุณสร้างอะไรได้บ้างโดยใช้ API

Text Suggestions API ช่วยให้คุณทำสิ่งต่อไปนี้ได้

  • ชื่อและรายละเอียดสินค้าที่แนะนำโดยอิงตามรูปภาพสินค้าและ/หรือคุณสมบัติของสินค้า
  • ชื่อที่เพิ่มประสิทธิภาพ SEO สำหรับผลิตภัณฑ์
  • ชื่อที่จัดรูปแบบเองสำหรับผลิตภัณฑ์
  • รายละเอียดสินค้าจากฟีดสินค้า

นอกจากนี้ คุณยังระบุโทนเสียงสำหรับคำอธิบายและรักษาความสอดคล้องกันในข้อมูลผลิตภัณฑ์ทั้งหมดที่แสดงได้ด้วย

คู่มือเริ่มใช้งานฉบับย่อ

เมธอด GenerateProductTextSuggestions สามารถสร้างหรือเพิ่มประสิทธิภาพชื่อและรายละเอียดสินค้าโดยใช้ข้อมูลสินค้า

API ยอมรับข้อมูลต่อไปนี้

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

ตัวอย่าง

ต่อไปนี้เป็นตัวอย่างการใช้ API เพื่อสร้างหรือเพิ่มประสิทธิภาพชื่อหรือรายละเอียด หรือทั้ง 2 อย่างจากอินพุตข้อมูลผลิตภัณฑ์ที่แตกต่างกัน นอกจากนี้ เรายังแสดงข้อผิดพลาดและปัญหาที่พบได้ทั่วไปพร้อมวิธีแก้ไขด้วย

การสร้างชื่อที่เพิ่มประสิทธิภาพ

ตัวอย่างนี้แสดงวิธีสร้างชื่อที่เหมาะสมที่สุด

ส่งคำขอ

เนื้อหาของคำขอมีข้อมูลสินค้าที่จะใช้สำหรับการเพิ่มประสิทธิภาพชื่อ ตัวอย่างโครงสร้างคำขอมีดังนี้

POST https://merchantapi.googleapis.com/productstudio/v1alpha/accounts/{ACCOUNT_ID}:generateProductTextSuggestions
{
   "product_info": {
      "product_attributes": {
         "title": "Nike Mens shoes",
         "description": "Give strength to your step with the Nike Air Zoom Pegasus 38 shoe for Men with shoe size 12. Ensuring the fit is loved by the runners. This shoes comes in Blue color.",
         "brand": "Nike"
      }
   },
   "output_spec": {
      "workflow_id": "title"
   }
}

คำตอบ

คุณจะได้รับการตอบกลับในลักษณะต่อไปนี้

{
  "title": {
    "text": "Nike Mens shoes Air Zoom Pegasus 38 Running Shoes, Blue, Size 12"
  },
  "metadata": {
    "metadata": {
      "attributes": {
        "color": "Blue",
        "size": "12",
        "product": "Running shoes",
        "model": "Air Zoom Pegasus 38"
      },
    }
  }
}

สร้างชื่อจากรูปภาพเท่านั้น

ตัวอย่างแสดงวิธีระบุรูปภาพสินค้าและสร้างชื่อที่เหมาะสมที่สุด

ส่งคำขอ

POST https://merchantapi.googleapis.com/productstudio/v1alpha/accounts/{ACCOUNT_ID}:generateProductTextSuggestions
{
   "product_info": {
      "product_image":{
         "uri": "https://cdn.shopify.com/s/files/1/0653/5879/0892/products/1672082339438_550x825.jpg?v=1672082415"
      }
   },
   "output_spec": {
      "workflow_id": "title",
      "attribute_separator": "-"
   }
}

คำตอบ

{
  "title": {
    "text": "Rustic Ceramic & Leather Leaves Necklace"
  },
  "metadata": {
    "metadata": {
      "attributes": {
        "material": "Rustic Ceramic & Leather",
        "pattern": "Leaves",
        "product": "Necklace"
      },
    }
  }
}

สร้างชื่อจากคำอธิบาย

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

ส่งคำขอ

POST https://merchantapi.googleapis.com/productstudio/v1alpha/accounts/{ACCOUNT_ID}:generateProductTextSuggestions
{
   "product_info": {
      "product_attributes": {
         "description": "selling size 12 nike dunks. oh they are red by the way!"
      }
   },
   "output_spec": {
      "workflow_id": "title",
   }
}

คำตอบ

{
  "title": {
    "text": "Nike Dunks Red Size 12"
  },
  "metadata": {
    "metadata": {
      "attributes": {
        "brand": "Nike",
        "color": "Red",
        "size": "12",
        "product": "Dunks"
      },
    }
  }
}

เพิ่มประสิทธิภาพชื่อจากชื่อและคำอธิบาย (พร้อมตัวอย่างที่กำหนดเอง)

ในตัวอย่างนี้ เราติดป้ายกำกับคุณสมบัติของสินค้าที่ต้องการให้ AI ระบุและลำดับคุณสมบัติในเอาต์พุตอย่างชัดเจน

ส่งคำขอ

POST https://merchantapi.googleapis.com/productstudio/v1alpha/accounts/{ACCOUNT_ID}:generateProductTextSuggestions
{
   "product_info": {
      "product_attributes": {
         "title": "Volumizing & Lengthening Mascara - Dark Brown",
         "description": "This high-impact mascara delivers both voluptuous volume and dramatic length without clumping or smudging.",
         "brand": "Luxe Beauty"
      }
   },
   "output_spec": {
      "workflow_id": "title"
   }
   "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"
      }
    }
  ]
}

คำตอบ

{
  "title": {
    "text": "Luxe Beauty Dark Brown Volumizing & Lengthening Mascara"
  },
  "metadata": {
    "metadata": {
      "attributes": {
        "brand": "Luxe Beauty",
        "colour": "Dark Brown",
        "mascara_type": "Volumizing & Lengthening",
        "product": "Mascara"
      },
    }
  }
}

สร้างคำอธิบายจากชื่อ

ตัวอย่างนี้แสดงวิธีระบุชื่อผลิตภัณฑ์และขอให้ API สร้างคำอธิบายผลิตภัณฑ์ที่เกี่ยวข้อง

ส่งคำขอ

POST https://merchantapi.googleapis.com/productstudio/v1alpha/accounts/{ACCOUNT_ID}:generateProductTextSuggestions
{
   "product_info": {
      "product_attributes": {
         "title": "Rustic Ceramic & Leather Leaves Necklace",
      }
   },
   "output_spec": {
      "workflow_id": "description"
   }
}

คำตอบ

{
  "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.
"
  },
}

สร้างชื่อและรายละเอียดจากคุณสมบัติของสินค้า (เช่น แบรนด์และสี)

ตัวอย่างนี้แสดงการระบุคุณสมบัติของสินค้าเพื่อสร้างชื่อและรายละเอียดสินค้าที่เหมาะสมที่สุด

ส่งคำขอ

POST https://merchantapi.googleapis.com/productstudio/v1alpha/accounts/{ACCOUNT_ID}:generateProductTextSuggestions
{
   "product_info": {
      "product_attributes": {
         "brand": "Mr. Beast",
         "color": "purple",
      },
      "product_image":{
         "uri": "https://mrbeast.store/cdn/shop/files/0015dlv_0000_327.jpg?v=1702754475&width=500"
       }
   },
   "output_spec": {
      "workflow_id": "description"
   }
}

คำตอบ

{
  "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 คุณสามารถเพิ่ม target_language เป็นส่วนหนึ่งของพารามิเตอร์ output_spec ได้ดังนี้

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

ค่าตัวอย่าง:

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

ตัวอย่างคำขอ

POST https://merchantapi.googleapis.com/productstudio/v1alpha/accounts/{ACCOUNT_ID}:generateProductTextSuggestions
{
   "product_info": {
      "product_attributes": {
         "title": "Granos de café negro",
         "description": "Los granos de café negro en California",
         "brand": "Parfums de Paris",
         "scent": "Floral",
      },
      "product_image":{
         "uri": "https://mrbeast.store/cdn/shop/files/0015dlv_0000_327.jpg?v=1702754475&width=500"
       }
   },
   "output_spec": {
      "workflow_id": "description",
      "target_language": "japanese",
      "attribute_order": ["scent", "product"],
      "tone": "playful",
   }
}

คำตอบ

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

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

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

  • การเลือกโทนเสียงที่กำหนดไว้ล่วงหน้า: คุณสามารถเลือกจากรายการโทนเสียงเพื่อสร้างคำอธิบายใหม่ได้ รายการนี้ประกอบด้วยรูปแบบโทนเสียงต่อไปนี้
    • ค่าเริ่มต้น: เรียบง่าย ชัดเจน และดูดี
    • สนุกสนาน: สบายๆ ใช้ภาษาเชิงบวก อารมณ์ขัน (มุกตลก การเล่นคำ) และการพูดเกินจริง (ไม่มีการประชดประชัน การเสียดสี หรืออีโมจิ)
    • เป็นทางการ: ภาษาอังกฤษมาตรฐาน ไวยากรณ์ที่ถูกต้อง ประโยคที่สมบูรณ์ ไม่มีคำสแลงหรือคำย่อ
    • โน้มน้าวใจ: สมเหตุสมผล กระชับ และเน้นการโต้แย้งเพื่อโน้มน้าวใจผู้อ่าน
    • เป็นกันเอง: เป็นมิตร เข้าใจง่าย และใช้ภาษาที่ใช้ในชีวิตประจำวัน
  • น้ำเสียงเฉพาะของแบรนด์: คุณสามารถระบุคำอธิบายที่มีอยู่หรือชิ้นงานข้อความอื่นๆ ในน้ำเสียงของแบรนด์ได้ โมเดล Generative AI จะวิเคราะห์โทนของข้อความและสร้าง "ข้อบ่งชี้สไตล์การเขียน" ตามแง่มุมต่อไปนี้
    • ระดับความเป็นทางการ (เช่น เป็นทางการ ไม่เป็นทางการ)
    • ความละเอียด (เช่น กระชับ ละเอียดมาก)
    • น้ำเสียง (เช่น เป็นมืออาชีพ ให้ข้อมูล เป็นเชิงบวก โน้มน้าวใจ)
    • โครงสร้างประโยค (เช่น "ประโยคง่ายๆ ที่มีคำสันธานไม่กี่คำ")
    • คำและวลีที่ใช้บ่อยที่สุด

ไลบรารีของไคลเอ็นต์

เราขอแนะนำให้ใช้ไลบรารีของไคลเอ็นต์เพื่อส่งคำขอ เราจะแชร์ไลบรารีของไคลเอ็นต์กับคุณ ซึ่งคุณสามารถติดตั้งในโปรเจ็กต์ Maven ได้

ตัวอย่างโค้ด

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

Java

import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.shopping.merchant.productstudio.v1alpha.GenerateProductTextSuggestionsRequest;
import com.google.shopping.merchant.productstudio.v1alpha.GenerateProductTextSuggestionsResponse;
import com.google.shopping.merchant.productstudio.v1alpha.OutputSpec;
import com.google.shopping.merchant.productstudio.v1alpha.ProductInfo;
import com.google.shopping.merchant.productstudio.v1alpha.TextSuggestionsServiceClient;
import com.google.shopping.merchant.productstudio.v1alpha.TextSuggestionsServiceSettings;
import shopping.merchant.samples.utils.Authenticator;
import shopping.merchant.samples.utils.Config;

/** This class demonstrates how to generate product text suggestions. */
public class GenerateProductTextSuggestionsSample {

  private static String getName(String accountId) {
    return String.format("accounts/%s", accountId);
  }

  public static void generateProductTextSuggestions(Config config) throws Exception {
    // Obtains OAuth token based on the user's configuration.
    GoogleCredentials credential = new Authenticator().authenticate();

    TextSuggestionsServiceSettings textSuggestionsServiceSettings =
        TextSuggestionsServiceSettings.newBuilder()
            .setCredentialsProvider(FixedCredentialsProvider.create(credential))
            .build();

    String name = getName(config.getAccountId().toString());

    // Calls the API and catches and prints any network failures/errors.
    try (TextSuggestionsServiceClient textSuggestionsServiceClient =
        TextSuggestionsServiceClient.create(textSuggestionsServiceSettings)) {

      ProductInfo productInfo =
          ProductInfo.newBuilder()
              .putProductAttributes("title", "Mens shirt")
              .putProductAttributes("description", "A blue shirt for men in size S")
              .build();

      OutputSpec outputSpec = OutputSpec.newBuilder().setWorkflowId("title").build();

      GenerateProductTextSuggestionsRequest request =
          GenerateProductTextSuggestionsRequest.newBuilder()
              .setName(name)
              .setProductInfo(productInfo)
              .setOutputSpec(outputSpec)
              .build();

      System.out.println("Sending GenerateProductTextSuggestions request: " + name);
      GenerateProductTextSuggestionsResponse response =
          textSuggestionsServiceClient.generateProductTextSuggestions(request);
      System.out.println("Generated product text suggestions response below:");
      System.out.println(response);
    } catch (Exception e) {
      System.out.println("An error has occured: ");
      System.out.println(e);
    }
  }

  public static void main(String[] args) throws Exception {
    Config config = Config.load();
    generateProductTextSuggestions(config);
  }
}

Python

"""A module to generate product text suggestions."""

from examples.authentication import configuration
from examples.authentication import generate_user_credentials
from google.shopping.merchant_productstudio_v1alpha import GenerateProductTextSuggestionsRequest
from google.shopping.merchant_productstudio_v1alpha import OutputSpec
from google.shopping.merchant_productstudio_v1alpha import ProductInfo
from google.shopping.merchant_productstudio_v1alpha import TextSuggestionsServiceClient


# Fetches the Merchant Center account ID from the configuration file.
# This ID is used to construct the 'name' for the API request.
_ACCOUNT_ID = configuration.Configuration().read_merchant_info()
# The parent resource name for the GenerateProductTextSuggestionsRequest.
# Format: "accounts/{account}"
_PARENT_RESOURCE_NAME = f"accounts/{_ACCOUNT_ID}"


def generate_product_text_suggestions_sample():
  """Generates product text suggestions for a given product."""

  # Gets OAuth Credentials.
  credentials = generate_user_credentials.main()

  # Creates a client for the TextSuggestionsService.
  client = TextSuggestionsServiceClient(credentials=credentials)

  # Defines the product information for which suggestions are needed.
  # This includes attributes like title and description.
  product_info = ProductInfo(
      product_attributes={
          "title": "Mens shirt",
          "description": "A blue shirt for men in size S",
      }
  )

  # Defines the output specification.
  # The 'workflow_id' specifies the type of text suggestion, e.g., "title".
  output_spec = OutputSpec(workflow_id="title")

  # Creates the request object for generating product text suggestions.
  # It includes the parent resource name, product information, and output
  # specification.
  request = GenerateProductTextSuggestionsRequest(
      name=_PARENT_RESOURCE_NAME,
      product_info=product_info,
      output_spec=output_spec,
  )

  # Sends the request to the API.
  print(
      f"Sending GenerateProductTextSuggestions request: {_PARENT_RESOURCE_NAME}"
  )
  try:
    response = client.generate_product_text_suggestions(request=request)
    # Prints the generated suggestions.
    print("Generated product text suggestions response below:")
    print(response)
  except RuntimeError as e:
    # Catches and prints any errors that occur during the API call.
    print("An error has occured: ")
    print(e)


if __name__ == "__main__":
  generate_product_text_suggestions_sample()

ข้อผิดพลาดและปัญหาที่พบได้ทั่วไป

ต่อไปนี้เป็นข้อผิดพลาดที่พบบ่อยและวิธีแก้ไข

ต้องระบุข้อมูลผลิตภัณฑ์เพื่อสร้างคำแนะนำข้อความ

หากคุณได้รับข้อความแสดงข้อผิดพลาดต่อไปนี้

Error message:
"error": {
    "code": 400,
    "message": "[product_info] Product info is required to generate text suggestions.",
    "status": "INVALID_ARGUMENT",
 ...
}

เพิ่ม product_info ในเนื้อหาคำขอและป้อนข้อมูล product_attributes หรือ product_image อย่างน้อย 1 รายการให้ถูกต้อง

ตัวอย่างเช่น การโพสต์โค้ดต่อไปนี้จะทำให้เกิดข้อผิดพลาด

POST https://merchantapi.googleapis.com/productstudio/v1alpha/accounts/{ACCOUNT_ID}:generateProductTextSuggestions
{
   "output_spec": {
      "workflow_id": "title"
   }
}

ต้องระบุฟิลด์ product_info อย่างน้อย 1 ฟิลด์เพื่อสร้างคำแนะนำข้อความ

ข้อผิดพลาดนี้

{
  "error": {
    "code": 400,
    "message": "[product_info.product_attributes] At least one field of product_info is required to generate text suggestions.",
    "status": "INVALID_ARGUMENT",
 ...
}

แสดงว่าคุณต้องใส่ช่อง product_info อย่างน้อย 1 ช่องในเนื้อหาคำขอ

ตัวอย่างเช่น การโพสต์ข้อความต่อไปนี้จะทำให้เกิดข้อผิดพลาด

POST https://merchantapi.googleapis.com/productstudio/v1alpha/accounts/{ACCOUNT_ID}:generateProductTextSuggestions
{
   "product_info": {
   },
   "output_spec": {
      "workflow_id": "title"
   }
}

ให้ใช้ข้อความต่อไปนี้แทน

   "product_info": {
        "product_attributes": {
         "description": "Selling size 12 Nike dunks. Oh they are red by the way!"
      }
   }

หรือ

"product_info": {
    "product_image":{
        "uri": "https://cdn.shopify.com/s/files/1/0653/5879/0892/products/1672082339438_550x825.jpg?v=1672082415"
    }
}

ต้องระบุ (บางอย่าง) ในแต่ละ title_example

ข้อผิดพลาด เช่น 4 ตัวอย่างต่อไปนี้

{
  "error": {
    "code": 400,
    "message": "[title_examples.product_info] At least one field of product_info is required in each title_example.",
    "status": "INVALID_ARGUMENT",
 ...
}

หรือ

{
  ...
    "message": "[title_examples.category] Category is required in each title_example.",
  ...
}

หรือ

{
  ...
    "message": "[title_examples.title_format] Title format is required in each title_example.",
  ...
}

หรือ

{
  ...
    "message": "[title_examples.final_product_info] At least one field of final_product_info is required in each title_example.",
  ...
}

ระบุว่าคุณไม่ได้ป้อนข้อมูลในช่องย่อยที่ต้องกรอก

ตัวอย่างเช่น คำขอต่อไปนี้จะทำให้เกิดข้อผิดพลาด

POST https://merchantapi.googleapis.com/productstudio/v1alpha/accounts/{ACCOUNT_ID}:generateProductTextSuggestions
{
    "product_info": {
        "product_attributes": {
            "description": "selling size 12 nike dunks. oh they are red by the way!"
        }
    },
    "output_spec": {
        "workflow_id": "title"
    },
    "title_examples": []
}

หากต้องการแก้ไขปัญหานี้ ให้ป้อนข้อมูลในช่องย่อยต่อไปนี้ทั้งหมดสำหรับ title_example แต่ละรายการที่ระบุในคำขอ

  • product_info
  • category
  • title_format
  • final_product_info

ตัวอย่างที่ใช้ได้มีดังนี้

{
   "product_info": {
      "product_attributes": {
         "title": "Volumizing & Lengthening Mascara - Dark Brown",
         "description": "This high-impact mascara delivers both voluptuous volume and dramatic length without clumping or smudging.",
      }
   },
   "output_spec": {
      "workflow_id": "title"
   },
   "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",
      }
    }
  ]
}

workflow_id ที่ไม่รองรับ

ข้อผิดพลาดประเภทนี้

{
  "error": {
    "code": 400,
    "message": "[\u003ceye3 title='/ProductStudioTextGenerationService.GenerateProductText, INVALID_ARGUMENT'/\u003e APPLICATION_ERROR; ... ;Unsupported workflow_id: attributes. Supported workflows are: [\"title\", \"description\", \"tide\"];AppErrorCode=3;StartTimeMs=1740696804045;unknown;ResFormat=uncompressed;ServerTimeSec=0.005976589;LogBytes=256;Non-FailFast;EffSecLevel=none;ReqFormat=uncompressed;ReqID=4d1786f59faa3ea7;GlobalID=0;Server=[2002:a05:6e16:618:b0:2c2:7cfc:bebd]:14001] Invalid value",
    "status": "INVALID_ARGUMENT",
 ...
}

จะเกิดจากคำขอ เช่น

POST https://merchantapi.googleapis.com/productstudio/v1alpha/accounts/{ACCOUNT_ID}:generateProductTextSuggestions
{
   "product_info": {
      "product_attributes": {
         "title": "Volumizing & Lengthening Mascara - Dark Brown",
         "description": "This high-impact mascara delivers both voluptuous volume and dramatic length without clumping or smudging.",
   },
   "output_spec": {
      "workflow_id": "attributes"
   }
}

คำขอตั้งค่า workflow_id เป็น "attributes" แต่ช่องนี้รองรับค่าต่อไปนี้เพียงค่าเดียว

  • title: สร้างหรือเพิ่มประสิทธิภาพชื่อผลิตภัณฑ์
  • description: สร้างหรือเพิ่มประสิทธิภาพรายละเอียดสินค้า
  • tide: สร้างหรือเพิ่มประสิทธิภาพทั้งชื่อและรายละเอียดสินค้า

โทนเสียงที่ไม่รองรับ

ข้อผิดพลาด "โทนเสียงที่ไม่รองรับ" เช่น

{
  "error": {
    "code": 400,
    "message": "[\u003ceye3 title='/ProductStudioTextGenerationService.GenerateProductText, INVALID_ARGUMENT'/\u003e APPLICATION_ERROR; ... ; Unsupported tone: 'asdf'. Supported tones are: [\"default\", \"playful\", \"formal\", \"persuasive\", \"conversational\"];AppErrorCode=3;StartTimeMs=1740697325058;unknown;ResFormat=uncompressed;ServerTimeSec=7.45346E-4;LogBytes=256;Non-FailFast;EffSecLevel=none;ReqFormat=uncompressed;ReqID=f7d9bbbc73a1d342;GlobalID=0;Server=[2002:a05:6918:3486:b0:2bc:ccd4:79e6]:14001] Invalid value",
    "status": "INVALID_ARGUMENT",
 ...
}

จะเกิดจากคำขอ เช่น

POST https://merchantapi.googleapis.com/productstudio/v1alpha/accounts/{ACCOUNT_ID}:generateProductTextSuggestions
{
   "product_info": {
      "product_attributes": {
         "title": "Volumizing & Lengthening Mascara - Dark Brown",
         "description": "This high-impact mascara delivers both voluptuous volume and dramatic length without clumping or smudging.",
   },
   "output_spec": {
      "workflow_id": "description"
      "tone": "cheerful"
   }
}

โปรดทราบว่ามีการตั้งค่า tone เป็น "cheerful" แต่ช่องนี้รองรับค่าต่อไปนี้เพียงค่าเดียว

  • ค่าเริ่มต้น: เรียบง่าย ชัดเจน และดูดี
  • สนุกสนาน: สบายๆ ใช้ภาษาเชิงบวก อารมณ์ขัน (มุกตลก การเล่นคำ) และการพูดเกินจริง (ไม่มีการประชดประชัน การเสียดสี หรืออีโมจิ)
  • เป็นทางการ: ภาษาอังกฤษมาตรฐาน ไวยากรณ์ที่ถูกต้อง ประโยคที่สมบูรณ์ ไม่มีคำสแลงหรือคำย่อ
  • โน้มน้าวใจ: สมเหตุสมผล กระชับ และเน้นการโต้แย้งเพื่อโน้มน้าวใจผู้อ่าน
  • ภาษาพูด: ภาษาที่ใช้ในชีวิตประจำวัน เป็นมิตร และเข้าใจง่าย