Describe the bug
When using GenerativeAIEmbeddingGenerator with the model models/gemini-embedding-001, the Dimensions property in EmbeddingGenerationOptions seems to be ignored.
I explicitly set the Dimensions to 1536, but the generated embedding vector length returned is 3072.
To Reproduce
Run the following C# code snippet:
var key = "YOUR_API_KEY"; // Replaced for security
var options = new EmbeddingGenerationOptions()
{
Dimensions = 1536
};
var generator = new GenerativeAIEmbeddingGenerator(key, "models/gemini-embedding-001");
var result = await generator.GenerateAsync(["testtest"], options);
var embedding = result[0].Vector;
Console.WriteLine($"Expected Length: {options.Dimensions}");
Console.WriteLine($"Actual Length: {embedding.Length}");
// Actual output is 3072
Expected behavior
The length of the returned embedding array (embedding.Length) should be 1536, matching the configured Dimensions option.
Actual behavior
The length of the returned embedding array is 3072.
Environment
Describe the bug
When using
GenerativeAIEmbeddingGeneratorwith the modelmodels/gemini-embedding-001, theDimensionsproperty inEmbeddingGenerationOptionsseems to be ignored.I explicitly set the
Dimensionsto 1536, but the generated embedding vector length returned is 3072.To Reproduce
Run the following C# code snippet:
Expected behavior
The length of the returned embedding array (
embedding.Length) should be 1536, matching the configuredDimensionsoption.Actual behavior
The length of the returned embedding array is 3072.
Environment
3.4.1