mirror of
https://github.com/microsoft/semantic-kernel.git
synced 2026-10-12 02:19:06 +00:00
9fa8eb2490084abc6dfabe2bf7955b041863b3d5
40
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
bd05515b8c |
Python: Temporarily skip OpenAI integration tests (#14517)
Disable failing OpenAI integration and sample cases while the CI API key returns HTTP 401. Keep other providers and OpenAPI cross-language coverage enabled. ### 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. --> ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [ ] The code builds clean without any errors or warnings - [ ] 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 - [ ] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone 😄 --------- Co-authored-by: Copilot App <[email protected]> |
||
|
|
b371cc6c6f |
Python: update dependencies (#14360)
## Summary - update Transformers and related Hugging Face packages - refresh Python dependencies used by the MCP OAuth demo - regenerate the affected uv lockfiles - adapt the Hugging Face text completion connector to Transformers 5 - temporarily disable live tests that depend on the retired Assistants API ## Hugging Face connector Transformers 5 removes the `text2text-generation`, `summarization` and `translation` pipeline tasks, so `HuggingFaceTextCompletion` raised `KeyError: Unknown task text2text-generation` on construction. Those two tasks now use a small adapter built on `AutoModelForSeq2SeqLM` and `AutoTokenizer` that preserves what the removed pipelines did: - the same output keys (`summary_text` for summarization, `generated_text` otherwise), so the content mapping is unchanged - the model's task specific prefix (e.g. `summarize: `) is still prepended before tokenization - one record per generated sequence when `num_return_sequences > 1` - `model_kwargs` are shared with the tokenizer load, as `pipeline()` did - pipeline only options are dropped with a warning instead of reaching `generate()` `text-generation` keeps using `pipeline()`. There is no public API change. The previous unit tests mocked `pipeline()` and so did not catch the incompatibility. New tests cover the adapter, option routing, device placement, output mapping and prefix resolution. ## Temporarily disabled tests The OpenAI and Azure OpenAI Assistants API has been retired. Live requests now return HTTP 410 (`assistants_api_deprecated`) on Azure OpenAI and HTTP 404 on OpenAI, so these tests cannot exercise a functioning service. - all 30 parametrized cases in `tests/integration/agents/openai_assistant_agent/test_openai_assistant_agent_integration.py` are skipped at module level, before the live-service fixture runs - the `step1_openai_assistant` case in `tests/samples/test_concepts.py` is skipped unconditionally - the other concept samples are unchanged - all 103 tests under `tests/unit/agents/openai_assistant` remain enabled and passing The skips are intentionally limited to live tests for the retired API. Comments next to each skip include the migration guide and state that the skip should be removed after the agents and sample move to the replacement API. ## Validation - uv lock consistency checks - 35 Hugging Face unit tests pass - all 12 deliberate connector mutations used to assess regression coverage were detected by the unit tests - all 103 Assistants agent unit tests pass - 30 live Assistants integration cases and the one retired-API concept sample report as skipped before making service requests - the three text completion services used by the integration suite were exercised against their real models on Transformers 5, for both completion and streaming - Ruff check and formatting pass --------- Co-authored-by: Evan Mattson <[email protected]> Co-authored-by: Copilot App <[email protected]> Copilot-Session: c2d4dd29-0a9c-4f43-b2ce-243e19ec34b2 |
||
|
|
003cc4c010 |
Python: Feature python vector stores preb (#12271)
### 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. --> Overhaul of the VectorStores to get it matching with dotnet and the latest development there. Closes: - #11938 - #11598 - #11597 - #11517 - #10561 - #10391 - #9911 - #9892 - #10867 ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> Many changes, some highlights: - Moved from different vector fields types, to a single with a enum first VectorStoreField() - Renamed several items - Made embeddinggenerrator a part of the vector field spec and do automatic vectorization from there or from the same param on a collection - Adds hybrid search using the same setup - Removed the intermediate TextSeachVectorSearch object need, by allowing `create_search_function` directly on a collection Will write out full changes in a migration guide in the docs. ### 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 - [ ] I didn't break anyone 😄 |
||
|
|
0634c30241 |
Python: marked planners deprecated and removed all related items (#12058)
### 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. --> In line with our dotnet, marking all planners as deprecated, and removing tests and samples using them. ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### 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 - [ ] I didn't break anyone 😄 --------- Co-authored-by: Evan Mattson <[email protected]> |
||
|
|
6115e8d7dc |
Python: fixes and updates for MCP (#12039)
### 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. --> Removes the two surpressed calls for extra info out of a MCP server, since they seemed to hang every now and then. Updated the package version spec Added one of the samples as a integration test Added: - load_tools flag on the constructor, default = true - load_prompt flag on the constructor, default = true - request_timeout param, optional, default None ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### 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 😄 |
||
|
|
ea3215ebb7 |
Python: Support Declarative Agent Spec for ChatCompletionAgent & AzureAIAgent (#11982)
### Motivation and Context This is the first installment of a series of PRs related to adding single agent declarative spec support. SK .NET has had support for single agent declarative specs for a bit now, and Python needs the functionality as well. This PR adds the core abstractions and functionality to be able to define agents via a declarative yaml spec. Declarative specs require the use of a kernel, and if in the case of function calling, require that any plugins defined in the spec already be present in the kernel. For naming, there are placeholder names that are camel case. This needs to be the case so it can match .NET. <!-- 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. --> ### Description Provide declarative spec support for ChatCompletionAgent and AzureAIAgent - Adds many samples to show the use of declarative specs to handle various AzureAIAgent + ChatCompletionAgent tools/plugins. - Closes #11978 <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### 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 😄 |
||
|
|
b07454aff8 |
Python: Fix OpenAIAssistantAgent/OpenAIResponsesAgent intermediate message ordering for invoke and invoke_stream (#12008)
### Motivation and Context This PR fixes a core issue in `OpenAIAssistantAgent` and `OpenAIResponsesAgent` where `FunctionCallContent` and `FunctionResultContent` messages were not being emitted in the correct order during `invoke()` and `invoke_stream()` execution. - `invoke_stream`: tool messages are now drained and emitted after each streamed assistant chunk, preserving causal ordering (tool call -> result -> assistant reply). - `invoke`: tool messages are emitted via callback immediately after the non-streaming response is received, ensuring they precede the final assistant message if applicable. ### Description Updated samples to better show how the callbacks are used to receive the intermediate messages in the proper order. - Added unit tests to ensure proper coverage and message ordering. - Closes #12007 ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [ ] The code builds clean without any errors or warnings - [ ] 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 - [ ] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone 😄 |
||
|
|
17e63a782b |
Python/.NET: Add a common agent invoke api. (#11116)
### Motivation and Context Being able to different invoke agents using a common API is useful to build higher level code on top of. ### Description Adding a common Invoke method with a common Thread object. ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [ ] The code builds clean without any errors or warnings - [ ] 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 - [ ] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone 😄 --------- Co-authored-by: Ben Thomas <[email protected]> Co-authored-by: Evan Mattson <[email protected]> Co-authored-by: Tao Chen <[email protected]> Co-authored-by: Ben Thomas <[email protected]> Co-authored-by: Mark Wallace <[email protected]> Co-authored-by: Evan Mattson <[email protected]> |
||
|
|
00afbdfc78 |
Python: removed old search plugins (#11035)
### 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. --> Removed some of the old search samples. ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### 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 😄 |
||
|
|
e1184aea74 |
Python: Add embedding and text completion samples (#10797)
### 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. --> Closing https://github.com/microsoft/semantic-kernel/issues/9963 ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> 1. Add text embedding and text completion samples. 2. Move the embedding generator base to a `semantic_kernel.connectors.ai`. ### 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 😄 |
||
|
|
fd27470c86 |
Python: Allow plugins via agent constructors. Update samples. (#10707)
### Motivation and Context
In Semantic Kernel, our goal is to simplify working with agents. When an
agent is created without a specified kernel, one is automatically
created on the user’s behalf. This enables developers to pass in a list
of plugins that are then added to the underlying kernel. If both the
agent constructor and the provided kernel include plugins, those
specified via the agent constructor take precedence—since plugins are
stored in a dictionary, any duplicate names result in the agent’s plugin
overwriting the existing one.
For the `ChatCompletionAgent`, usage is further simplified by allowing a
`ChatCompletionClientBase` service to be passed via the constructor. If
a kernel is supplied and already contains a chat completion service, the
new service is added to the kernel. Moreover, if no execution settings
are provided via KernelArguments, the first service registered on the
kernel is used.
New usage to create a ChatCompletionAgent
```python
agent = ChatCompletionAgent(
service=AzureChatCompletion(),
name="<name>",
instructions="<instructions>",
)
```
New usage to create a ChatCompletionAgent with plugins:
```python
agent = ChatCompletionAgent(
service=AzureChatCompletion(),
name="<name>",
instructions="<instructions>",
plugins=[SamplePlugin()],
)
```
Previously, the `service_id` constructor argument was retained after
introducing KernelArguments. However, with our transition to using the
kernel’s AI service selector, the `service_id` parameter has become
redundant. As we move from the experimental phase toward a release
candidate, removing `service_id` is a necessary, albeit breaking,
change.
The `getting_started_with_agents/chat_completion` samples now begin by
demonstrating the simplest way to configure the agent. The subsequent
step illustrates the original method for setting up the chat completion
service on the kernel. Similarly, for plugins, the initial approach is
the easiest to follow, while the following step shows the traditional
method of managing the kernel.
Updated documentation will follow, once these changes are released in a
new package.
!-- 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.
-->
### Description
Simplifying interactions with agents.
- Updated the `ChatCompletionAgent`, `AzureAssistantAgent`, and
`OpenAIAssistantAgent` classes with the `release_candidate` decorator in
place of the `experimental` decorator.
- Add a chat completion agent structured outputs sample
- Closes #10604
<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
### 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
- [ ] I didn't break anyone 😄
|
||
|
|
15ca7a7192 |
Python: Agent get_response API (#10701)
### 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. --> With the recent push for improving developer's quality of life, we have decided to make it easier for developers to get started with agents by introducing a new `get_response` API, that hides the complexity of interacting with agents when developers are ramping up with the Agent concept. ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> 1. Add the `get_response` API on all agent types. This API skips hides the intermediate steps of the agent execution and only returns the final results as a single message. 2. Add tests and samples. 3. Updates the `Agent` class to be an `ABC`, and adds `get_response`, `invoke`, and `invoke_stream` methods as overridable. ### 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 😄 --------- Co-authored-by: Evan Mattson <[email protected]> |
||
|
|
60df17d37d |
Python: Improve agent getting started samples (#10667)
### 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 improving developer experience by updating the agent getting started samples. ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> Simplify the agent getting started samples by removing unnecessary code and add excessive comments to make sure we are only doing what we need to get started. ### 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 😄 |
||
|
|
9e979f8463 |
Python: Improve/Simplify the Assistant Agents (#10666)
### Motivation and Context
The current abstractions we have around the Semantic Kernel Assistant
Agents are considered to be "fully-wrapped." This is beneficial in that
SK provides a tight/complete abstraction over the agent; however, it
doesn't scale well when new features are added to the underlying APIs
(OpenAI) - it requires updates from SK to make each and every update. It
also adds a lot more complexity in terms of needing to handle everything
in SK, requires more code coverage, and chances for bugs to surface due
to these complexities.
> **NOTE:** this update is _breaking_. We're moving to simplify the
abstractions/APIs before we move Assistant Agents from **experimental**
to GA.
Similar to how the `AzureAIAgent` was created, we're moving to a
"less-wrapped" abstraction around the OpenAI Assistant v2 APIs. We do
have some "convenience methods" on the Agents, via class methods, to
configure things like the code interpreter tool and resource, file
search tool and resource, the clients required to interact with the
Assistants, as well as being able to easily configure structured
outputs, similar to how it is done with a ChatCompletion (either provide
the Pydantic model or the Python class).
To work with Assistant Agents now, it's as simple as:
```python
from semantic_kernel.agents.open_ai import AzureAssistantAgent
from semantic_kernel.functions import kernel_function
class MenuPlugin:
# Plugin code here using the @kernel_function decorator
# Create the client using Azure OpenAI resources and configuration
client, model = AzureAssistantAgent.setup_resources()
# Create the assistant definition
definition = await client.beta.assistants.create(
model=model,
instructions="Answer questions about the menu.",
name="Host",
)
agent = AzureAssistantAgent(
client=client,
definition=definition,
plugins=[MenuPlugin()], # The plugins can be passed in as a list to the constructor
)
# Note: plugins can also be configured on the Kernel and passed in as a parameter to the OpenAIAssistantAgent
# Define a thread and invoke the agent with the user input
thread = await agent.client.beta.threads.create()
```
**I will create a migration guide (issue) showing what needs to be
updated from the previous usage to this new pattern.**
<!-- 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.
-->
### Description
This PR provides the new abstractions for the
`AzureAssistantAgent`/`OpenAIAssistantAgent` classes.
- Updates underlying code
- Updates samples showing new patterns
- Updates unit tests
- Updates READMEs.
- Closes #10605
Samples will be updated accordingly to show new patterns.
<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
### 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
- [ ] I didn't break anyone 😄
|
||
|
|
534d8609e3 |
Python: Introducing AzureCosmosDBforMongoDB store and collection (#10609)
### 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. --> Adds Azure Cosmos DB for MongoDB support using the new vector store model. Builds on the MongoDB Atlas integration, replaced the index creation and settings to make it work. Closes #6836 ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### 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 😄 |
||
|
|
374d8f91ce |
Python: filter improvements (#10588)
### 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. --> Fixes some inconsistency in the filter setup between dotnet and python Adds a sample for how to use a filter to retry a prompt with a different model. Adds a sample for semantic caching Closes: #10572 #5924 #10595 ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### 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 😄 --------- Co-authored-by: Evan Mattson <[email protected]> |
||
|
|
7bdf55028c |
Python: experimental py3.13 support (#10276)
### 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. --> Some small fixes in uv setup within actions Added experimental unit tests runs for py3.13 First typing improvement from pyright and pyright config. ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### 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 😄 |
||
|
|
c3ab713322 |
Python: Add support for Azure AI Agent Service (#10414)
### Motivation and Context Azure AI Agents are a managed offering, and are built on top of the OpenAI assistant v2 APIs. Until now we have not had support for them in SK Python. This PR adds support for Azure AI Agents in SK Python. The current abstractions allow one to run managed Azure AI Agents using SK constructs as is demonstrated via the getting started samples and/or the `azure_ai_agent` concept code samples. The developer must first follow the required Azure AI Agent deployment steps, and bring their connection string as well as their model deployment name. <!-- 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. --> ### Description Add support for Azure AI Agent Service in SK - Add sample code - Add unit tests - Restructures the `getting_started_with_agents` samples to move the respective agent code into folders like `chat_completion`, `azure_ai_agent`, etc. Updates the README as well. - Closes #10187 **TODO**: add more test coverage either in this PR, or a subsequent one. <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### 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 😄 |
||
|
|
0d8e3fd3af |
Python: Remove OpenAI plugin. Update OpenAPI exec params to use direct predicate reference (#10095)
### Motivation and Context Dotnet had long removed the OpenAI plugin from its code base, and Python did not follow at the time. We had previously provided deprecation messages around using the OpenAI plugin and to switch to the OpenAPI plugin. We are now removing the OpenAI plugin from the SK Python SDK. Additionally, there was a forward reference created without specifying the direct predicate context reference in the OpenAPIFunctionExecutionParameters. This put the burden on the dev to have to perform a model rebuild once the import was added. This PR cleans up the `OperationSelectionPredicateContext` import, which is now direct and via the sub-module and not via the parent module, which causes the __init__.py to load all dependencies (which is unnecessary). <!-- 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. --> ### Description This PR: - removes the unsupported OpenAI plugin (previously marked as deprecated) - fixes the `OperationSelectionPredicateContext` import to allow a user to create the func exec params without receiving a pydantic error. - updates unit tests to remove references to OpenAI plugin. <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### 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 - [ ] I didn't break anyone 😄 |
||
|
|
36701a2c73 |
Python: Include a function_invoke_attempt index with Streaming CMC (#10009)
### Motivation and Context During auto function calling, we're yielding all messages back without any indication as to which invocation index they are related to. This information could be helpful to the caller to understand in which order message chunks were received during the auto function invocation loop. Depending upon the behavior of auto function calling, the `request_index` iterates up to the `maximum_auto_invoke_attempts`. The caller doesn't know today which function auto invoke attempt they're currently on -- so simply handing all yielded messages can be confusing. In a new PR, we will handle adding the `request_index` (perhaps with a different name) to make it easier to know which streaming message chunks to concatenate, which should help reduce the confusion down the line. <!-- 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. --> ### Description This PR adds: - The `function_invoke_attempt` attribute to the `StreamingChatMessageContent` class. This can help callers/users track which streaming chat message chunks belong to which auto function invocation attempt. - A new keyword argument was added to the `_inner_get_streaming_chat_message_contents` to allow the `function_invoke_attempt` int to be passed through to the `StreamingChatMessageContent` creation in each AI Service. This **additive** keyword argument should not break existing. - Updates unit tests - Creates four new samples to showcase auto function calling: streaming auto invoke / manual invoke (print tool calls), and non-streaming auto invoke / manual invoke (print tool calls). These samples allow one to specify the AI service that supports function calling, as listed in the samples. - Closes #10006 <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### 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 😄 |
||
|
|
b1f4769ba5 |
Python: updated pydantic 2.10.3 works again (#9923)
### 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. --> Manual update to pydantic requirement, they fixed the incompatibility in 10.3 (10.<3 was broken). We need one more fix in Pydantic 2.10, which should come in 2.10.4: https://github.com/pydantic/pydantic/issues/10910 this is the issue: https://github.com/pydantic/pydantic/issues/11024 Comes into play with some of the vector stores. So excluded 2.10 smaller then 2.10.4. Closes #9788 ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### 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 😄 |
||
|
|
d8496da277 |
Python: improve integration test runs (#9845)
## 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. --> Split the integration tests into seperate ones for Memory and Completions Added code to allow the samples to run as well Moved containers to service containers. ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### 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 😄 |
||
|
|
8dadef26b8 |
Python: Refactor chat completion concept samples (#9822)
### 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. --> Our chat completion concept samples are not well organized and over-complicated with prompts and different settings. ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> This PR refactors the samples such that they only capture the essential concepts to the chat completion services. This PR also adds sample usage for all supported chat completion services in Semantic Kernel Python. ### 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 😄 |
||
|
|
c9ef719e2f |
Python: fix mypy pre-commit setup, mypy fixes (#9498)
### 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. --> Fixes the mypy pre-commit job, and subsequent fixes from there. Moved all python tests to use the uv setup task instead of manual cache, python install and uv install. ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### 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 😄 |
||
|
|
c304c8beca |
Python: restructure integration tests (#9331)
### 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. --> Our integration tests for the embedding services and memory are not set up in a way that makes it easy for developers to add test cases. ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> 1. Restructure the tests so that it's easier to add new tests when a new service is created. 2. Reduce duplicate code. 3. Add Ollama embedding service tests. > Note: Besides the new Ollama tests, no other tests are added or dropped. ### 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 😄 --------- Co-authored-by: Evan Mattson <[email protected]> |
||
|
|
dbf18199e0 |
Python: Restructure connector unit tests (#9316)
### 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. --> Folder restructure for our connector unit tests to align with the source folder structure. This makes it easier for developers to add future unit tests. No test cases are dropped or added. This PR only moves files around. In addition, we notice that the sequential planner fails occasionally with Azure OpenAI due to a new content policy. We decided to skip tests related to the sequential planner since we are no longer supporting it. ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### 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 😄 |
||
|
|
ee40e88c13 |
Python: Introduce Agent group chat functionality (#8184)
### Motivation and Context In the next phase of the agent work in Python, we are to introduce the ability to have agents interact with each other. Agent group chat allows developers to create richer and more dynamic agent interactions. <!-- 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. --> ### Description This PR introduces the following: - Agent group chat functionality via an `agent_chat` base class that forms the foundation for group chats. An `agent_group_chat` class extends that underlying functionality and provides an entry point to kick off the group chat either via invoking the chat for the defined agents, or specifying if a provided agent is to join the existing chat. - The required channels for the chat completion agent and assistant agent to properly chat together - Adds more concept samples and getting started with agent samples to enrich the onboarding experiencing for those wanting to see the capability of agents and agent group chat. - Adds unit test for near 100% coverage - Updates some existing imports for agents, which try and make the required import experience more intuitive. - Introduces assistant agent abstractions for working with files and vector stores so we don't directly expose the underlying client types. - Closes #7966 - Closes #7577 <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### 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 - [ ] I didn't break anyone 😄 |
||
|
|
a112da977f |
Python: Introducing Text To Image services (#8267)
### 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. --> Adds TextToImageClient base class Adds OpenAI and Azure OpenAI Text To Image Services Adds sample Closes: #8266 ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### 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 😄 |
||
|
|
9480d807cf |
Python: Introduce the non-chat, non-streaming OpenAIAssistantAgent, samples, and tests (#7477)
### Motivation and Context To align with SK dotnet and to allow SK Python devs to leverage the OpenAI/Azure OpenAI assistants, this code is a required component for SK Python. <!-- 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. --> ### Description We're introducing the code to build non-chat, non-streaming OpenAIAssistantAgents for both the OpenAI and Azure OpenAI styles. This PR introduces: - The required code to create OpenAI/AzureOpenAI assistants using the v2 library. - Samples showing how to create the agent, and how to use the tool resources like the code interpreter and file search. - Unit test coverage at 100% - Full mypy coverage - Closes #7080  One to-do item: - introduce Agent integration tests Note: streaming assistant agent support will come in the next PR. <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### 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 😄 |
||
|
|
79207ffbbc |
Python: Migrate to Ollama Python SDK (#7165)
### 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. --> ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> Currently, the Ollama AI connector uses `aiohttp` sessions to interface with the local Ollama LLM service. However, we have made the decision to transition to the official Ollama Python SDK. Related to: https://github.com/microsoft/semantic-kernel/issues/6841, https://github.com/microsoft/semantic-kernel/issues/7134 Test coverage report:  MyPy warnings: 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 😄 |
||
|
|
240280a37b |
Python: Introduce the single, non-group chat completion agent (#7116)
### Motivation and Context Following in the steps of dotnet, we're beginning to add agent support to Python. For an initial implementation the focus is on non-grouped, chat completion agents. The first pass is covering a ChatCompletionAgent that allows the user to define a ChatCompletion Service as part of the SK Kernel, and then reference that service in an agent implementation. <!-- 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. --> ### Description The PR: - Adds support for a standard chat completion agent - Adds the required abstractions to allow the single chat completion agent to work - Introduces a new agent concept sample showing how to invoke the agent for a streaming and non-streaming context. - Adds unit tests to cover the new code - Closes #7079  <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### 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 😄 |
||
|
|
5779b7d3be |
Python: Verify local models in Ollama and LM Studio are compatible with the OpenAI connector (#6973)
### 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. --> Related to https://github.com/microsoft/semantic-kernel/issues/6498 The use of local models presents a twofold benefit for developers: increased flexibility and reduced costs. Ollama and LM Studio are two well-known platforms that facilitate the hosting of models locally, both of which offer compatibility with OpenAI endpoints. As such, it is imperative that our OpenAI connector functions correctly when users are operating models on these platforms. ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> 1. Verify that our OpenAI connector works as expected with models hosted locally using Ollama and LM Studio. 2. Create three new samples (Ollama/chat, LM Studio/chat, LM Studio/Embedding) under `/concepts/local_models` to show how to using local models with the OpenAI connector. 3. Fix a bug in `test_sample_utils.py` where if a test case is retried and input was never reset. ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [ ] The code builds clean without any errors or warnings - [ ] 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 - [ ] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone 😄 |
||
|
|
ed24889b7d |
Python: removed google palm (#7051)
### 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. --> Since Google Palm will be deprecated soon, removing Google Palm from SK. Closes #6362 ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### 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 - [ ] I didn't break anyone 😄 |
||
|
|
8381e50e8b |
Python: Introduce the new function calling abstraction, FunctionChoiceBehavior (#6910)
### Motivation and Context The current `FunctionCallBehavior` has allowed us to utilize auto function calling for OpenAI type models. As we proceed to support more AI connectors, that differ from OpenAI models, we need to be able to handle functions for all models that support function calling. <!-- 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. --> ### Description In this PR: - We introduce a new function calling abstraction called `FunctionChoiceBehavior` which has three types: Auto, Required, and None. - One is able to configure the `function_choice_behavior` along with fully qualified function names (e.g., plugin1.function1), `maximum_auto_invoke_attempts` or `auto_invoke_kernel_functions` in yaml and JSON prompts. We have a new concept example showing how to do this for for yaml and JSON prompts. - If the fully qualified names are specified in the config file, they take precedence over the filters, if specified at a later point. - To make sure this isn't a breaking change, we still handle the previous `FunctionCallBehavior`, but so we can make decisions on the new `FunctionChoiceBehavior` we map the `FunctionCallBehavior` to `FunctionChoiceBehavior`. Each time `FunctionCallBehavior` is updated, `FunctionChoiceBehavior` will be updated, too. - The `_process_tool_call()` method in the `open_ai_chat_completion_base` needs to maintain the argument name as `function_call_behavior` as we cannot introduce a breaking change. - All concept samples have been converted to use `FunctionChoiceBehavior`. - New unit tests have been added for `FunctionChoiceBehavior` and we still currently support `FunctionCallBehavior` tests to make sure we haven't broken the backwards compatibility. - Added `deprecated` typing decorators to classes/methods to alert users that it would be best to transition to `FunctionChoiceBehavior` even though `FunctionCallBehavior` is still supported. - The `FunctionCallingStepwisePlanner` was updated to use the new `FunctionChoiceBehavior`. - Closes #6496, #6458 - Addresses #6626 <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### 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 😄 |
||
|
|
d30250f6a2 |
Python: custom service selector sample (#6802)
### 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. --> ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [ ] The code builds clean without any errors or warnings - [ ] 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 - [ ] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone 😄 |
||
|
|
17bf855262 |
Python: Fix sample plugin path for Windows. Re-enable samples CI tests. (#6691)
### Motivation and Context Fix sample plugin path for Windows. Re-enable samples CI tests. <!-- 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. --> ### Description Fix sample plugin path for Windows. Re-enable samples CI tests. - Tests passing locally on both MacOS and Windows. - Adds logic to each notebook to properly set up the correct path to find imports. Notebooks should now run out of the box to close #6588 - Added retry logic for the samples tests to retry 3 times in the event of a failure. - Install notebook pip package at kernel level instead of shell level - Updated all occurrences of `gpt-3.5-turbo-1106` to `gpt-3.5-turbo` which is `gpt-3.5-turbo-0125`. The GH Action code quality check was failing for this same code in #6675, so this is superseding it. Now that the GH actions are fixed, this also supersedes #6681. <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### 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 😄 |
||
|
|
05dcb29dea |
Python: Support for image content and chat message content with image content (#6520)
### 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. --> Introduces a ImageContent class Allows that type to be part of ChatMessageContent Adds a sample for both local and online images Adds many tests with data uri edge cases, and binary parsing edge cases. Closes #6536 ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### 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 😄 |
||
|
|
a2720a605d |
Python: Fix broken concept samples. Run concept examples as tests. (#6660)
### Motivation and Context We had many broken concept examples. These samples are also not covered by tests so it's hard to know when things are out of sync. <!-- 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. --> ### Description Fix the Python concept samples, and also cover them with tests so we aren't checking in code that is going to break them. <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### 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 😄 |
||
|
|
e03b3fa168 |
Python: Run notebooks as tests (#6430)
### 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. --> Run notebooks as tests, working for all gettings started notebooks. Also updated learn resources samples test, this can now easily be extended with other sample scripts. Closes: #4637 Partially closes: #4638 ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### 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 😄 |
||
|
|
172e93113e |
Python: updated samples (#6411)
### 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. --> Updated samples for MS Learn, with tags. ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### 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 😄 --------- Co-authored-by: Evan Mattson <[email protected]> |