EmbeddingVector


@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.SCHEMA_EMBEDDING_PROPERTY_CONFIG)
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(values: FloatArray, modelSignature: String)

Creates a new EmbeddingVector.

Public functions

Boolean
equals(o: Any!)
String

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

FloatArray<Float>

Returns the values of this embedding vector.

Int

Public constructors

EmbeddingVector

Added in 1.1.0-alpha07
EmbeddingVector(values: FloatArray, modelSignature: String)

Creates a new EmbeddingVector.

Throws
java.lang.IllegalArgumentException

if values is empty.

Public functions

equals

fun equals(o: Any!): Boolean

getModelSignature

Added in 1.1.0-alpha07
fun getModelSignature(): String

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-alpha07
fun getValues(): FloatArray<Float>

Returns the values of this embedding vector.

hashCode

fun hashCode(): Int