Commit Graph
407 Commits
Author SHA1 Message Date
Eduard van Valkenburg 1874eebaba Python: small fix for Pinecone integrated embeddings (#10953)
### 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.
-->
Pinecone offers integrated embeddings, expended the way you can set up
for that
Made some fixes in the DeSer process of the vector stores to deal with
non-returned vectors.

Now (finally) uses local_embeddings field to allow the field to be
present but not used.

### 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 😄
2025-03-13 19:39:44 +00:00
Rashmi PawarandLakshmi Ramesh 28e9d11a98 Python: Nvidia Embedding Connector (#10410)
### Motivation and Context

This PR adds an Nvidia Embedding Connector. This connector enables
integration with NVIDIA NIM API for text embeddings. It allows you to
use NVIDIA's embedding models within the Semantic Kernel framework.

### Description

### 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: Lakshmi Ramesh <[email protected]>
2025-03-13 07:15:24 +00:00
Evan Mattson b3b20b7028 Python: Model dump json step info for Dapr step actor (#10946)
### Motivation and Context

Dapr is throwing an error while trying to dump the `step_info` model to
the state store. To avoid this, perform a `model_dump_json()` first and
then store.

<!-- 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

Fixes Dapr step info error.

<!-- 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 😄
2025-03-13 01:05:57 +00:00
Eduard van Valkenburg acf5156848 Python: Introducing the Pinecone Connector (#10886)
### 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.
-->
Introducing the Pinecone Vector Store and Collection
This also upgrades the dependencies to v6
Adding the ability to run with asyncio or GRPC

TODO:
- [x] Filtering
- [x] Tests 

### Description

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

Closes: #9928

### 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 😄
2025-03-12 20:14:45 +00:00
Rodrigo Martins RacanicciandEvan Mattson 63f140e704 Python: Improve test coverage (#10681)
### Motivation and Context

Adding more tests to improve overall coverage.

### Description

- adding tests for bedrock agent channel
- adding tests for bedrock model provider utils
- adding tests for mistral ai chat completion
- tests for bing search
- tests for google search

### 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: Evan Mattson <[email protected]>
2025-03-12 07:48:45 +00:00
Evan Mattson 87bc3d6bc1 Python: Support AzureAIAgent agent_id instead of assistant_id (#10908)
### Motivation and Context

The Azure Python SDK made an underlying change to move away from
`assistant_id` keyword arguments to now support `agent_id` keyword
arguments. Additionally, they now support a
`MessageTextUrlCitationAnnotation` and
`MessageDeltaTextUrlCitationAnnotation` for annotations.

<!-- 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

Update the `AzureAIAgent` to pass in `agent_id` in place of
`assistant_id`, and bring in support for the new annotation types.
- Updates samples to simpler patterns where needed.
- Updates unit tests.
- Closes #10852

Validated that our [AzureAIAgent + Azure AI Search
sample](https://github.com/microsoft/semantic-kernel/blob/main/python/samples/concepts/agents/azure_ai_agent/azure_ai_agent_azure_ai_search.py)
works properly:

---

```markdown
# User: 'Which hotels are available with full-sized kitchens in Nashville, TN?'

# Agent: In Nashville, TN, here are some hotel options that feature full-sized kitchens:

1. **Extended Stay Suites** - All suites include full-sized kitchens stocked with cookware, separate living and sleeping areas, and sofa beds. Some larger rooms have fireplaces and patios or balconies【3:0†source】.

2. **New Premium Rooms** - These newly furnished rooms are fully equipped with premium amenities, including a full kitchen, washer & dryer, and access to a fitness center. Units also include fireplaces and small outdoor balconies【3:1†source】.

3. **Conveniently Located Extended Stay** - This option offers a full kitchen along with a washer & dryer, and amenities such as free WiFi and a fitness center, located near downtown Nashville【3:3†source】.

4. **Inn with Functional Kitchens** - This inn provides living room suites and functional kitchens, situated conveniently near a lake and welcomes pets【3:4†source】.

These options provide a range of amenities for travelers looking for the convenience of a full-sized kitchen during their stay.

# User: 'Fun hotels with free WiFi.'

# Agent: Here are some fun hotels that offer free WiFi:

1. **Hotel with Rooftop Plaza** - Offers complimentary continental breakfast in the lobby and free Wi-Fi throughout the hotel. Its penthouse suites provide stunning views【7:0†source】.

2. **Lakeside Hotel** - Features newly redesigned rooms, an airport shuttle, and lakeside amenities including a resort-style pool. The hotel provides stylish new guestrooms with Internet TVs and free WiFi【7:3†source】.

3. **Downtown Hotel** - Located near the vibrant downtown area and the business district. This hotel offers free WiFi, local transportation, and a special treat of milk and cookies for guests【7:4†source】.

These hotels combine fun experiences with the convenience of free internet access for guests.
```

<!-- 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 😄
2025-03-11 13:21:23 +00:00
Eduard van Valkenburg 45f4234827 Python: Introducing the Faiss Connector (#10810)
### 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.
-->
This PR adds a FaissVectorStore and FaissCollection
Faiss is a really fast similarity search engine, which runs in memory.
You can also use GPU's with it, but you will have to build the package
yourself.

### Description
Closes #4130

TODO:
- [x] other index kinds
- [x] deal with distance functions
- [x] validate GPU setup
- [x] maybe subclass InMemoryCollection
- [x] tests

<!-- 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 😄
2025-03-11 09:19:49 +00:00
Eduard van Valkenburg b4456aac2b Python: restructured the client classes, agent verbs (#10834)
### 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.
-->
Added some extra ways to provide functions to the models, and allow more
things to be set in the client constructor, rather then the __call__
that get's called by the async context manager.

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
- This also splits the backend classes into a new file called
_open_ai_realtime.py keeping only the public classes available in the
open_ai_realtime.py file.
- Adds additional ways of setting up
- Adds usage of model_extra to set things up in the constructor

### 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 😄
2025-03-06 19:25:42 +00:00
Tao Chen 191f595f7d Python: Remove custom separator in Bedrock tool call fully qualified name (#10826)
### 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.
-->
Closes #10619 

Bedrock updated its rules on tool names. Previously, Bedrock disallowed
"-" in tool names, which is the default plugin name and function name
separator in SK. The solution was to use "_" as the separator. However,
this introduced a bug where the translation between the SK fully
qualified function names and the Bedrock tool names would fail if the
function name had an underscore.

Bedrock now allows "-" in tool names, so we can remove the custom logic
and just use the default.

Gemini also has rules on how tools are named. It doesn't recommend using
"-". The solution was to use "_" just like Bedrock. To address the bug
mentioned above, the solution is to use double underscores.

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
1. Remove Bedrock custom fully qualified function names.
2. Use double underscores for Gemini fully qualified function names.

TODO: Add a guide for SK function/plugin naming conventions.

### 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 😄
2025-03-06 18:39:42 +00:00
Tao Chen 1c9b1667b1 Python: Fix issues of Gemini parallel function call (#10813)
### 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 #10597 

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
1. Collapse consecutive tool call messages into a single tool message
with multiple function result items before sending the chat history to
the API.
2. Add unit test.

### 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 😄
2025-03-05 19:56:46 +00:00
Tao Chen 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 😄
2025-03-05 19:39:07 +00:00
Evan Mattson e7beb6a143 Python: Update Cross Language Test to get raw request and now raw response (#10799)
### Motivation and Context

In our cross language tests we were getting the raw request using a
custom logging transport class. This didn't show how to get the raw HTTP
response back after making the call to the OpenAI SDK.

<!-- 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 updates the cross language test to get the raw request and now
the raw response.

<!-- 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 😄
2025-03-05 19:18:59 +00:00
Evan Mattson fb70825df7 Python: Improve handling the Dapr process context (#10725)
### Motivation and Context

There is a bug in the current Dapr runtime code that prohibits trying to
get the Dapr process context out from a process once it's finished. This
is related to incorrect handling of serializing/deserializing the Dapr
process context. Additionally, in a state that handles
`KernelProcessStepState`, due to Dapr serialization constraints, the
step step injected to a step is not the actual object. We use Pydantic's
`model_validate` to get the actual step object, but and we need to make
sure we re-assign that object back to the underlying step state so the
objects don't diverge (`model_validate` creates a new object).

<!-- 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

Improve the handling for the Dapr process context so we're properly
serializing data through the Dapr process.
- Fixes the issue brought up in the discussion: #10234

<!-- 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 😄
2025-03-05 16:08:15 +00:00
Eduard van ValkenburgandEvan Mattson de54193a0f Python: Introducing Realtime Clients for OpenAI and Azure OpenAI (#10127)
### 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.
-->
Implements the OpenAI Realtime API with Semantic Kernel

### Description

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

Adds a RealtimeClientBase
Adds RealtimeEvents
Adds OpenAI and Azure Realtime clients

Closes: #10108

### 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]>
2025-03-04 07:44:10 +00:00
Tao Chen 8fd6da2bd8 Python: Improve Bedrock service setup docs (#10772)
### 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/9910

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
1. Add detailed instructions on how to setup one's environment to use
Bedrock services, including models and agents.
2. Re-enable bedrock integration tests.
3. Some other cleanups.

### 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 😄
2025-03-04 00:22:13 +00:00
Tao Chen 75453a1219 Python: Move to a thinner wrap for Bedrock Agent in Python (#10740)
### 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.
-->
Though the current Bedrock agent implementation uses a "thin wrap"
approach, it still has some abstractions that we don't want to maintain.
Just like what we have done for the other agents, we remove those
abstractions.

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
1. Update the Bedrock agent abstraction to be thinner.
2. Update samples and tests.

Note: The .Net implementation doesn't need to be updated as it was
already using a thinner wrap.
Note: This breaks the current usage pattern for Bedrock agents in
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
- [ ] I didn't break anyone 😄
2025-03-03 22:07:41 +00:00
Evan Mattson 0153073aa3 Python: Bump Python version to 1.22.1 for a release (#10751)
### Motivation and Context

Bump Python version to 1.22.1 for a release

<!-- 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

Bump Python version to 1.22.1 for a release

<!-- 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 😄
2025-03-03 12:03:18 +00:00
Evan Mattson 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 😄
2025-02-28 01:39:36 +00:00
Eduard van Valkenburg 16d48bbe0b Python: lazy create stores in integration tests (#10705)
### 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.
-->
Moved the import and creation of the store into methods that get called
when accessed only.

### 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 😄
2025-02-27 16:44:25 +00:00
Tao ChenandEvan Mattson 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]>
2025-02-27 20:22:05 +09:00
Eduard van ValkenburgandTao Chen 536edaa585 Python: Introducing the Chroma Connector with the new vector store design (#10678)
### 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 ChromaStore and ChromaConnector

Closes: #9926

### 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: Tao Chen <[email protected]>
2025-02-27 08:13:17 +00:00
Evan Mattson 174bdabf38 Python: Introduce feature decorator to allow for experimental and release candidate decorator usage (#10691)
### 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.
-->

This change is required to improve the flexibility and maintainability
of our feature annotation system. Previously, separate decorators (e.g.,
`experimental_function` and `experimental_class`) were used to mark
experimental features, resulting in code duplication and limiting our
ability to handle additional feature stages. As our SDK evolves, we need
a unified approach that can support multiple stages—such as
experimental, release candidate, and future states—while also allowing
version information for release candidate features to be centrally
managed.

### Description

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

This PR refactors our feature decorators by introducing a unified
`stage` decorator that updates the docstring and attaches metadata for
both functions and classes. Two convenience decorators, `experimental`
and `release_candidate`, are built on top of `stage`:
- The `experimental` decorator marks features as experimental and sets
an `is_experimental` attribute.
- The `release_candidate` decorator supports multiple usage patterns
(with or without parentheses and with an optional version parameter) to
mark features as release candidate and sets an `is_release_candidate`
attribute.

This unified approach reduces duplication, simplifies the codebase, and
lays the groundwork for easily extending feature stages in the future.

This decorator supports the following usage patterns:
- `@experimental` (for both classes and functions)
- `@release_candidate`  (no parentheses)
- `@release_candidate()`  (empty parentheses)
- `@release_candidate("1.21.3-rc1")`  (positional version)
- `@release_candidate(version="1.21.3-rc1")`  (keyword version)

### 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 😄
2025-02-27 00:17:54 +00:00
Tao Chen 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 😄
2025-02-26 22:32:47 +00:00
Evan Mattson 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 😄
2025-02-26 10:59:14 +00:00
K. Andrew Parker d91c96d4e1 Python: resolving #10642 - public events fail to propagate (#10643)
### Motivation and Context

Resolves #10642 -- failure of `KernelProcessEventVisibility.Public`
events to propagate.

### Description

First, `KernelProcessEvent` was configured to use enum values -- though
throughout the code, `KernelProcessEvent.visibility` is compared as an
enum.

Second, when handling events emitted by a KernelProcessStep, any
`Public` visibility events are/were passed through
`LocalStep.scoped_event` (which modifies the event's namespace) *before*
queueing up any matching edges on the source step. This change to the
event namespace effectively prevents the event from propagating (since I
don't know how we'd 'listen' for events on the local process handle from
within the function that builds that very process...)

Allowing `visibility` on `KernelProcessEvent` to be an enum, combined
with an exchange in the order of processing event messages (matching
event to edge _before_ re-emitting any events marked as 'Public') causes
public events to propagate as expected.

### Contribution Checklist

- [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 😄
2025-02-25 21:17:58 +00:00
Eduard van Valkenburg 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 😄
2025-02-24 11:16:10 +00:00
Evan MattsonandChris 2984423aa0 Python: Add support for AutoGen's 0.2 ConversableAgent (#10607)
### Motivation and Context

For those who use AutoGen's 0.2 `ConversableAgent`, we're providing
support in Semantic Kernel to run this agent type. This assumes one will
port their existing AG 0.2.X `ConversableAgent` code and run in Semantic
Kernel.

Note: as we move towards GA for our agent chat patterns, we are
analyzing how to support AutoGen agents with a shared time. This PR does
not provide support for the AG `ConversibleAgent` group chat patterns
that exist in the 0.2.X 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

Add support and samples for the AG 0.2.X ConversableAgent. 
- Add unit test coverage.
- Add samples and READMEs.
- Closes #10407

<!-- 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: Chris <[email protected]>
2025-02-20 11:11:05 +00:00
Evan Mattson 68448b1427 Python: Fix kernel parameter metadata input type arg to call type_ (#10603)
### Motivation and Context

To address a typing issue, we updated the kernel parameter metadata so
that the input type argument now calls `type` (configured as an alias)
rather than the model’s parameter `type_`. Previously, setting the alias
did not update the underlying `type_` attribute, leaving it as `None`.
As a result, when generating the JSON schema, the `parameter_type` was
omitted, causing some customers who sent `KernelFunctionMetadata` to the
OpenAI model to receive a 400 error due to a malformed schema.

<!-- 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

Revert the change and add a unit test to make sure we check for the
expected schema.

<!-- 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 😄
2025-02-19 10:40:40 +00:00
Eduard van ValkenburgandEvan Mattson 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]>
2025-02-19 00:40:51 +00:00
Evan Mattson 5cad2864df Python: Fix Infinite Recursion in Hashing Logic by Tracking Visited Objects (#10598)
### Motivation and Context

We encountered an issue where our hashing utility (`make_hashable(...)`)
could enter an infinite recursion loop whenever it encountered cyclical
references. This was particularly evident with Pydantic models that
reference each other (or themselves), or with dictionaries/lists that
recursively include a reference to an already-seen object. In such
scenarios, the function continued to expand and re-expand the same
objects indefinitely, triggering a RecursionError.

<!-- 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 introduced a visited dictionary in `make_hashable`. Before diving
deeper into any object -- whether it’s a dict, a list, a set, a tuple,
or a Pydantic model -- we record its id() in visited. The very next time
we see that same object ID, we immediately return its already-computed
placeholder or final representation, short-circuiting the cycle.
- Fixes #10592

<!-- 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 😄
2025-02-18 22:55:04 +00:00
Evan Mattson 76d101eafd Python: add AzureAIAgent client creation method. Handle user_agent. (#10538)
### Motivation and Context

We weren't sending the user_agent as part of client creation for the
AzureAIAgent. Create a convenience class method to create the
AIProjectClient, which handles creating the user_agent.

<!-- 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 a class method to create the AIProjectClient as part of
AzureAIAgent.
- handles configuring the user_agent.
- fixes a check where annotation content indices might not be present
- adds `/.default` to default entra scope
- adds unit tests
- closes #10527
- closes #10520

<!-- 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 😄
2025-02-14 05:20:24 +00:00
a03c5d6fdc Python: removes AWS "us." region prefix from model id (#10329)
### Motivation and Context

relates to this
[issue](https://github.com/microsoft/semantic-kernel/issues/10238).

<!-- 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 current implementation of `bedrock_model_provider.py` is hard coded
to return the zeroth element when splitting `model_id` on (`.`) periods.
However this will return an incorrect name for the provider when working
with an [inference
profile](https://docs.aws.amazon.com/bedrock/latest/userguide/inference-profiles.html)
since the `model_id` will contain the AWS region in the ID. For example,
a `model_id` can be `us.meta.llama3-XXX:0` and the call
`to_model_provider` will incorrectly try to look for a `us` model. This
error is thrown when we are selecting an LLM model using an AWS
inference profile.

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
I have made a change to the `to_model_provider` class method in the
`bedrock_model_provider.py` script that checks for a region prefix and
then strips it. I have not tested this against all AWS regions.

### 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
- [X] I didn't break anyone 😄

---------

Co-authored-by: Tao Chen <[email protected]>
Co-authored-by: Chris <[email protected]>
2025-02-13 22:22:50 +00:00
Evan Mattson 784f13e400 Python: Fix Chat History Agent format instructions regression. (#10512)
### Motivation and Context

The chat history agent templating was inadvertently broken. This PR
restores the functionality to be able to use templating with a Chat
Completion Agent.

<!-- 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 templating for a Chat Completion Agent. Add unit tests for more
coverage.
- Fix a unit test fixture that was annotated to return an AsyncMock, but
it's actually returning an async generator function.

<!-- 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 😄
2025-02-13 11:53:21 +00:00
892c2066da Python: Adding Crew.AI as a plugin. (#10474)
### Motivation and Context

Adding Crew.AI as a plugin to the Semantic Kernel will allow users to
leverage the capabilities of Crew.AI in app. This plugin works with
Crews that have been deployed to the Crew.AI Enterprise service.

### Description

Adding Crew.AI as a plugin to the Semantic Kernel will allow users to
leverage the capabilities of Crew.AI in app. This plugin works with
Crews that have been deployed to the Crew.AI Enterprise service.

The plugin functionality has been manually verified with the concept
samples. Other tests will come in the next update.

### 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: Ben Thomas <[email protected]>
Co-authored-by: Eduard van Valkenburg <[email protected]>
2025-02-13 04:19:14 +00:00
Eduard van Valkenburg cbfd7e9330 Python: improved content inits, added ndarray support for binary content and small fixes to defaults (#10469)
### 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.
-->
This PR adds support for ndarray's as the content carrier for all binary
content types (binary, image, audio) as that is more optimized for
larger content.

It also does some fixes to the initialization of those content types and
the underlying data uri type.

Also some fixes for unspecified default param in pydantic Field,
language servers do not recognize `Field("default value")` as having a
default, so changed those occurances to `Field(default="default value")`

### 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 😄
2025-02-12 16:59:08 +00:00
Eduard van Valkenburg 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 😄
2025-02-12 13:05:39 +00:00
Eduard van Valkenburg 9d5ad78fb2 Python: set openai package to newer version and removed default value of parallel tool calls (#10502)
### 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 noticed that the openai package dependency spec was off and did not
update that when present to the newest version, fixed now.
Also we mistakenly had a default value for parallel_tool_calls in our
prompt executions settings, as with other settings we do not maintain a
default value if the API has a default and in this case having that
parameter when calling a reasoning model threw an error, fixed 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: -->

- [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 😄
2025-02-12 10:16:33 +00:00
Evan Mattson 8f4efa5d10 Python: Allow for factory callbacks in the process framework (#10451)
### Motivation and Context

In the current Python process framework, in runtimes like Dapr, there is
no easy way to pass complex (unserializable) dependencies to a step --
this includes things like a ChatCompletion service or an agent of type
ChatCompletionAgent.

Similar to how the kernel dependency was propagated to the step_actor or
process_actor, we're introducing the ability to specify a factory
callback that will be called as the step is instantiated. The factory is
created, if specified via the optional kwarg when adding a step to the
process builder like:

```python
myBStep = process.add_step(step_type=BStep, factory_function=bstep_factory)
```

The `bstep_factory` looks like (along with its corresponding step)

```python
async def bstep_factory():
    """Creates a BStep instance with ephemeral references like ChatCompletionAgent."""
    kernel = Kernel()
    kernel.add_service(AzureChatCompletion())

    agent = ChatCompletionAgent(kernel=kernel, name="echo", instructions="repeat the input back")
    step_instance = BStep()
    step_instance.agent = agent

    return step_instance

class BStep(KernelProcessStep):
    """A sample BStep that optionally holds a ChatCompletionAgent.

    By design, the agent is ephemeral (not stored in state).
    """

    # Ephemeral references won't be persisted to Dapr
    # because we do not place them in a step state model.
    # We'll set this in the factory function:
    agent: ChatCompletionAgent | None = None

    @kernel_function(name="do_it")
    async def do_it(self, context: KernelProcessStepContext):
        print("##### BStep ran (do_it).")
        await asyncio.sleep(2)

        if self.agent:
            history = ChatHistory()
            history.add_user_message("Hello from BStep!")
            async for msg in self.agent.invoke(history):
                print(f"BStep got agent response: {msg.content}")

        await context.emit_event(process_event="BStepDone", data="I did B")
```

Although this isn't explicitly necessary with the local runtime, the
factory callback will also work, if desired.

<!-- 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

Adds the ability to specify a factory callback for a step in the process
framework.
- Adjusts the Dapr FastAPI demo sample to show how one can include a
dependency like a `ChatCompletionAgent` and use the factory callback for
`BStep`. Although the output from the agent isn't needed, it
demonstrates the capability to handle these types of dependencies while
running Dapr.
- Adds unit tests
- Closes #10409

<!-- 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 😄
2025-02-11 01:39:08 +00:00
Evan Mattson 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 😄
2025-02-07 02:11:10 +00:00
Eduard van ValkenburgandEvan Mattson c445f5ce51 Python: Implement MongoDB Atlas store (#10177)
Implement a new version of the MongoDB Atlas Memory Connector with
MongoDBAtlasStore and MongoDBAtlasCollection classes.

* **MongoDBAtlasStore**:
- Add
`python/semantic_kernel/connectors/memory/mongodb_atlas/mongodb_atlas_store.py`
to implement the MongoDBAtlasStore class.
- Add unit tests in
`python/tests/unit/connectors/memory/mongodb_atlas/test_mongodb_atlas_store.py`
to test the MongoDBAtlasStore class.

* **MongoDBAtlasCollection**:
- Add
`python/semantic_kernel/connectors/memory/mongodb_atlas/mongodb_atlas_collection.py`
to implement the MongoDBAtlasCollection class.
- Add unit tests in
`python/tests/unit/connectors/memory/mongodb_atlas/test_mongodb_atlas_collection.py`
to test the MongoDBAtlasCollection class.

---

For more details, open the [Copilot Workspace
session](https://copilot-workspace.githubnext.com/microsoft/semantic-kernel/pull/10177?shareId=e9e73180-0fff-4e60-bbb5-5c3493b27e61).

closes #6764

---------

Co-authored-by: Evan Mattson <[email protected]>
2025-02-06 03:49:29 +00:00
Tao ChenandEvan Mattson 35641b7213 Python: Allow AI Inference connector to use Azure AI Services resource (#10427)
### 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.
-->
Addresses: https://github.com/microsoft/semantic-kernel/issues/10339

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
Users can now use the Azure AI Services resource with the AI Inference
connector.

### 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]>
2025-02-06 00:15:53 +00:00
Tao Chen ce6002d9d2 Python: Add Bedrock agent integration tests (#10400)
### 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.
-->
Integration tests for Bedrock agents in Python

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
1. Add integration tests for Bedrock agent integration in
`python/tests/integration/agents/bedrock_agent`.
2. Restructure the agent concept samples folder.

### 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 😄

---

For more details, open the [Copilot Workspace
session](https://copilot-workspace.githubnext.com/microsoft/semantic-kernel/pull/10400?shareId=42d1f5cd-0a90-48c3-810f-bb2a6744026e).
2025-02-05 20:12:54 +00:00
Tao Chen 0a8c4d8afa Python: Update agent tracing span name and attributes (#10398)
### 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.
-->
Python parity with this PR:
https://github.com/microsoft/semantic-kernel/pull/10387

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
Update agent invoke span name and add attributes.

This is a breaking change: users who are currently relying on the span
name in their queries will need to update their queries to use the new
name or match new patterns. This is an experimental feature so breaking
changes are expected.

### 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 😄
2025-02-05 00:37:03 +00:00
Tao ChenandEvan Mattson 2a6cdd81a7 Python: Add unit tests for Bedrock agent integration (#10362)
### Motivation and Context
Add unit tests for Bedrock agent integration in Semantic Kernel 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? 

  3. What problem does it solve?
  5. What scenario does it contribute to?
  7. 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! -->
Code coverage for Bedrock agent related implementations reached 100%
except for the `bedrock_agent.py` file and `bedrock_agent_base.py` file,
which are at 82% and 95% respectively.


### 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 😄


For more details, open the [Copilot Workspace
session](https://copilot-workspace.githubnext.com/microsoft/semantic-kernel/pull/10362?shareId=f83b0466-6d2b-4639-88c8-23229aa2694c).

---------

Co-authored-by: Evan Mattson <[email protected]>
2025-02-05 00:29:04 +00:00
7c10d5f7f5 Python: Fixed Python bug when enable_json_response=True (#10376)
### Description
Fixed Python bug when enable_json_response=True

- Closes #10375

### Contribution Checklist

- [Y] The code builds clean without any errors or warnings
- [Y] 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
- [Y] All unit tests pass, and I have added new tests where possible
- [Y] I didn't break anyone 😄

Fixes #10375

---------

Co-authored-by: Adit Sheth <[email protected]>
Co-authored-by: Evan Mattson <[email protected]>
2025-02-05 00:16:56 +00:00
Tao Chen 1b85aa902c Python: Fix OpenAI assistant metadata type (#10383)
### 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.
-->
OpenAI Python SDK released 1.61.0 that contained a change which broke
code.

Changes in the release:
https://github.com/openai/openai-python/commit/12b87a4a1e6cb071a6b063d089585dec56a5d534

### Description

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

This pull request includes several changes to the `metadata` type and
the handling of `metadata` in various files, as well as updates to test
files to reflect these changes. The most important changes include
modifying the `metadata` type from `dict[str, Any]` to `dict[str, str]`
and updating the tests to use `json.dumps` for `metadata` values.

Note: this is a breaking change because if users are not passing in the
expected type before, they will need to update their code to pass in the
correct type now.

### 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 😄
2025-02-04 01:48:29 +00:00
Tao Chen 7789c5fe55 Python: Bedrock agent (#10307)
### 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.
-->
Address https://github.com/microsoft/semantic-kernel/issues/10284

Integration of AWS Bedrock agent to SK Python

### Description
1. Implementation of Bedrock agent in SK (essentially an agent connector
to the Bedrock agent service).
2. A dedicated channel that works with Bedrock agents.
3. Samples on how to use Bedrock agents.

Unit and integration tests will be included in another PR to prevent
this PR from becoming too big.

<!-- 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 😄
2025-01-31 19:44:39 +00:00
K. Andrew ParkerandEvan Mattson 10c1dfecb7 Python: [python] Bug fix 10340 (#10341)
### Motivation and Context

See #10340 

### Description

Implement a similar approach as is done in
`process_step_edge_builder.py`, which supports function_name when
building the target function.

### Contribution Checklist

- [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 😄

(well, we're still passing/xpass/xfail the same as main is)

---------

Co-authored-by: Evan Mattson <[email protected]>
2025-01-31 01:47:37 +00:00
Evan Mattson 605db09bce Python: intro allowed content types in chat history channel receive. Add mixed chat image sample. (#10347)
### Motivation and Context

During a group chat, any file reference content created by an assistant
agent, doesn't need to be communicated to a chat completion agent.
Filter these types out and only include other types, like text, if
available.

<!-- 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 a mixed chat image sample to have an assistant agent generate an
image, along with text, and call the chat completion agent successfully
with only the allowed types (like text).
- Adds a unit test to exercise the same behavior.
- Closes #10317

<!-- 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 😄
2025-01-30 23:36:47 +00:00
Rob Emanuele 3724e245be Python: Add vector search to Postgres connector (#10213)
### Motivation and Context

Following up on #8951, this PR adds an implementation of
`VectorSearchBase` to `PostgresCollection`. This implementation provides
vectorized search and does not implement text search or vectorizable
text search.

Unit and integration tests are added, and the
`python/samples/getting_started/third_party/postgres-memory.ipynb`
notebook was expanded to include vector search in the example.

### Contribution Checklist

- [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 😄
2025-01-30 15:44:49 +00:00