-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Add Google.GenAI ChatClient support with IChatClient polyfill #13404
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
…ension methods Co-authored-by: rogerbarreto <[email protected]>
|
@copilot the Directory.Packages.Props should also consider the $(TargetFramework) == net9.0, as we also build for this. Google.GenAI is already in the version 0.6.0, please update to the latest. |
…o 0.6.0 Co-authored-by: rogerbarreto <[email protected]>
Addressed in 1586f0e:
|
|
@copilot Remove any added [Experimental("SKEXP0070")] flag as this package is an alpha pre-release package and experimental API's are not needed to be flagged. |
Co-authored-by: rogerbarreto <[email protected]>
|
@copilot Now I need you to add similar set of unit tests in here as well as integration tests similar targeting the new ChatClientService. Keep in mind for the integration tests, Facts should be Theories accepting the |
…hatClient Co-authored-by: rogerbarreto <[email protected]>
Added in 4f6c91c:
All integration tests use |
|
@copilot I need to change a bit the strategy, actually the VertexAI and GenAI should be distinct extensions where the GenAI requires the ApiKey, VertexAI endpoint will expect instead of an Extension methods that accepts directly the Suggested prefixes. Update the unit tests accordingly, the integration tests can now be specific separate classes for each. |
…leVertexAIChatClient Co-authored-by: rogerbarreto <[email protected]>
Addressed in c8be251: Extension methods split:
Unit tests updated with separate tests for each extension type. Integration tests split into separate classes:
|
Motivation and Context
Adds
IChatClientimplementation for Google AI using theGoogle.GenAIlibrary, enabling M.E.AI abstractions support. SinceGoogle.GenAIonly supports NET 8+, this is gated behind#if NETconditionals.Description
New
GoogleGenAIChatClient- Internal polyfill implementingIChatClientbased on agent-framework referenceGoogle.GenAI.Client/Modelsfor chat completionsExtension methods for DI registration with distinct prefixes:
AddGoogleAIChatClient(modelId, googleClient, ...)- acceptsGoogle.GenAI.ClientdirectlyAddGoogleGenAIChatClient(modelId, apiKey, ...)- for Google GenAI with API key authenticationAddGoogleVertexAIChatClient(modelId, project?, location?, credential?, ...)- for Vertex AI with optionalGoogle.Apis.Auth.OAuth2.ICredential(uses environment discovery if null)IKernelBuilderextensions for all methodsPackage changes:
Google.GenAIv0.6.0 toDirectory.Packages.propsGoogle.Apis.AuthforICredentialtype support in VertexAI extensionConnectors.Google.csprojfor NET 8/9/10Unit tests:
GoogleGeminiChatClientTests.cs- Tests for ChatClient creation with API key, Google client, service ID, and exception handlingGoogleAIServiceCollectionExtensionsTests.cs- Tests for GenAI and VertexAI extension method registrationIntegration tests (separate classes for each API):
GeminiGenAIChatClientTests.cs- Chat tests for Google GenAIGeminiVertexAIChatClientTests.cs- Chat tests for Vertex AIGeminiGenAIFunctionCallingChatClientTests.cs- Function calling tests for Google GenAIGeminiVertexAIFunctionCallingChatClientTests.cs- Function calling tests for Vertex AIContribution Checklist
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.