Package com.mongodb.client.model
Class VectorSearchIndexFields.AutoEmbedField
java.lang.Object
com.mongodb.client.model.VectorSearchIndexFields.AutoEmbedField
- All Implemented Interfaces:
Bson
- Enclosing class:
- VectorSearchIndexFields
@NotThreadSafe
public static final class VectorSearchIndexFields.AutoEmbedField
extends Object
implements Bson
An auto-embed field definition for a vector search index.
Instances are created via VectorSearchIndexFields.autoEmbedField(String).
- Since:
- 5.8
-
Field Summary
Fields inherited from interface org.bson.conversions.Bson
DEFAULT_CODEC_REGISTRY -
Method Summary
Modifier and TypeMethodDescriptionhnswOptions(Bson hnswOptions) Sets the HNSW options for this auto-embed field.indexingMethod(String indexingMethod) Sets the indexing method for this auto-embed field.Sets the modality for auto-embedding.Sets the embedding model to use.numDimensions(int numDimensions) Sets the number of dimensions for the auto-embedded vector.quantization(String quantization) Sets the quantization type for the auto-embedded vector.similarity(String similarity) Sets the similarity function used to compare vectors.<TDocument>
BsonDocumenttoBsonDocument(Class<TDocument> documentClass, CodecRegistry codecRegistry) toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.bson.conversions.Bson
toBsonDocument
-
Method Details
-
modality
Sets the modality for auto-embedding. This is a required field.The initially supported type is
"text".- Parameters:
modality- the modality (e.g.,"text")- Returns:
- this
- Since:
- 5.8
-
model
Sets the embedding model to use. This is a required field.Only one model can be used across all fields in a single vector index definition.
- Parameters:
model- the model name (e.g.,"voyage-4","voyage-4-large","voyage-4-lite","voyage-code-3")- Returns:
- this
- Since:
- 5.8
-
numDimensions
Sets the number of dimensions for the auto-embedded vector. This is an optional field.These map to the number of dimensions supported by the API endpoint (currently 256, 512, 1024, 2048).
- Parameters:
numDimensions- the number of vector dimensions- Returns:
- this
- Since:
- 5.8
-
quantization
Sets the quantization type for the auto-embedded vector. This is an optional field.Supported values:
"float""scalar""binary""binaryNoRescore"
- Parameters:
quantization- the quantization type- Returns:
- this
- Since:
- 5.8
-
similarity
Sets the similarity function used to compare vectors. This is an optional field.Supported values:
"dotProduct""cosine""euclidean"
- Parameters:
similarity- the similarity function name- Returns:
- this
- Since:
- 5.8
-
indexingMethod
Sets the indexing method for this auto-embed field. This is an optional field.Supported values:
"flat"— optimized for multi-tenant use cases with singular, static filters"hnsw"— Hierarchical Navigable Small World graph
- Parameters:
indexingMethod- the indexing method name- Returns:
- this
- Since:
- 5.8
-
hnswOptions
Sets the HNSW options for this auto-embed field. This is an optional field.This is only applicable when the indexing method is
"hnsw". A convenience builder is available viaHnswSearchIndexOptions, or a rawDocumentmay be passed directly.- Parameters:
hnswOptions- the HNSW options- Returns:
- this
- Since:
- 5.8
- See Also:
-
toBsonDocument
public <TDocument> BsonDocument toBsonDocument(Class<TDocument> documentClass, CodecRegistry codecRegistry) - Specified by:
toBsonDocumentin interfaceBson
-
toString
-