Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン
#14,265 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
68/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
csharp, google-cloud
領域
ai, api

調査の方向性

dotnet/src/Connectors/Connectors.Google/Core/VertexAI/VertexAIEmbeddingClient.cs のハードコードされた :predict エンドポイントから始め、次に提供されている gemini-embedding-2 の再現を実行します。モデルが :embedContent をどのように選択すべきかを判断し、要求された次元数で GenerateAsync が成功し、FAILED_PRECONDITION を返さないことを確認します。

索引モデルが issue の本文から書いたものです。

説明

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:

主要言語
C#
スター
28.6k
フォーク
4.8k
平均マージ
13時間 24分
マージ済み PR(30日)
11

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/semantic-kernel のほかの issue

microsoft/semantic-kernel の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。