def generate_marketing_copy()

in experiments/google/cloud/ml/applied/marketing/marketing.py [0:0]


def generate_marketing_copy(model: m.MarketingRequest) -> m.TextValue:
    """Given list of product IDs, join category names.

    Args:
        model: Marketing Request

    Returns:
        Marketing copy that can be used for a product page
    """
    prompt = f"""
      Generate a compelling and accurate product description
      for a product with the following description and attributes.

      Description:
      {model.description}

      Attributes:
      {m.attribute_values_to_dict(model.attributes)}
    """
    llm_parameters = {
        "max_output_tokens": 1024,
        "temperature": 0.5,
    }
    response = llm.predict(prompt, **llm_parameters)
    return m.TextValue(text=response.text)