Customize the vector representation of a record
mainBy default, the gem calls to_json(except: :embedding) on your model instance to create the data used for embeddings. To customize which fields are included in the vector representation, override the #as_vector method in your model.
Note: After modifying #as_vector, you must re-run Model.embed! to update the embeddings in the database.
def as_vector
{ name: name, description: description, category: category.name }.to_json
end
# Then re-generate
Product.embed!