Skip to content

Python: Google AI Connector - #7419

Merged
TaoChenOSU merged 15 commits into
microsoft:mainfrom
TaoChenOSU:taochen/google-connector
Jul 24, 2024
Merged

Python: Google AI Connector#7419
TaoChenOSU merged 15 commits into
microsoft:mainfrom
TaoChenOSU:taochen/google-connector

Conversation

@TaoChenOSU

@TaoChenOSU TaoChenOSU commented Jul 23, 2024

Copy link
Copy Markdown
Contributor

Motivation and Context

We are adding a new AI connector for the talking to the Gemini API on Google AI: https://ai.google.dev/gemini-api/docs/get-started/tutorial?authuser=1&lang=python.

Note that this is for Gemini hosted on Google AI. Google also offers Gemini access on their Vertex AI platform: https://cloud.google.com/vertex-ai/generative-ai/docs/migrate/migrate-google-ai. We will have another connector along with this for accessing Gemini on Vertex AI.

Description

The new connector contains 3 AI services:

  • Chat completion
  • Text completion
  • Text embedding

TODO: Function calling.

Function calling is not included in this PR to reduce to the size of the PR.

Unit test coverage:
image

Mypy: All cleared

Contribution Checklist

@TaoChenOSU TaoChenOSU added the python Pull requests for the Python Semantic Kernel label Jul 23, 2024
@TaoChenOSU TaoChenOSU self-assigned this Jul 23, 2024
@TaoChenOSU
TaoChenOSU requested a review from a team as a code owner July 23, 2024 21:40
@github-actions github-actions Bot changed the title Google AI Connector Python: Google AI Connector Jul 23, 2024
@TaoChenOSU TaoChenOSU linked an issue Jul 23, 2024 that may be closed by this pull request
Comment thread python/semantic_kernel/connectors/ai/google/google_ai/google_ai_settings.py Outdated
Comment thread python/semantic_kernel/connectors/ai/google/google_ai/services/utils.py Outdated
@TaoChenOSU
TaoChenOSU requested review from alliscode and moonbox3 July 24, 2024 15:03
@TaoChenOSU
TaoChenOSU requested a review from alliscode July 24, 2024 15:31
Comment thread python/pyproject.toml
Comment thread python/semantic_kernel/connectors/ai/google/google_ai/google_ai_settings.py Outdated
Comment thread python/semantic_kernel/connectors/ai/google/google_ai/services/utils.py Outdated
@TaoChenOSU
TaoChenOSU requested a review from moonbox3 July 24, 2024 17:37
@TaoChenOSU
TaoChenOSU added this pull request to the merge queue Jul 24, 2024
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 24, 2024
@TaoChenOSU
TaoChenOSU enabled auto-merge July 24, 2024 23:14
@markwallace-microsoft

Copy link
Copy Markdown
Contributor

Py3.10 Test Coverage

Python 3.10 Test Coverage Report
FileStmtsMissCoverMissing
semantic_kernel
   kernel.py157994%145, 156, 160, 200–201, 310–313, 422
semantic_kernel/connectors
   telemetry.py16288%18–19
semantic_kernel/connectors/ai/azure_ai_inference/services
   azure_ai_inference_chat_completion.py149497%169, 312, 416, 430
semantic_kernel/connectors/ai/embeddings
   embedding_generator_base.py8188%50
semantic_kernel/connectors/ai/hugging_face/services
   hf_text_completion.py54394%95, 103, 134
   hf_text_embedding.py32584%77–81
semantic_kernel/connectors/openapi_plugin
   openapi_manager.py58297%110–111
   openapi_parser.py88199%127
   openapi_runner.py105298%181–182
semantic_kernel/connectors/openapi_plugin/models
   rest_api_operation.py129199%240
semantic_kernel/functions
   kernel_function_decorator.py98199%102
   kernel_function_from_method.py96199%153
   kernel_function_from_prompt.py154795%165–166, 180, 200, 218, 238, 321
   kernel_plugin.py187299%472, 475
semantic_kernel/planners
   plan.py2344581%52, 161–163, 195, 212–225, 262, 267, 275–276, 286–289, 306, 311, 327, 330–335, 353, 358, 361, 363, 370, 384–386, 391–395
semantic_kernel/planners/function_calling_stepwise_planner
   function_calling_stepwise_planner.py116497%143, 187–188, 196
semantic_kernel/planners/sequential_planner
   sequential_planner.py64691%69, 73, 107, 123, 132–133
   sequential_planner_extensions.py50982%29–30, 52, 106–120
   sequential_planner_parser.py771284%64–72, 91, 115–118
semantic_kernel/schema
   kernel_json_schema_builder.py119596%48, 82, 204, 208–209
semantic_kernel/template_engine/blocks
   code_block.py77199%119
   named_arg_block.py43198%98
TOTAL733312498% 

Python 3.10 Unit Test Overview

Tests Skipped Failures Errors Time
1936 1 💤 0 ❌ 0 🔥 34.423s ⏱️

@TaoChenOSU
TaoChenOSU added this pull request to the merge queue Jul 24, 2024
Merged via the queue into microsoft:main with commit d162147 Jul 24, 2024
@TaoChenOSU
TaoChenOSU deleted the taochen/google-connector branch July 24, 2024 23:40
LudoCorporateShark pushed a commit to LudoCorporateShark/semantic-kernel that referenced this pull request Aug 25, 2024
### Motivation and Context

<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->
We are adding a new AI connector for the talking to the Gemini API on
Google AI:
https://ai.google.dev/gemini-api/docs/get-started/tutorial?authuser=1&lang=python.

Note that this is for Gemini hosted on Google AI. Google also offers
Gemini access on their Vertex AI platform:
https://cloud.google.com/vertex-ai/generative-ai/docs/migrate/migrate-google-ai.
We will have another connector along with this for accessing Gemini on
Vertex AI.

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->

The new connector contains 3 AI services:
- Chat completion
- Text completion
- Text embedding

TODO: Function calling.
> Function calling is not included in this PR to reduce to the size of
the PR.

Unit test coverage:

![image](https://github.com/user-attachments/assets/d4fefaa3-b24a-4b91-b29a-cadec5fa34fb)

Mypy: All cleared

### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [x] The code builds clean without any errors or warnings
- [x] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Pull requests for the Python Semantic Kernel

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Python: Add Gemini AI Connector

4 participants