Skip to main content

Generate customer inquiry embeddings

For customer inquiries, we'll apply the same generate_embeddings function used for products. In your Jupyter Notebook, add a new cell to generate an embedding for a customer's query, using the text_description parameter instead of image_base64:

Jupyter Notebook
customer_query = "Hi! I'm looking for a red bag"
query_embedding = generate_embedding(text_description=customer_query)
query_embedding

This approach converts the text of the customer's query into a vector embedding, similar to how we processed product images.

The result is a numerical vector that represents the customer's query, ready for comparison against product embeddings using cosine similarity in the upcoming steps.

The output should look something like this:

DataFrame with embeddings

Now that we have the vectors for the images in the product catalog and the vector embedding for the customer inquiry, let's calculate the cosine similarity in the next section.