ایجاد پیشنهادات متنی

API پیشنهادات متنی از ابزارهای هوش مصنوعی تولیدی API محصول استودیو برای تولید و بهینه‌سازی عناوین و توضیحات محصول استفاده می‌کند. می‌توانید از آن برای بهبود تعامل و تبدیل مشتری و ساده‌سازی فرآیند مدیریت و به‌روزرسانی اطلاعات محصول استفاده کنید. ویژگی‌های API محصول استودیو می‌تواند به شما در بهینه‌سازی عملکرد خرده‌فروشی‌تان کمک کند.

با استفاده از API چه چیزهایی می‌توان تولید کرد؟

API پیشنهاد متن به شما کمک می‌کند تا موارد زیر را انجام دهید:

  • عناوین و توضیحات پیشنهادی محصول بر اساس تصویر محصول و/یا ویژگی‌های محصول شما.
  • عناوین بهینه شده برای سئو برای محصولات شما
  • عناوین با قالب سفارشی برای محصولات شما
  • توضیحات محصول از فید محصول شما

همچنین می‌توانید لحن و آهنگ صدا را برای توضیحات مشخص کنید و در تمام فهرست محصولات خود، هماهنگی را حفظ کنید.

شروع سریع

متد 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 برای تولید یا بهینه‌سازی عنوان یا توضیحات یا هر دو از ورودی‌های مختلف داده‌های محصول ارائه شده است. همچنین خطاها و مشکلات رایج و راه‌حل‌های آنها را ارائه می‌دهیم.

تولید عنوان بهینه شده

این مثال نشان می‌دهد که چگونه می‌توان یک عنوان بهینه تولید کرد.

درخواست

بدنه درخواست شامل اطلاعات محصول برای استفاده در بهینه‌سازی عنوان است. در اینجا مثالی از ساختار درخواست آورده شده است:

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

بهینه‌سازی عناوین از یک عنوان و توضیحات (همراه با مثال سفارشی)

در این مثال، ما به صراحت ویژگی‌های محصولی را که می‌خواهیم هوش مصنوعی شناسایی کند، برچسب‌گذاری می‌کنیم و ترتیب ویژگی‌ها را در خروجی مشخص می‌کنیم.

درخواست

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

شخصی‌سازی لحن صدا برای تولید توضیحات

برای کمک به تثبیت برند خود و متمایز کردن فروشگاه آنلاین خود از دیگران، می‌توانید لحن توضیحات تولید شده خود را شخصی‌سازی کنید. API متن دو گزینه ارائه می‌دهد:

  • انتخاب تُن از پیش تعریف‌شده: می‌توانید از فهرست تُن‌ها، تُن‌های مورد نظر خود را برای تولید توضیحات جدید انتخاب کنید. این فهرست شامل این سبک‌های تُن است:
    • پیش‌فرض: ساده، واضح و زیبا.
    • شوخ طبع: شاد و سرزنده، با استفاده از زبان مثبت، شوخ طبعی (شوخی، جناس) و اغراق (بدون کنایه، طعنه یا ایموجی).
    • رسمی: انگلیسی استاندارد، دستور زبان صحیح، جملات کامل، بدون اصطلاحات عامیانه یا اختصارات.
    • متقاعدکننده: منطقی، مختصر و مبتنی بر استدلال برای متقاعد کردن خواننده.
    • محاوره‌ای: زبانی دوستانه، قابل فهم و روزمره.
  • لحن خاص برند: شما می‌توانید توضیحات موجود یا سایر دارایی‌های متنی را در لحن صدای برند خود ارائه دهید. مدل هوش مصنوعی مولد، لحن متن را تجزیه و تحلیل کرده و بر اساس این جنبه‌ها، یک «توصیفگر سبک نوشتاری» تولید می‌کند:
    • رسمیت (مانند رسمی، خودمانی)
    • پرگویی (مانند مختصر، بسیار مفصل)
    • لحن (مانند حرفه‌ای، آموزنده، مثبت، متقاعدکننده)
    • ساختار جمله (مانند «جمله ساده با حروف ربط کم»)
    • پرکاربردترین کلمات و عبارات مورد استفاده

کتابخانه‌های کلاینت

توصیه می‌کنیم برای ارسال درخواست‌های خود از کتابخانه‌های کلاینت استفاده کنید. ما کتابخانه‌های کلاینت را با شما به اشتراک خواهیم گذاشت که می‌توانید در پروژه Maven خود نصب کنید.

نمونه‌های کد

روش احراز هویت خود را انتخاب کنید و این نمونه کدها را با استفاده از این دستورالعمل‌ها تنظیم کنید. در اینجا نمونه‌ای وجود دارد که می‌توانید برای تولید پیشنهادهای متنی از آن استفاده کنید.

جاوا

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);
  }
}

پایتون

"""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 را به درستی پر کنید.

برای مثال، ارسال این مطلب منجر به خطا خواهد شد.

POST https://merchantapi.googleapis.com/productstudio/v1alpha/accounts/{ACCOUNT_ID}:generateProductTextSuggestions

{
   "output_spec": {
      "workflow_id": "title"
   }
}

حداقل یک فیلد از product_info برای تولید پیشنهاد متن مورد نیاز است.

این خطا

{
  "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 را در بدنه درخواست وارد کنید.

برای مثال، ارسال این مطلب منجر به خطا می‌شود.

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 الزامی است

خطاهایی مانند چهار مثال زیر

{
  "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" تنظیم می‌کند، اما این فیلد فقط از یکی از مقادیر زیر پشتیبانی می‌کند:

  • عنوان : عنوان محصول را تولید یا بهینه می‌کند.
  • توضیحات : توضیحات محصول را تولید یا بهینه می‌کند.
  • 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" تنظیم شده است، اما این فیلد فقط از یکی از مقادیر زیر پشتیبانی می‌کند:

  • پیش‌فرض : ساده، واضح و زیبا.
  • شوخ طبع : شاد و سرزنده، با استفاده از زبان مثبت، شوخ طبعی (شوخی، جناس) و اغراق (بدون کنایه، طعنه یا ایموجی).
  • رسمی : انگلیسی استاندارد، دستور زبان صحیح، جملات کامل، بدون اصطلاحات عامیانه یا اختصارات.
  • متقاعدکننده : منطقی، مختصر و مبتنی بر استدلال برای متقاعد کردن خواننده.
  • محاوره‌ای : زبانی دوستانه، قابل فهم و روزمره.