Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Bug: VertexAIEmbeddingGenerator hardcodes :predict, unusable with gemini-embedding models that only serve :embedContent

Đang mở
#14,265 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@veerjain-1 đang làm issue này rồi.

Từ ngày 13/8/2026.

  • #14266 của @Diwak4r — đã đóng, không merge
  • #14284 của @veerjain-1 — đang mở
  • #14330 của @Alphaxiaoteng — đang mở
  • #14502 của @mayuriphad — đang mở

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
68/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
csharp, google-cloud
Lĩnh vực
ai, api

Hướng nghiên cứu

Bắt đầu trong dotnet/src/Connectors/Connectors.Google/Core/VertexAI/VertexAIEmbeddingClient.cs tại endpoint :predict được hardcode, sau đó chạy bản tái hiện gemini-embedding-2 được cung cấp. Xác định cách model nên chọn :embedContent và kiểm tra rằng GenerateAsync thành công với các chiều được yêu cầu thay vì trả về FAILED_PRECONDITION.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug

Describe the bug
Using VertexAIEmbeddingGenerator with model "gemini-embedding-2" will result in 400 FAILED_PRECONDITION

To Reproduce
Run the VertexAIEmbeddingGenerator generation with the gemini-embedding-2 model:

#:package [email protected]
#:property NoWarn=SKEXP0001;SKEXP0070

using System.Net.Http.Json;
using System.Text.Json;
using Microsoft.Extensions.AI;
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.Connectors.Google;

const string ModelId = "gemini-embedding-2";
const int Dimensions = 768;

var token     = Require("GOOGLE_ACCESS_TOKEN");
var projectId = Require("GOOGLE_PROJECT_ID");
var location  = Environment.GetEnvironmentVariable("GOOGLE_LOCATION") is { Length: > 0 } l ? l : "us-central1";

Console.WriteLine($"model={ModelId} project={projectId} location={location} dimensions={Dimensions}");
Console.WriteLine($"SK Connectors.Google = {typeof(VertexAIEmbeddingGenerator).Assembly.GetName().Version}");
Console.WriteLine();

try
{
    IEmbeddingGenerator<string, Embedding<float>> generator = new VertexAIEmbeddingGenerator(
        modelId:    ModelId,
        bearerKey:  token,
        location:   location,
        projectId:  projectId,
        dimensions: Dimensions);

    var embeddings = await generator.GenerateAsync(["test"]);
    Console.WriteLine($"    UNEXPECTED SUCCESS: {embeddings[0].Vector.Length} floats");
}
catch (HttpOperationException ex)
{
    Console.WriteLine($"    FAILED  status={ex.StatusCode}");
    Console.WriteLine($"    message={ex.Message}");
    Console.WriteLine($"    body={Trim(ex.ResponseContent)}");
}
catch (Exception ex)
{
    Console.WriteLine($"    FAILED  {ex.GetType().Name}: {ex.Message}");
}

Expected behavior
VertexAIEmbeddingGenerator should correctly resolve to use the :embedContent endpoint in this case, as the :predict endpoint is no longer supported for gemini-embedding-2

Platform

  • Language: C#
  • Source: [email protected]
  • AI model: gemini-embedding-2
  • IDE: JetBrains Rider
  • OS: Windows

Additional context
:predict API is hardcoded here:
https://github.com/microsoft/semantic-kernel/blob/383d102346b7b29c929e0257ef672a48898b5f66/dotnet/src/Connectors/Connectors.Google/Core/VertexAI/VertexAIEmbeddingClient.cs#L57

Similar problems raised in other repos:

Ngôn ngữ chính
C#
Star
28.7k
Fork
4.8k
Merge trung bình
1 ngày 21 giờ
Pull request đã merge (30 ngày)
28

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của microsoft/semantic-kernel

Tất cả issue của microsoft/semantic-kernel

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.