-
Notifications
You must be signed in to change notification settings - Fork 4.3k
.Net: Fix: include taskType in Google AI embedding request (fixes #13250) #13277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@PrathamAditya please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
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