Skip to content

Fix Google GenAI Text Embedding missing taskType#6022

Open
jewoodev wants to merge 1 commit into
spring-projects:mainfrom
jewoodev:fix/gh-5966-pass-task-type
Open

Fix Google GenAI Text Embedding missing taskType#6022
jewoodev wants to merge 1 commit into
spring-projects:mainfrom
jewoodev:fix/gh-5966-pass-task-type

Conversation

@jewoodev
Copy link
Copy Markdown

@jewoodev jewoodev commented May 13, 2026

Summary

Forward the configured taskType into EmbedContentConfig so GoogleGenAiTextEmbeddingModel#call stops silently falling back to the SDK default.

Closes #5966.

  • Why: buildEmbeddingRequest merges taskType into the runtime options correctly, but call never passes it to EmbedContentConfig.Builder, so every request goes out with the SDK's default task type regardless of what the user set.

  • Fix: Pass options.getTaskType().name() to EmbedContentConfig.Builder#taskType(String) when a task type is set, mirroring the existing outputDimensionality block right above it.

Tests

Added regression coverage in GoogleGenAiTextEmbeddingModelTests for:

  • an explicit per-request taskType
  • the RETRIEVAL_DOCUMENT default from initializeDefaults()
./mvnw -pl models/spring-ai-google-genai-embedding test \
    -Dtest='GoogleGenAiTextEmbeddingModelTests'

Signed-off-by: jewoodev <jewoos15@naver.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Google GenAI Text Embedding does not pass task type to the API

1 participant