Skip to content

.Net: Bug: Embedding generation dimensions works in Google Gemini but fails in VertexAI #12988

@abbottdev

Description

@abbottdev

Describe the bug
When using the dimensions attribute on a IEmbeddingGenerator request, the outputted dimensions from the Vertex API call is whatever the default is for the model.

To Reproduce

        var embeddings = await embeddingGenerationService.GenerateAsync("hello",new EmbeddingGenerationOptions() {
            Dimensions = 128,
            ModelId = "gemini-embedding-001",
        }, cancellationToken);

        Console.WriteLine(embeddings.Vector.Length);

^ The above outputs: 3072 (the default for that model.)

Expected behavior
The outputted dimensions should respect the inputted value.

Platform

  • Language: C#
  • Source: Microsoft.SemanticKernel.Connectors.Google, 1.63.0-alpha
  • AI model: Google gemini-embedding-001
  • IDE: vscode
  • OS: Mac

Additional context
Related:

#10488
#10489

The above previous changes look to have only added support to the Google Gemini connector, not the VertexAI connector.

Metadata

Metadata

Assignees

Labels

.NETIssue or Pull requests regarding .NET codebugSomething isn't working

Type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions