EmbeddingVector


@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.SCHEMA_EMBEDDING_PROPERTY_CONFIG)
public final class EmbeddingVector


Embeddings are vector representations of data, such as text, images, and audio, which can be generated by machine learning models and used for semantic search. This class represents an embedding vector, which wraps a float array for the values of the embedding vector and a model signature that can be any string to distinguish between embedding vectors generated by different models.

For more details on how embedding search works, check search and setRankingStrategy.

Summary

Public constructors

EmbeddingVector(@NonNull float[] values, @NonNull String modelSignature)

Creates a new EmbeddingVector.

Public methods

boolean
@NonNull String

Returns the model signature of this embedding vector, which is an arbitrary string to distinguish between embedding vectors generated by different models.

@NonNull float[]

Returns the values of this embedding vector.

int

Public constructors

EmbeddingVector

Added in 1.1.0-alpha06
public EmbeddingVector(@NonNull float[] values, @NonNull String modelSignature)

Creates a new EmbeddingVector.

Throws
java.lang.IllegalArgumentException

if values is empty.

Public methods

equals

public boolean equals(Object o)

getModelSignature

Added in 1.1.0-alpha06
public @NonNull String getModelSignature()

Returns the model signature of this embedding vector, which is an arbitrary string to distinguish between embedding vectors generated by different models.

getValues

Added in 1.1.0-alpha06
public @NonNull float[] getValues()

Returns the values of this embedding vector.

hashCode

public int hashCode()