Closed
Description
I note the closed issue
https://github.com/elastic/elasticsearch-dsl-py/issues/1278
I created a densevector field as mentioned above
I have a method on my model the calculates the embedding called get_embedding
I am trying to create a Field that will access the attribute on my model and store the calculated embedding similar to
class DenseVector(DEDField, Field):
name = 'dense_vector'
def __init__(self):
dims = 1024
super(DenseVector, self).__init__(dims=dims)
in documents.py
@registry.register_document
class ItemDocument(Document):
title_vector = DenseVector(attr='get_embedding')
class Index:
name = "products"
settings = {
"number_of_shards": 1,
"number_of_replicas": 0,
"analysis": {"analyzer": {"standard": {"type": "standard"}}},
}
class Django:
model = Item
I am getting TypeError: init() got an unexpected keyword argument 'attr'
where is attr being initialised, or am I going down the wrong path?
Many thanks
Metadata
Metadata
Assignees
Labels
No labels