Skip to content

Conversation

@PrathamAditya
Copy link

Motivation and Context

This PR fixes issue #13250
by ensuring that the Google AI embedding connector correctly includes the taskType field in outgoing requests when EmbeddingGenerationOptions contains a task_type value.
Previously, the connector ignored this field, causing task-specific embeddings (RETRIEVAL_DOCUMENT, RETRIEVAL_QUERY, etc.) to default to generic embeddings.

Description

Changes
Extended GoogleAIEmbeddingRequest.FromData() to include an optional taskType parameter.
Updated GoogleAIEmbeddingClient to extract task_type from EmbeddingGenerationOptions.AdditionalProperties.
Added a new overload in GoogleAITextEmbeddingGenerationService to pass EmbeddingGenerationOptions while maintaining backward compatibility.
Added unit test FromData_Should_Include_TaskType_When_Provided to verify that "taskType" appears correctly in serialized JSON.

Contribution Checklist

@PrathamAditya PrathamAditya requested a review from a team as a code owner October 21, 2025 09:46
@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code kernel Issues or pull requests impacting the core kernel labels Oct 21, 2025
@github-actions github-actions bot changed the title Fix: include taskType in Google AI embedding request (fixes #13250) .Net: Fix: include taskType in Google AI embedding request (fixes #13250) Oct 21, 2025
@PrathamAditya
Copy link
Author

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kernel Issues or pull requests impacting the core kernel .NET Issue or Pull requests regarding .NET code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants