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

Text Suggestions API ใช้ประโยชน์จากเครื่องมือ Generative AI ของ Product Studio API เพื่อสร้างและเพิ่มประสิทธิภาพชื่อและรายละเอียดสินค้า คุณสามารถใช้ 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" แต่ช่องนี้รองรับค่าต่อไปนี้เท่านั้น

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