Skip to content

EmbeddingIndex#

[source]

EmbeddingIndex#

hsfs.embedding.EmbeddingIndex(index_name=None, features=None, col_prefix=None)

Represents an index for managing embeddings with associated features.

Arguments

  • index_name Optional[str]: The name of the embedding index.
  • features Optional[List[hsfs.embedding.EmbeddingFeature]]: A list of EmbeddingFeature objects for the features that contain embeddings that should be indexed for similarity search.
  • col_prefix Optional[str]: The prefix to be added to column names.

Example

embedding_index = EmbeddingIndex()
embedding_index.add_embedding(name="user_vector", dimension=256)
embeddings = embedding_index.get_embeddings()

Methods#

[source]

add_embedding#

EmbeddingIndex.add_embedding(name, dimension, similarity_function_type="l2_norm")

Adds a new embedding feature to the index.

Example:

embedding_index = EmbeddingIndex()
embedding_index.add_embedding(name="user_vector", dimension=256)

Arguments

  • name str: The name of the embedding feature.
  • dimension int: The dimensionality of the embedding feature.
  • similarity_function_type Optional[hsfs.embedding.SimilarityFunctionType]: The type of similarity function to be used.

[source]

from_json_response#

EmbeddingIndex.from_json_response(json_dict)

[source]

get_embeddings#

EmbeddingIndex.get_embeddings()

Returns the list of hsfs.embedding.EmbeddingFeature objects associated with the index.

Returns

A list of hsfs.embedding.EmbeddingFeature objects


[source]

json#

EmbeddingIndex.json()

[source]

to_dict#

EmbeddingIndex.to_dict()

{{embedding_feature}}