Bryan-Roe / semantic-kernel

Integrate cutting-edge LLM technology quickly and easily into your apps
https://bryan-roe.github.io/semantic-kernel/
Apache License 2.0
0 stars 3 forks source link

Bryan-Roe #495

Closed Bryan-Roe closed 3 months ago

Bryan-Roe commented 3 months ago

Motivation and Context

Description

Contribution Checklist

Summary by Sourcery

Introduce function choice behavior and enhance chat completion methods for GoogleAI and VertexAI connectors, including support for streaming completions and tool calls. Add new tests to verify the functionality and update prompt execution settings to handle tools and tool configurations.

New Features:

Enhancements:

Tests:

sourcery-ai[bot] commented 3 months ago

Reviewer's Guide by Sourcery

This pull request adds support for function choice behavior and auto-invoking functions in GoogleAI and VertexAI chat completions. It includes new utility functions, test cases, and updates to existing methods to handle function calls. Additionally, it introduces fields for tools and tool_config in chat prompt execution settings and adds a region parameter to VertexAI services.

File-Level Changes

Files Changes
python/semantic_kernel/connectors/ai/google/google_ai/services/google_ai_chat_completion.py
python/semantic_kernel/connectors/ai/google/vertex_ai/services/vertex_ai_chat_completion.py
Added support for function choice behavior and auto-invoking functions in chat and streaming chat completions.
python/semantic_kernel/connectors/ai/google/vertex_ai/services/utils.py
python/semantic_kernel/connectors/ai/google/google_ai/services/utils.py
Added utility functions for handling function choice behavior and formatting function calls.
python/tests/unit/connectors/google/google_ai/services/test_google_ai_chat_completion.py
python/tests/unit/connectors/google/vertex_ai/services/test_vertex_ai_chat_completion.py
Added new test cases for function choice behavior and updated existing test cases to include additional parameters.
python/semantic_kernel/connectors/ai/google/vertex_ai/vertex_ai_prompt_execution_settings.py
python/semantic_kernel/connectors/ai/google/google_ai/google_ai_prompt_execution_settings.py
Added fields for tools and tool_config in chat prompt execution settings.
python/semantic_kernel/connectors/ai/google/vertex_ai/services/vertex_ai_text_completion.py
python/semantic_kernel/connectors/ai/google/vertex_ai/services/vertex_ai_text_embedding.py
Added region parameter and updated vertexai.init calls to include region.

Tips - Trigger a new Sourcery review by commenting `@sourcery-ai review` on the pull request. - Continue your discussion with Sourcery by replying directly to review comments. - You can change your review settings at any time by accessing your [dashboard](https://app.sourcery.ai): - Enable or disable the Sourcery-generated pull request summary or reviewer's guide; - Change the review language; - You can always [contact us](mailto:support@sourcery.ai) if you have any questions or feedback.