Package com.azure.ai.openai.models
Class EmbeddingsOptions
java.lang.Object
com.azure.ai.openai.models.EmbeddingsOptions
- All Implemented Interfaces:
com.azure.json.JsonSerializable<EmbeddingsOptions>
public final class EmbeddingsOptions
extends Object
implements com.azure.json.JsonSerializable<EmbeddingsOptions>
The configuration information for an embeddings request.
Embeddings measure the relatedness of text strings and are commonly used for search, clustering,
recommendations, and other similar scenarios.
-
Constructor Summary
ConstructorsConstructorDescriptionEmbeddingsOptions(List<String> input) Creates an instance of EmbeddingsOptions class. -
Method Summary
Modifier and TypeMethodDescriptionstatic EmbeddingsOptionsfromJson(com.azure.json.JsonReader jsonReader) Reads an instance of EmbeddingsOptions from the JsonReader.Get the dimensions property: The number of dimensions the resulting output embeddings should have.getInput()Get the input property: Input texts to get embeddings for, encoded as a an array of strings.Get the inputType property: When using Azure OpenAI, specifies the input type to use for embedding search.getModel()Get the model property: The model name to provide as part of this embeddings request.getUser()Get the user property: An identifier for the caller or end user of the operation.setDimensions(Integer dimensions) Set the dimensions property: The number of dimensions the resulting output embeddings should have.setInputType(String inputType) Set the inputType property: When using Azure OpenAI, specifies the input type to use for embedding search.Set the model property: The model name to provide as part of this embeddings request.Set the user property: An identifier for the caller or end user of the operation.com.azure.json.JsonWritertoJson(com.azure.json.JsonWriter jsonWriter)
-
Constructor Details
-
EmbeddingsOptions
Creates an instance of EmbeddingsOptions class.- Parameters:
input- the input value to set.
-
-
Method Details
-
getUser
Get the user property: An identifier for the caller or end user of the operation. This may be used for tracking or rate-limiting purposes.- Returns:
- the user value.
-
setUser
Set the user property: An identifier for the caller or end user of the operation. This may be used for tracking or rate-limiting purposes.- Parameters:
user- the user value to set.- Returns:
- the EmbeddingsOptions object itself.
-
getModel
Get the model property: The model name to provide as part of this embeddings request. Not applicable to Azure OpenAI, where deployment information should be included in the Azure resource URI that's connected to.- Returns:
- the model value.
-
setModel
Set the model property: The model name to provide as part of this embeddings request. Not applicable to Azure OpenAI, where deployment information should be included in the Azure resource URI that's connected to.- Parameters:
model- the model value to set.- Returns:
- the EmbeddingsOptions object itself.
-
getInput
Get the input property: Input texts to get embeddings for, encoded as a an array of strings. Each input must not exceed 2048 tokens in length. Unless you are embedding code, we suggest replacing newlines (\n) in your input with a single space, as we have observed inferior results when newlines are present.- Returns:
- the input value.
-
getInputType
Get the inputType property: When using Azure OpenAI, specifies the input type to use for embedding search.- Returns:
- the inputType value.
-
setInputType
Set the inputType property: When using Azure OpenAI, specifies the input type to use for embedding search.- Parameters:
inputType- the inputType value to set.- Returns:
- the EmbeddingsOptions object itself.
-
getDimensions
Get the dimensions property: The number of dimensions the resulting output embeddings should have. Only supported in `text-embedding-3` and later models.- Returns:
- the dimensions value.
-
setDimensions
Set the dimensions property: The number of dimensions the resulting output embeddings should have. Only supported in `text-embedding-3` and later models.- Parameters:
dimensions- the dimensions value to set.- Returns:
- the EmbeddingsOptions object itself.
-
toJson
- Specified by:
toJsonin interfacecom.azure.json.JsonSerializable<EmbeddingsOptions>- Throws:
IOException
-
fromJson
Reads an instance of EmbeddingsOptions from the JsonReader.- Parameters:
jsonReader- The JsonReader being read.- Returns:
- An instance of EmbeddingsOptions if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.
- Throws:
IllegalStateException- If the deserialized JSON object was missing any required properties.IOException- If an error occurs while reading the EmbeddingsOptions.
-