Skip to content

Dense Vector Field Support  #356

@YakPort

Description

@YakPort

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy