Inspired by Lilian Weng’s Lil’Log (https://lilianweng.github.io/), I will document my learnings and understandings frequently on my website. As a data analyst at aosom.com, an online shopping company, I primarily focus on topics related to this field including LLM product description writing, RAG systems for info retrieval, machine learning algorithms, and website data analysis.
这篇文章灵感来源于OpenAI Katia Gil Guzman发布的cookbook:Using GPT4 with Vision to tag and caption images
如果还没有看过上文,可以先看看我的精读。对于不了解Embedding的朋友,可以参考这篇文章。
使用GPT-4V生成文案
最新版的GPT-4-Turbo模型支持把图片作为input,并输出相关内容。以下是Katia使用的Prompt:
describe_system_prompt = '''
You are a system generating descriptions for furniture items, decorative items, or furnishings on an e-commerce website.
Provided with an image and a title, you will describe the main item that you see in the image, giving details but staying concise.
You can describe unambiguously what the item is and its material, color, and style if clearly identifiable.
If there are multiple items depicted, refer to the title to understand which item you should describe.
'''
热搜词词库
Google Ads中,可以在search terms中筛选点击率和转化率比较高的词,作为词库
热搜词转Embedding
在Katia的文章中提到,文本间进行比较最实用的方法就是将文案转换为embeddings,利用cosine similarity进行相似度对比。Embedding模型我使用OpenAI的text-embedding-3-large模型:
def get_embedding(value, model="text-embedding-3-large"):
embeddings = client.embeddings.create(
model=model,
input=value,
encoding_format="float"
)
return embeddings.data[0].embedding
将热搜词转换为embedding,这是转换后的结果:
tutto per animali con pagamento alla consegna | [-0.043878064, 0.027233772, -0.013745711, 0.010235209, -0.0148407305, -0.0063768765, -0.015858455, 0.02962993, -0.029423809, ...] |
vele ombreggianti resistenti al vento | [-0.0071062134, 0.019305531, -0.012313627, 0.0038547555, 0.004947042, -0.009614662, -0.028932894, 0.0064362353, -0.028526463, ...] |
生成后的文案匹配关键词
在这里产品描述我用Aosom的多人沙发作为例子:
这是产品描述中关于产品的文案:
“Scoprite il comfort e l'eleganza con il nostro Divano a U, una soluzione d'arredo ideale per chi cerca stile e funzionalità nel proprio soggiorno. La struttura solida in legno, il tessuto in lino e la spugna ad alta densità rendono questo divano modulare non solo esteticamente piacevole ma anche incredibilmente confortevole. Ogni modulo nasconde un pratico vano contenitore, perfetto per mantenere l'ordine nel vostro spazio. Facile da montare e da pulire, questo divano è la scelta giusta per chi desidera unire bellezza e praticità.”
比较文案和关键词词库Cosine Similarity:
def get_keyword(description):
embedded_value = get_embedding(description)
keywords_df['similarity'] = keywords_df['embedding'].apply(lambda x: cosine_similarity(np.array(x).reshape(1,-1), np.array(embedded_value).reshape(1, -1)))
most_similar = keywords_df.sort_values('similarity', ascending=False).iloc[0:5]
return most_similar[['Keywords','similarity']]
以下是相似度最高的热搜词:
keywords | similarity |
divano | 0.515 |
poltrone e sofa | 0.513 |
divano letto | 0.511 |
cuscini divano | 0.506 |
divani letto | 0.503 |
有了关键词之后,就可以把这些词包含在标题生成的prompt中,最终起到优化标题SEO效果。