Commit Graph
897 Commits
Author SHA1 Message Date
Evan Mattson cd84e87798 Python: Bump Python version to 1.21.1 for a release. (#10539)
### Motivation and Context

Bump Python version to 1.21.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.21.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-02-14 05:38:51 +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
dependabot[bot] c2ebc3dab5 Python: Update motor requirement from <3.7.0,>=3.3.2 to >=3.3.2,<3.8.0 in /python (#10378)
Updates the requirements on [motor](https://github.com/mongodb/motor) to
permit the latest version.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/mongodb/motor/releases">motor's
releases</a>.</em></p>
<blockquote>
<h2>Motor 3.7.0</h2>
<p>Community notes: <a
href="https://www.mongodb.com/community/forums/t/motor-3-7-0-released/311077/3">https://www.mongodb.com/community/forums/t/motor-3-7-0-released/311077/3</a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/mongodb/motor/blob/master/doc/changelog.rst">motor's
changelog</a>.</em></p>
<blockquote>
<h2>Motor 3.7.0</h2>
<ul>
<li>Add support for PyMongo 4.10.</li>
<li>Drop support for Python 3.8.</li>
<li>Drop support for MongoDB 3.6.</li>
</ul>
<h2>Motor 3.6.1</h2>
<ul>
<li>Add return type to to_list method in stub file.</li>
<li>Fix ability to install pymongo from source while testing.</li>
</ul>
<h2>Motor 3.6.0</h2>
<ul>
<li>Add support for MongoDB 8.0 and PyMongo 4.9.</li>
<li>The length parameter in :meth:<code>MotorCursor.to_list</code> is
now optional.</li>
</ul>
<p>.. note::</p>
<p>This is the last planned minor version of Motor. We are sunsetting
Motor in favor of native
asyncio support in PyMongo 4.9+. We will continue to provide security
releases and bug fixes for
Motor, but it will not gain new features.</p>
<h2>Motor 3.5.1</h2>
<ul>
<li>Fix runtime behavior of Motor generic class typing, e.g.
<code>client: AsyncIOMotorClient[Dict[str, Any]]</code>.</li>
</ul>
<h2>Motor 3.5.0</h2>
<ul>
<li>Drop support for Python 3.7.</li>
<li>Switch to using Hatchling as a build backend and remove
<code>setup.py</code>.</li>
<li>Add Secure Software Development Life Cycle automation to release
process.
GitHub Releases for pymongocrypt now include a Software Bill of
Materials, and signature
files corresponding to the distribution files released on PyPI.</li>
</ul>
<h2>Motor 3.4.0</h2>
<ul>
<li>Type hint bug fixes and improvements. Added typings to classes in
<code>motor_tornado</code> and
<code>motor_asyncio</code>.</li>
</ul>
<h2>Motor 3.3.2</h2>
<ul>
<li>Fix incorrect type hints for the following:
:meth:<code>MotorCursor.to_list</code>,
:meth:<code>MotorCollection.name</code>,
:meth:<code>MotorDatabase.get_collection</code>,
:meth:<code>MotorClientSession.with_transaction</code></li>
<li>Fix a bug that caused application-supplied DriverInfo to be
overwritten.</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/mongodb/motor/commit/251d2a088c4aaf5a4facae4d8c8c2a27a49999f7"><code>251d2a0</code></a>
BUMP 3.7.0</li>
<li><a
href="https://github.com/mongodb/motor/commit/381fdfbde0f93ac0756a2a21a3f934cf767ac0d7"><code>381fdfb</code></a>
PYTHON-5047 Fix dry run logic in releases yet again (<a
href="https://redirect.github.com/mongodb/motor/issues/323">#323</a>)</li>
<li><a
href="https://github.com/mongodb/motor/commit/9cf90a8898626e5ded3a80e2865d27e6cd607881"><code>9cf90a8</code></a>
In documentation clarify the purpose behind client creation. (<a
href="https://redirect.github.com/mongodb/motor/issues/320">#320</a>)</li>
<li><a
href="https://github.com/mongodb/motor/commit/0259b9f5a892dbac8a5f8db4a8a2beff8cbd309d"><code>0259b9f</code></a>
PYTHON-5047 Improve testing of publish workflows (<a
href="https://redirect.github.com/mongodb/motor/issues/322">#322</a>)</li>
<li><a
href="https://github.com/mongodb/motor/commit/932bb7382e60543043cd02604348a0a469146cc6"><code>932bb73</code></a>
MOTOR-1423 Restore compatibility with latest pymongo (<a
href="https://redirect.github.com/mongodb/motor/issues/319">#319</a>)</li>
<li><a
href="https://github.com/mongodb/motor/commit/1433773db472434b6b1a9bfdca9314b7f657f627"><code>1433773</code></a>
PYTHON-5062 Add GitHub Actions CodeQL scanning (<a
href="https://redirect.github.com/mongodb/motor/issues/321">#321</a>)</li>
<li><a
href="https://github.com/mongodb/motor/commit/459760f4b4d644f60787875a3ee54703b556df74"><code>459760f</code></a>
BUMP 3.6.2.dev0</li>
<li><a
href="https://github.com/mongodb/motor/commit/b9547fa9c2c1cc6ad084213513b9bb643aa70e89"><code>b9547fa</code></a>
BUMP 3.6.1</li>
<li><a
href="https://github.com/mongodb/motor/commit/b4f887bf9519228ddc813c8f67911bed64326413"><code>b4f887b</code></a>
Add changelog for 3.6.1 (<a
href="https://redirect.github.com/mongodb/motor/issues/317">#317</a>)</li>
<li><a
href="https://github.com/mongodb/motor/commit/c1df3a2105e2d419f3f70cc3c1e3584b1e2a88ed"><code>c1df3a2</code></a>
MOTOR-1420 Use generic return type for to_list() (<a
href="https://redirect.github.com/mongodb/motor/issues/318">#318</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/mongodb/motor/compare/3.3.2...3.7.0">compare
view</a></li>
</ul>
</details>
<br />


Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-13 21:11:04 +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
Evan Mattson 9c9b03b35f Python: Bump Python version to 1.21.0 for a release. (#10500)
### Motivation and Context

Bump Python version to 1.21.0 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.21.0 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-02-12 17:29:01 +00:00
Evan Mattson 56bd3945c4 Python: Add Azure AI Agent AI Search Sample. Update memory sample with README. (#10497)
### Motivation and Context

To showcase other ways to interact with Azure AI Agents, we're adding a
sample that leverages the Azure AI Search tool.

<!-- 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 Azure AI Agent with AI Search sample. 
- Includes README and hopefully enough information to get started.
Assumes the user is able to set up the hotels-sample-index with the
proper data model fields (outlined in SK).
- Updates the memory samples with a README to help make the usage more
clear
- Update the default termination strategy max iterations from 1 to 5.

<!-- 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 17:21:50 +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
Evan Mattson dc6ca1afad Python: Fix csv file paths for learn site sample. Improve streaming output formatting with code present (#10498)
### Motivation and Context

The code sample located
[here](https://learn.microsoft.com/en-us/semantic-kernel/frameworks/agent/examples/example-assistant-code?pivots=programming-language-python)
had an issue loading the resource csv files right out of the box.
Additionally, the formatted output could use some help.

Now the output is formatted nicely like:

---
To provide a column chart of the top 10 countries by population with
values at the top of each column, I'll need to examine the contents of
the uploaded files. Let's first take a look at the data in these files
to understand their structure and content.

```python
import pandas as pd

# Load the uploaded files to inspect their contents
file_1_path = '/mnt/data/assistant-T1tWYT1f5Y8JFRuYtxgjck'
file_2_path = '/mnt/data/assistant-LUgpebvSh4PTrFdEkVEXMi'

# Try reading the files into pandas dataframes
try:
    data_1 = pd.read_csv(file_1_path)
except Exception as e:
    data_1 = str(e)

try:
    data_2 = pd.read_csv(file_2_path)
except Exception as e:
    data_2 = str(e)

data_1, data_2
```

The first file seems to contain regional population data for various
provinces and states within countries, such as Belgium and the US. The
important columns for this task are:
- `Country_Region`: the name of the country
- `Population`: the population of the region

The second file provides population data by country, which seems more
appropriate for finding the top 10 countries by population. It contains:
- `Country_Region`: the name of the country
- `Population`: the population of the country

We'll use the second file to extract the top 10 countries by population
and create a column chart with the population values displayed on top.
Let's proceed with this analysis.

```python
import matplotlib.pyplot as plt
import seaborn as sns

# Use the second data set which has per country data
country_data = data_2

# Sort by Population and select the top 10 countries
top_10_countries = country_data.sort_values(by='Population', ascending=False).head(10)

# Plotting
plt.figure(figsize=(12, 8))
sns.barplot(data=top_10_countries, x='Country_Region', y='Population', palette='viridis')
plt.xticks(rotation=45)
plt.title('Top 10 Countries by Population')
plt.xlabel('Country')
plt.ylabel('Population')

# Adding population values on top of each bar
for index, row in top_10_countries.iterrows():
    plt.text(index, row['Population'], f"{row['Population']:,}", color='black', ha="center")

plt.tight_layout()
plt.show()

```
---

<!-- 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 formatting and csv links for a learn resource sample.
- Will update the learn site after this PR is approved.
- Although not directly related to the server-side errors from the Azure
Assistant Agent, this issue is related: #10482


<!-- 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 15:40:56 +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 a7fe8e86db Python: Remove old references of plugin import (#10462)
### Motivation and Context

We had two places in code that showed how to perform a plugin import
using old code - `kernel.import_plugin...`.

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

Removes old old comments, replacing it with the current
`kernel.add_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
- [X] I didn't break anyone 😄
2025-02-11 02:02:22 +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
David A. TorresandEvan Mattson 3461ed6d4d Python: Fixes to Cosmos DB NoSQL query syntax generation. (#10373)
### Motivation and Context

Review information:
1. Why is this change required?

There were several SQL query syntax generation issue for both
text_search() and vectorized_search() methods

2. What problem does it solve?

a) In `_build_where_clauses_from_filter()` the WHERE clause creation did
not quote string values and did not properly handle list[] data model
attribures,
b) for `_build_vector_query()` method the WHERE clause was placed after
the ORDER BY clause causing query syntax errors,
c) for `_build_search_text_query()` method the data_model_definition
items were not being interrogated, thus added `CONTAINS()` in the WHERE
clause.

3. What scenario does it contribute to?

The ability to use Azure Cosmos DB NoSQL for `text_search()` and
`vectorized_search()`.

4. Issue resolution: 
#10368 


### Description

The errors noted in the Issue and the bug fixes noted above correct the
SQL query syntax generation for the `text_search()` and
`vectorized_search()` methods and now produce accurate results for
performing both types of queries with and without filters (aka WHERE
clause).

### Contribution Checklist

- ✅ 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-02-06 04:19:53 +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
4d2b2be2d0 Python: Bug: Type Definition Error ImageContent (#10395)
### Motivation and Context  
1. This change is required because IDE type-checking throws an error
when manually passing values (e.g., Base64 strings) to ImageContent’s
constructor.
2. It fixes the missing argument definitions (data, data_uri,
data_format, mime_type), which caused the type error in IDEs like VS
Code.
3. It resolves the issue reported where users observed IDE-type errors
despite code functioning at runtime.
   
### Description  
• Added explicit type definitions (data, data_uri, data_format,
mime_type) in the ImageContent class constructor and fields.
• Updated the docstring and __init__ to reflect the new arguments.    
• Ensured the code maintains backward compatibility by preserving
existing methods like from_image_file.
• Verified that type-checking in major Python IDEs now passes without
warnings.

### Example

```
import asyncio
import base64

from semantic_kernel.connectors.ai.open_ai.services.azure_chat_completion import AzureChatCompletion,
from semantic_kernel.contents import AuthorRole, ChatHistory, ImageContent
from semantic_kernel.contents.chat_message_content import ChatMessageContent
from semantic_kernel.contents.text_content import TextContent


async def main():
    service = AzureChatCompletion(
        api_key="************************",
        deployment_name="gpt-4o-mini",
        endpoint="https://************************.openai.azure.com",
        api_version="2024-12-01-preview",
    )

    chat_history = ChatHistory()

    # example of base64 image
    # or `ImageContent.from_image_file`
    with open("weather_icon.png", "rb") as image_file:
        b64_string = base64.b64encode(image_file.read()).decode("utf-8")

    chat_history.add_message(
        ChatMessageContent(
            role=AuthorRole.USER,
            items=[
                ImageContent(
                    data_uri=f"data:image/png;base64,{b64_string}",
                    data_format="base64",
                    mime_type="image/png",
                ),
                TextContent(text="what is the weather"),
            ],
        )
    )
    response = await service.get_chat_message_contents(
        chat_history=chat_history,
        settings=service.get_prompt_execution_settings_class()(),
    )

    print(response[0].content)
    # >> The icon you provided typically represents sunny or clear weather.
    # >> If you need specific weather information for a location,
    # >> please provide the location or check a reliable weather service for the latest updates.


asyncio.run(main())
```   

### Contribution Checklist  
- [x] The code builds clean without any errors or warnings    
- [x] The PR follows the SK Contribution Guidelines and the
pre-submission formatting script 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]>
Co-authored-by: Evan Mattson <[email protected]>
2025-02-05 02:44:24 +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
dependabot[bot]andEvan Mattson 583cbad6c0 Python: Bump google-cloud-aiplatform from 1.60 to 1.79.0 in /python (#10377)
Bumps
[google-cloud-aiplatform](https://github.com/googleapis/python-aiplatform)
from 1.60 to 1.79.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/googleapis/python-aiplatform/releases">google-cloud-aiplatform's
releases</a>.</em></p>
<blockquote>
<h2>v1.79.0</h2>
<h2><a
href="https://github.com/googleapis/python-aiplatform/compare/v1.78.0...v1.79.0">1.79.0</a>
(2025-01-28)</h2>
<h3>Features</h3>
<ul>
<li>Add machine_spec, data_persistent_disk_spec, network_spec,
euc_config, shielded_vm_config to
<code>.google.cloud.aiplatform.v1beta1.NotebookRuntime</code> (<a
href="https://github.com/googleapis/python-aiplatform/commit/4620e6f0b0623e18b6e676f4183e972c8ad7e89e">4620e6f</a>)</li>
<li>Add machine_spec, data_persistent_disk_spec, network_spec,
euc_config, shielded_vm_config to message
<code>.google.cloud.aiplatform.v1.NotebookRuntime</code> (<a
href="https://github.com/googleapis/python-aiplatform/commit/4620e6f0b0623e18b6e676f4183e972c8ad7e89e">4620e6f</a>)</li>
<li>Add per-modality token count break downs for GenAI APIs (<a
href="https://github.com/googleapis/python-aiplatform/commit/4620e6f0b0623e18b6e676f4183e972c8ad7e89e">4620e6f</a>)</li>
<li>Add per-modality token count break downs for GenAI APIs (<a
href="https://github.com/googleapis/python-aiplatform/commit/4620e6f0b0623e18b6e676f4183e972c8ad7e89e">4620e6f</a>)</li>
<li>Add speculative decoding spec to DeployedModel proto (<a
href="https://github.com/googleapis/python-aiplatform/commit/4620e6f0b0623e18b6e676f4183e972c8ad7e89e">4620e6f</a>)</li>
<li>Enable FeatureGroup IAM Methods in v1beta1 API version (<a
href="https://github.com/googleapis/python-aiplatform/commit/4620e6f0b0623e18b6e676f4183e972c8ad7e89e">4620e6f</a>)</li>
<li>Enable FeatureView Service Account in v1 API version (<a
href="https://github.com/googleapis/python-aiplatform/commit/4620e6f0b0623e18b6e676f4183e972c8ad7e89e">4620e6f</a>)</li>
<li>Enable UpdateFeatureMonitor in v1beta1 API version (<a
href="https://github.com/googleapis/python-aiplatform/commit/4620e6f0b0623e18b6e676f4183e972c8ad7e89e">4620e6f</a>)</li>
<li>Expose code execution tool API to v1 (<a
href="https://github.com/googleapis/python-aiplatform/commit/4620e6f0b0623e18b6e676f4183e972c8ad7e89e">4620e6f</a>)</li>
<li>GenAI Evaluation: Release GenAI Evaluation SDK Autorater
Config/Tuning/Evaluation to vertexai.preview module. (<a
href="https://github.com/googleapis/python-aiplatform/commit/4531d08c1c9c4a1949f532be9d2beddc53d154b1">4531d08</a>)</li>
<li>Reasoning Engine v1 GAPIC release (<a
href="https://github.com/googleapis/python-aiplatform/commit/4620e6f0b0623e18b6e676f4183e972c8ad7e89e">4620e6f</a>)</li>
<li>Remove autorater config related visibility v1beta1 (<a
href="https://github.com/googleapis/python-aiplatform/commit/4620e6f0b0623e18b6e676f4183e972c8ad7e89e">4620e6f</a>)</li>
<li>Update supported locations (<a
href="https://github.com/googleapis/python-aiplatform/commit/50a66b778fec5d5bfc87536888e0b835bd8d9db2">50a66b7</a>)</li>
<li>Upload aggregate metrics and generative models used in an evaluation
to GCS. (<a
href="https://github.com/googleapis/python-aiplatform/commit/713ffac6f6f19408bf629dedc06450cee493dae2">713ffac</a>)</li>
</ul>
<h3>Documentation</h3>
<ul>
<li>Deprecate <code>is_default</code> in message
<code>.google.cloud.aiplatform.v1.NotebookRuntimeTemplate</code> (<a
href="https://github.com/googleapis/python-aiplatform/commit/4620e6f0b0623e18b6e676f4183e972c8ad7e89e">4620e6f</a>)</li>
<li>Deprecate <code>is_default</code> in message
<code>.google.cloud.aiplatform.v1beta1.NotebookRuntimeTemplate</code>
(<a
href="https://github.com/googleapis/python-aiplatform/commit/4620e6f0b0623e18b6e676f4183e972c8ad7e89e">4620e6f</a>)</li>
<li>Deprecate <code>service_account</code> in message
<code>.google.cloud.aiplatform.v1.NotebookRuntime</code> (<a
href="https://github.com/googleapis/python-aiplatform/commit/4620e6f0b0623e18b6e676f4183e972c8ad7e89e">4620e6f</a>)</li>
<li>Deprecate <code>service_account</code> in message
<code>.google.cloud.aiplatform.v1.NotebookRuntimeTemplate</code> (<a
href="https://github.com/googleapis/python-aiplatform/commit/4620e6f0b0623e18b6e676f4183e972c8ad7e89e">4620e6f</a>)</li>
<li>Deprecate <code>service_account</code> in message
<code>.google.cloud.aiplatform.v1beta1.NotebookRuntime</code> (<a
href="https://github.com/googleapis/python-aiplatform/commit/4620e6f0b0623e18b6e676f4183e972c8ad7e89e">4620e6f</a>)</li>
<li>Deprecate <code>service_account</code> in message
<code>.google.cloud.aiplatform.v1beta1.NotebookRuntimeTemplate</code>
(<a
href="https://github.com/googleapis/python-aiplatform/commit/4620e6f0b0623e18b6e676f4183e972c8ad7e89e">4620e6f</a>)</li>
</ul>
<h2>v1.78.0</h2>
<h2><a
href="https://github.com/googleapis/python-aiplatform/compare/v1.77.0...v1.78.0">1.78.0</a>
(2025-01-21)</h2>
<h3>Features</h3>
<ul>
<li>Allow users to specify the job_display_name. (<a
href="https://github.com/googleapis/python-aiplatform/commit/1d1b3f0595474c74438560cfc77bce1994e09302">1d1b3f0</a>)</li>
<li>Implement method to get number of pending jobs. (<a
href="https://github.com/googleapis/python-aiplatform/commit/ec57cf449db9a3a9c42851a5c8b56ed86731a2e3">ec57cf4</a>)</li>
<li>Reasoning Engine v1 GAPIC release (<a
href="https://github.com/googleapis/python-aiplatform/commit/4eab30ea19ccd7be7815ce5590f80b63c166916c">4eab30e</a>)</li>
<li>Update comment for LlmParser default gemini requests per minute (<a
href="https://github.com/googleapis/python-aiplatform/commit/97be72646dabe40556870a5e90cfd9e956ee6a2c">97be726</a>)</li>
</ul>
<h3>Documentation</h3>
<ul>
<li>Update the code snippet for LangGraph Agent template (<a
href="https://github.com/googleapis/python-aiplatform/commit/9e6cc62f2a47c5a745cd561b4c5ba2fb5122fe59">9e6cc62</a>)</li>
</ul>
<h2>v1.77.0</h2>
<h2><a
href="https://github.com/googleapis/python-aiplatform/compare/v1.76.0...v1.77.0">1.77.0</a>
(2025-01-15)</h2>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/googleapis/python-aiplatform/blob/main/CHANGELOG.md">google-cloud-aiplatform's
changelog</a>.</em></p>
<blockquote>
<h2><a
href="https://github.com/googleapis/python-aiplatform/compare/v1.78.0...v1.79.0">1.79.0</a>
(2025-01-28)</h2>
<h3>Features</h3>
<ul>
<li>Add machine_spec, data_persistent_disk_spec, network_spec,
euc_config, shielded_vm_config to
<code>.google.cloud.aiplatform.v1beta1.NotebookRuntime</code> (<a
href="https://github.com/googleapis/python-aiplatform/commit/4620e6f0b0623e18b6e676f4183e972c8ad7e89e">4620e6f</a>)</li>
<li>Add machine_spec, data_persistent_disk_spec, network_spec,
euc_config, shielded_vm_config to message
<code>.google.cloud.aiplatform.v1.NotebookRuntime</code> (<a
href="https://github.com/googleapis/python-aiplatform/commit/4620e6f0b0623e18b6e676f4183e972c8ad7e89e">4620e6f</a>)</li>
<li>Add per-modality token count break downs for GenAI APIs (<a
href="https://github.com/googleapis/python-aiplatform/commit/4620e6f0b0623e18b6e676f4183e972c8ad7e89e">4620e6f</a>)</li>
<li>Add per-modality token count break downs for GenAI APIs (<a
href="https://github.com/googleapis/python-aiplatform/commit/4620e6f0b0623e18b6e676f4183e972c8ad7e89e">4620e6f</a>)</li>
<li>Add speculative decoding spec to DeployedModel proto (<a
href="https://github.com/googleapis/python-aiplatform/commit/4620e6f0b0623e18b6e676f4183e972c8ad7e89e">4620e6f</a>)</li>
<li>Enable FeatureGroup IAM Methods in v1beta1 API version (<a
href="https://github.com/googleapis/python-aiplatform/commit/4620e6f0b0623e18b6e676f4183e972c8ad7e89e">4620e6f</a>)</li>
<li>Enable FeatureView Service Account in v1 API version (<a
href="https://github.com/googleapis/python-aiplatform/commit/4620e6f0b0623e18b6e676f4183e972c8ad7e89e">4620e6f</a>)</li>
<li>Enable UpdateFeatureMonitor in v1beta1 API version (<a
href="https://github.com/googleapis/python-aiplatform/commit/4620e6f0b0623e18b6e676f4183e972c8ad7e89e">4620e6f</a>)</li>
<li>Expose code execution tool API to v1 (<a
href="https://github.com/googleapis/python-aiplatform/commit/4620e6f0b0623e18b6e676f4183e972c8ad7e89e">4620e6f</a>)</li>
<li>GenAI Evaluation: Release GenAI Evaluation SDK Autorater
Config/Tuning/Evaluation to vertexai.preview module. (<a
href="https://github.com/googleapis/python-aiplatform/commit/4531d08c1c9c4a1949f532be9d2beddc53d154b1">4531d08</a>)</li>
<li>Reasoning Engine v1 GAPIC release (<a
href="https://github.com/googleapis/python-aiplatform/commit/4620e6f0b0623e18b6e676f4183e972c8ad7e89e">4620e6f</a>)</li>
<li>Remove autorater config related visibility v1beta1 (<a
href="https://github.com/googleapis/python-aiplatform/commit/4620e6f0b0623e18b6e676f4183e972c8ad7e89e">4620e6f</a>)</li>
<li>Update supported locations (<a
href="https://github.com/googleapis/python-aiplatform/commit/50a66b778fec5d5bfc87536888e0b835bd8d9db2">50a66b7</a>)</li>
<li>Upload aggregate metrics and generative models used in an evaluation
to GCS. (<a
href="https://github.com/googleapis/python-aiplatform/commit/713ffac6f6f19408bf629dedc06450cee493dae2">713ffac</a>)</li>
</ul>
<h3>Documentation</h3>
<ul>
<li>Deprecate <code>is_default</code> in message
<code>.google.cloud.aiplatform.v1.NotebookRuntimeTemplate</code> (<a
href="https://github.com/googleapis/python-aiplatform/commit/4620e6f0b0623e18b6e676f4183e972c8ad7e89e">4620e6f</a>)</li>
<li>Deprecate <code>is_default</code> in message
<code>.google.cloud.aiplatform.v1beta1.NotebookRuntimeTemplate</code>
(<a
href="https://github.com/googleapis/python-aiplatform/commit/4620e6f0b0623e18b6e676f4183e972c8ad7e89e">4620e6f</a>)</li>
<li>Deprecate <code>service_account</code> in message
<code>.google.cloud.aiplatform.v1.NotebookRuntime</code> (<a
href="https://github.com/googleapis/python-aiplatform/commit/4620e6f0b0623e18b6e676f4183e972c8ad7e89e">4620e6f</a>)</li>
<li>Deprecate <code>service_account</code> in message
<code>.google.cloud.aiplatform.v1.NotebookRuntimeTemplate</code> (<a
href="https://github.com/googleapis/python-aiplatform/commit/4620e6f0b0623e18b6e676f4183e972c8ad7e89e">4620e6f</a>)</li>
<li>Deprecate <code>service_account</code> in message
<code>.google.cloud.aiplatform.v1beta1.NotebookRuntime</code> (<a
href="https://github.com/googleapis/python-aiplatform/commit/4620e6f0b0623e18b6e676f4183e972c8ad7e89e">4620e6f</a>)</li>
<li>Deprecate <code>service_account</code> in message
<code>.google.cloud.aiplatform.v1beta1.NotebookRuntimeTemplate</code>
(<a
href="https://github.com/googleapis/python-aiplatform/commit/4620e6f0b0623e18b6e676f4183e972c8ad7e89e">4620e6f</a>)</li>
</ul>
<h2><a
href="https://github.com/googleapis/python-aiplatform/compare/v1.77.0...v1.78.0">1.78.0</a>
(2025-01-21)</h2>
<h3>Features</h3>
<ul>
<li>Allow users to specify the job_display_name. (<a
href="https://github.com/googleapis/python-aiplatform/commit/1d1b3f0595474c74438560cfc77bce1994e09302">1d1b3f0</a>)</li>
<li>Implement method to get number of pending jobs. (<a
href="https://github.com/googleapis/python-aiplatform/commit/ec57cf449db9a3a9c42851a5c8b56ed86731a2e3">ec57cf4</a>)</li>
<li>Reasoning Engine v1 GAPIC release (<a
href="https://github.com/googleapis/python-aiplatform/commit/4eab30ea19ccd7be7815ce5590f80b63c166916c">4eab30e</a>)</li>
<li>Update comment for LlmParser default gemini requests per minute (<a
href="https://github.com/googleapis/python-aiplatform/commit/97be72646dabe40556870a5e90cfd9e956ee6a2c">97be726</a>)</li>
</ul>
<h3>Documentation</h3>
<ul>
<li>Update the code snippet for LangGraph Agent template (<a
href="https://github.com/googleapis/python-aiplatform/commit/9e6cc62f2a47c5a745cd561b4c5ba2fb5122fe59">9e6cc62</a>)</li>
</ul>
<h2><a
href="https://github.com/googleapis/python-aiplatform/compare/v1.76.0...v1.77.0">1.77.0</a>
(2025-01-15)</h2>
<h3>Features</h3>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/googleapis/python-aiplatform/commit/c5916fe48f0b7383853bf3f1f5e104266721ea1a"><code>c5916fe</code></a>
chore(main): release 1.79.0 (<a
href="https://redirect.github.com/googleapis/python-aiplatform/issues/4922">#4922</a>)</li>
<li><a
href="https://github.com/googleapis/python-aiplatform/commit/4531d08c1c9c4a1949f532be9d2beddc53d154b1"><code>4531d08</code></a>
feat: GenAI Evaluation: Release GenAI Evaluation SDK Autorater
Config/Tuning/...</li>
<li><a
href="https://github.com/googleapis/python-aiplatform/commit/50a66b778fec5d5bfc87536888e0b835bd8d9db2"><code>50a66b7</code></a>
feat: Update supported locations</li>
<li><a
href="https://github.com/googleapis/python-aiplatform/commit/4620e6f0b0623e18b6e676f4183e972c8ad7e89e"><code>4620e6f</code></a>
Copybara import of the project:</li>
<li><a
href="https://github.com/googleapis/python-aiplatform/commit/713ffac6f6f19408bf629dedc06450cee493dae2"><code>713ffac</code></a>
feat: Upload aggregate metrics and generative models used in an
evaluation to...</li>
<li><a
href="https://github.com/googleapis/python-aiplatform/commit/c2e7ce449a2d318b7ceea6d05128d6ca646ae517"><code>c2e7ce4</code></a>
chore(main): release 1.78.0 (<a
href="https://redirect.github.com/googleapis/python-aiplatform/issues/4861">#4861</a>)</li>
<li><a
href="https://github.com/googleapis/python-aiplatform/commit/97be72646dabe40556870a5e90cfd9e956ee6a2c"><code>97be726</code></a>
feat: Update comment for LlmParser default gemini requests per
minute</li>
<li><a
href="https://github.com/googleapis/python-aiplatform/commit/4eab30ea19ccd7be7815ce5590f80b63c166916c"><code>4eab30e</code></a>
Copybara import of the project:</li>
<li><a
href="https://github.com/googleapis/python-aiplatform/commit/39d4c2de48bc19f4583f496e8ff12d098c9587fb"><code>39d4c2d</code></a>
chore: Fix typos in codebase</li>
<li><a
href="https://github.com/googleapis/python-aiplatform/commit/ec57cf449db9a3a9c42851a5c8b56ed86731a2e3"><code>ec57cf4</code></a>
feat: Implement method to get number of pending jobs.</li>
<li>Additional commits viewable in <a
href="https://github.com/googleapis/python-aiplatform/compare/v1.60.0...v1.79.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=google-cloud-aiplatform&package-manager=pip&previous-version=1.60&new-version=1.79.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Evan Mattson <[email protected]>
2025-02-05 00:20:01 +00:00
dependabot[bot]andEvan Mattson 0555ae7562 Python: Update pymongo requirement from <4.11,>=4.8.0 to >=4.8.0,<4.12 in /python (#10379)
Updates the requirements on
[pymongo](https://github.com/mongodb/mongo-python-driver) to permit the
latest version.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/mongodb/mongo-python-driver/releases">pymongo's
releases</a>.</em></p>
<blockquote>
<h2>PyMongo 4.11.0</h2>
<p>Community notes: <a
href="https://www.mongodb.com/community/forums/t/pymongo-4-11-released/310976">https://www.mongodb.com/community/forums/t/pymongo-4-11-released/310976</a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/mongodb/mongo-python-driver/blob/master/doc/changelog.rst">pymongo's
changelog</a>.</em></p>
<blockquote>
<h1>Changelog</h1>
<h2>Changes in Version 4.11.0 (YYYY/MM/DD)</h2>
<p>.. warning:: PyMongo 4.11 drops support for Python 3.8 and PyPy 3.9:
Python 3.9+ or PyPy 3.10+ is now required.
.. warning:: PyMongo 4.11 drops support for MongoDB 3.6. PyMongo now
supports MongoDB 4.0+.
Driver support for MongoDB 3.6 reached end of life in April 2024.
.. warning:: Driver support for MongoDB 4.0 reaches end of life in April
2025.
A future minor release of PyMongo will raise the minimum supported
MongoDB Server version from 4.0 to 4.2.
This is in accordance with <a
href="https://www.mongodb.com/legal/support-policy/lifecycles">MongoDB
Software Lifecycle Schedules</a>.
<strong>Support for MongoDB Server 4.0 will be dropped in a future
release!</strong>
.. warning:: This version does not include wheels for
<code>ppc64le</code> or <code>s390x</code> architectures, see
<code>PYTHON-5058</code>_ for more information.</p>
<p>PyMongo 4.11 brings a number of changes including:</p>
<ul>
<li>Dropped support for Python 3.8 and PyPy 3.9.</li>
<li>Dropped support for MongoDB 3.6.</li>
<li>Dropped support for the MONGODB-CR authenticate mechanism, which is
no longer supported by MongoDB 4.0+.</li>
<li>pymongocrypt&gt;=1.12 is now required for :ref:<code>In-Use
Encryption</code> support.</li>
<li>Added support for free-threaded Python with the GIL disabled. For
more information see:
<code>Free-threaded CPython
&lt;https://docs.python.org/3.13/whatsnew/3.13.html#whatsnew313-free-threaded-cpython&gt;</code><em>.
We do not yet support free-threaded Python on Windows
(<code>PYTHON-5027</code></em>) or with In-Use Encryption
(<code>PYTHON-5024</code>_).</li>

<li>:attr:<code>~pymongo.asynchronous.mongo_client.AsyncMongoClient.address</code>
and
:attr:<code>~pymongo.mongo_client.MongoClient.address</code> now
correctly block when called on unconnected clients
until either connection succeeds or a server selection timeout error is
raised.</li>
<li>Added :func:<code>repr</code> support to
:class:<code>pymongo.operations.IndexModel</code>.</li>
<li>Added :func:<code>repr</code> support to
:class:<code>pymongo.operations.SearchIndexModel</code>.</li>
<li>Added <code>sort</code> parameter to
:meth:<code>~pymongo.collection.Collection.update_one</code>,
:meth:<code>~pymongo.collection.Collection.replace_one</code>,
:class:<code>~pymongo.operations.UpdateOne</code>, and
:class:<code>~pymongo.operations.UpdateMany</code>,</li>
<li>:meth:<code>~pymongo.mongo_client.MongoClient.bulk_write</code> and

:meth:<code>~pymongo.asynchronous.mongo_client.AsyncMongoClient.bulk_write</code>
now throw an error
when <code>ordered=True</code> or <code>verboseResults=True</code> are
used with unacknowledged writes.
These are unavoidable breaking changes.</li>
<li>Fixed a bug in :const:<code>bson.json_util.dumps</code> where a
:class:<code>bson.datetime_ms.DatetimeMS</code> would
be incorrectly encoded as <code>'{&quot;$date&quot;:
&quot;X&quot;}'</code> instead of <code>'{&quot;$date&quot;: X}'</code>
when using the
legacy MongoDB Extended JSON datetime representation.</li>
<li>Fixed a bug where :const:<code>bson.json_util.loads</code> would
raise an IndexError when parsing an invalid
<code>&quot;$date&quot;</code> instead of a ValueError.</li>
</ul>
<p>Issues Resolved
...............</p>
<p>See the <code>PyMongo 4.11 release notes in JIRA</code>_ for the list
of resolved issues
in this release.</p>
<p>.. _PyMongo 4.11 release notes in JIRA: <a
href="https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=10004&amp;version=40784">https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=10004&amp;version=40784</a></p>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/mongodb/mongo-python-driver/commit/cae161ecddbc9c380c21b675da8c042603450c63"><code>cae161e</code></a>
BUMP 4.11</li>
<li><a
href="https://github.com/mongodb/mongo-python-driver/commit/dc2993835eaeacb2dcb08969afafcbddf08f41fb"><code>dc29938</code></a>
PYTHON-5047 Fix dry run logic in releases (<a
href="https://redirect.github.com/mongodb/mongo-python-driver/issues/2083">#2083</a>)</li>
<li><a
href="https://github.com/mongodb/mongo-python-driver/commit/4567f8875eb8ea8c4a1bd2e0bb13e41e4d3da7b2"><code>4567f88</code></a>
PYTHON-5047 Fix handling of attestation on testpypi workflows (<a
href="https://redirect.github.com/mongodb/mongo-python-driver/issues/2081">#2081</a>)</li>
<li><a
href="https://github.com/mongodb/mongo-python-driver/commit/848ab4f7db6e2a151b98765547300198e489172a"><code>848ab4f</code></a>
PYTHON-5047 Improve testing of publish workflows (<a
href="https://redirect.github.com/mongodb/mongo-python-driver/issues/2080">#2080</a>)</li>
<li><a
href="https://github.com/mongodb/mongo-python-driver/commit/2225ccadce0033f2ed16a99e44dc98085263da59"><code>2225cca</code></a>
PYTHON-5062 Add GitHub Actions CodeQL scanning (<a
href="https://redirect.github.com/mongodb/mongo-python-driver/issues/2079">#2079</a>)</li>
<li><a
href="https://github.com/mongodb/mongo-python-driver/commit/9082a4be23622458ee350c3171bc754cdf1db89a"><code>9082a4b</code></a>
PYTHON-5058 Build linux aarch64 wheel using native runner and omit
ppc64le an...</li>
<li><a
href="https://github.com/mongodb/mongo-python-driver/commit/a3208df5c94620228b015ac79cd1548582c65ab1"><code>a3208df</code></a>
PYTHON-5059 Update default maxMessageSizeBytes and maxWriteBatchSize (<a
href="https://redirect.github.com/mongodb/mongo-python-driver/issues/2078">#2078</a>)</li>
<li><a
href="https://github.com/mongodb/mongo-python-driver/commit/dc182310dabff470dbbfc7da3c09eb6a4e08dfed"><code>dc18231</code></a>
PYTHON-5047 Avoid updating the uv lock unintentionally (<a
href="https://redirect.github.com/mongodb/mongo-python-driver/issues/2076">#2076</a>)</li>
<li><a
href="https://github.com/mongodb/mongo-python-driver/commit/a3cc43f60d605739a40680ec962b7204f1908426"><code>a3cc43f</code></a>
PYTHON-4999 Resync retryable writes tests (<a
href="https://redirect.github.com/mongodb/mongo-python-driver/issues/2073">#2073</a>)</li>
<li><a
href="https://github.com/mongodb/mongo-python-driver/commit/cfe7784db952ccad09ab6d3afd9629fca792a85a"><code>cfe7784</code></a>
PYTHON-4976 Replace hatch with uv as our python environment and workfow
tool ...</li>
<li>Additional commits viewable in <a
href="https://github.com/mongodb/mongo-python-driver/compare/4.8.0...4.11">compare
view</a></li>
</ul>
</details>
<br />


Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Evan Mattson <[email protected]>
2025-02-05 00:19:21 +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
dependabot[bot]andEvan Mattson 86751868a2 Python: Bump torch from 2.5.1 to 2.6.0 in /python (#10380)
Bumps [torch](https://github.com/pytorch/pytorch) from 2.5.1 to 2.6.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/pytorch/pytorch/releases">torch's
releases</a>.</em></p>
<blockquote>
<h2>PyTorch 2.6.0 Release</h2>
<ul>
<li>Highlights</li>
<li>Tracked Regressions</li>
<li>Backwards Incompatible Change</li>
<li>Deprecations</li>
<li>New Features</li>
<li>Improvements</li>
<li>Bug fixes</li>
<li>Performance</li>
<li>Documentation</li>
<li>Developers</li>
</ul>
<h2><strong>Highlights</strong></h2>
<p>We are excited to announce the release of PyTorch® 2.6 (<a
href="https://github.com/pytorch/pytorch/releases/tag/v2.6.0">release
notes</a>)! This release features multiple improvements for PT2:
<code>torch.compile</code> can now be used with Python 3.13; new
performance-related knob <code>torch.compiler.set_stance</code>; several
AOTInductor enhancements. Besides the PT2 improvements, another
highlight is FP16 support on X86 CPUs.</p>
<p>NOTE: Starting with this release we are not going to publish on
Conda, please see <a
href="https://redirect.github.com/pytorch/pytorch/issues/138506">[Announcement]
Deprecating PyTorch’s official Anaconda channel</a> for the details.</p>
<p>For this release the experimental Linux binaries shipped with CUDA
12.6.3 (as well as Linux Aarch64, Linux ROCm 6.2.4, and Linux XPU
binaries) are built with CXX11_ABI=1 and are <a
href="https://dev-discuss.pytorch.org/t/pytorch-linux-wheels-switching-to-new-wheel-build-platform-manylinux-2-28-on-november-12-2024/2581">using
the Manylinux 2.28 build platform</a>. If you build PyTorch extensions
with custom C++ or CUDA extensions, please update these builds to use
CXX_ABI=1 as well and report any issues you are seeing. For the next
PyTorch 2.7 release we plan to switch all Linux builds to Manylinux 2.28
and CXX11_ABI=1, please see <a
href="https://redirect.github.com/pytorch/pytorch/issues/123649">[RFC]
PyTorch next wheel build platform: manylinux-2.28</a> for the details
and discussion.</p>
<p>Also in this release as an important security improvement measure we
have changed the default value for <code>weights_only</code> parameter
of <code>torch.load</code>. This is a backward compatibility-breaking
change, please see <a
href="https://dev-discuss.pytorch.org/t/bc-breaking-change-torch-load-is-being-flipped-to-use-weights-only-true-by-default-in-the-nightlies-after-137602/2573">this
forum post</a> for more details.</p>
<p>This release is composed of 3892 commits from 520 contributors since
PyTorch 2.5. We want to sincerely thank our dedicated community for your
contributions. As always, we encourage you to try these out and report
any issues as we improve PyTorch. More information about how to get
started with the PyTorch 2-series can be found at our <a
href="https://pytorch.org/get-started/pytorch-2.0/">Getting Started</a>
page.</p>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/pytorch/pytorch/commit/1eba9b3aa3c43f86f4a2c807ac8e12c4a7767340"><code>1eba9b3</code></a>
change the test wheel to release wheel when release wheel available (<a
href="https://redirect.github.com/pytorch/pytorch/issues/145884">#145884</a>)</li>
<li><a
href="https://github.com/pytorch/pytorch/commit/2236df1770800ffea5697b11b0bb0d910b2e59e1"><code>2236df1</code></a>
[CUDA] Change slim-wheel libraries load order (<a
href="https://redirect.github.com/pytorch/pytorch/issues/145662">#145662</a>)</li>
<li><a
href="https://github.com/pytorch/pytorch/commit/32070409668513144e48390380a3911fc5cd03e0"><code>3207040</code></a>
[CD] Fix slim-wheel cuda_nvrtc import problem (<a
href="https://redirect.github.com/pytorch/pytorch/issues/145614">#145614</a>)</li>
<li><a
href="https://github.com/pytorch/pytorch/commit/ca3c3a63b8087d405babf95fcce263cf1b8dd35e"><code>ca3c3a6</code></a>
[Release-Only] Remove ptx from Linux CUDA 12.6 binary builds (<a
href="https://redirect.github.com/pytorch/pytorch/issues/145616">#145616</a>)</li>
<li><a
href="https://github.com/pytorch/pytorch/commit/7be6b5db475a5885379751953f67656ca1ce6edd"><code>7be6b5d</code></a>
Fix IdentationError of code example (<a
href="https://redirect.github.com/pytorch/pytorch/issues/145525">#145525</a>)</li>
<li><a
href="https://github.com/pytorch/pytorch/commit/dcb8ad070f15e8444dcb4e415bde38142cda5e9d"><code>dcb8ad0</code></a>
update get start xpu (<a
href="https://redirect.github.com/pytorch/pytorch/issues/145286">#145286</a>)</li>
<li><a
href="https://github.com/pytorch/pytorch/commit/8d4b8a920a2172523deb95bf20e8e52d50649c04"><code>8d4b8a9</code></a>
Prevent legacy_load when weights_only=True (correctly) (<a
href="https://redirect.github.com/pytorch/pytorch/issues/145111">#145111</a>)</li>
<li><a
href="https://github.com/pytorch/pytorch/commit/9c34a2076b37c040b1b9a48b729656fe9e992949"><code>9c34a20</code></a>
Revert &quot;Prevent _legacy_load with weights_only=True (<a
href="https://redirect.github.com/pytorch/pytorch/issues/144993">#144993</a>)&quot;</li>
<li><a
href="https://github.com/pytorch/pytorch/commit/cd15d7b29fea0886d1ae655da9bec767caa8c672"><code>cd15d7b</code></a>
Prevent _legacy_load with weights_only=True (<a
href="https://redirect.github.com/pytorch/pytorch/issues/144993">#144993</a>)</li>
<li><a
href="https://github.com/pytorch/pytorch/commit/a2639bc255cd9eb93250c3bd1aea01f74538ad76"><code>a2639bc</code></a>
[Release/2.6] Enable python-3.13t aarch64 builds (<a
href="https://redirect.github.com/pytorch/pytorch/issues/144878">#144878</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/pytorch/pytorch/compare/v2.5.1...v2.6.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=torch&package-manager=pip&previous-version=2.5.1&new-version=2.6.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Evan Mattson <[email protected]>
2025-02-05 00:12:06 +00:00
Tao ChenandEvan Mattson 0b2bd01267 Python: Update document generator demo README (#10386)
### 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.
-->
`AICodeSandbox` has updated their package name. A user also reached out
about whether it is possible to use models for the demo.

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
1. Update the Document Generator demo README to reflect this change.
2. Update the README to include a note about using other models.

### 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-04 06:50:56 +00:00
jenfoxbotandEvan Mattson f8592ade6e Python: Update README.md to add clarity re: .env file (#10360)
clarified where to put the .env file

### Motivation and Context
As currently written, it's confusing as to where to put the .env file.
The proposed changes clarify where to put the .env file.

This improves onboarding experience and documentation.


<!-- 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
Minor changes to ReadMe to clarify where to put the .env file
<!-- 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: Evan Mattson <[email protected]>
2025-02-04 02:30:12 +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
Tao Chen 1484043605 Python: Document generator agent framework demo (#10184)
### 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 currently don't have a demo sample that shows how to use the agent
framework with multiple agents end-to-end. End-to-end means starting
from a task, designing the agents, and observing the agents.

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
This PR adds a demo app that shows how to use the agent framework with
multiple agents to generate technical documents for Semantic Kernel.
This automation will greatly improve our productivity in creating more
contents.

This sample contains 3 agents, multiple plugins, and the necessary steps
to make the agents observable.

![image](https://github.com/user-attachments/assets/27fc0548-e052-481d-b9ad-845add5ec121)


> Note that this PR can be a starting point for discussion on how we can
further improve the agent framework.

### 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:02:54 +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
Evan Mattson d0157424b4 Python: Bump Python version to 1.20.0 for a release. (#10331)
### Motivation and Context

Bump Python version to 1.20.0 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.20.0 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-01-29 07:55:28 +00:00
Evan Mattson 44034ebd23 Python: Improve hashing of cmc and scmc items. Add tests. (#10332)
### Motivation and Context

We have some content types that can't be hashed as-is. This PR makes
sure that if there are unhashable types, that we turn them into hashable
types. Add unit tests to exercise the scenarios.

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

- [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-29 07:54:42 +00:00
ec9b980e30 Python: improve agent samples and chat history handling (#10301)
### 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.
-->
When passing the same object to `agent.reduce_history` as is present in
the `history_reducer` attribute of the agent that the function doesn't
accurately behave. This fixes that.

Also updates the sample to be a bit more concise.

Also fixes the way the single_dispatch is setup in ChatHistory.

Also ensures system/developer messages are not reduced away as that
might impact performance.

The `reduce_history` method was removed from the agent base class, in
favor of having the caller manage the change history and reduction as
needed. The `reduce_history` was added to the agent group chat, as the
chat history is managed internally as agents are invoked.

### 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]>
Co-authored-by: Evan Mattson <[email protected]>
2025-01-29 00:48:26 +00:00
Evan Mattson 7e206318dd Python: Allow enums to be passed in to on_function_result. Improve handling FRC result so it can be hashed. (#10316)
### Motivation and Context

Two topics in this PR:
- A request to be able to pass in Enums to the Python process
`on_function_result`, instead of just strings.
- There were some custom types (Pydantic models) that were unable to
hash during an agent group chat. One could mark the model `frozen` so
that it is hashable; however, we should add better handling in our code,
in case a dev doesn't want to do that.

<!-- 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:
- checks if the function name in `on_function_result` in our process
framework is an enum, if so, convert to a string.
- improves the parsing of the `result` in `FunctionResultContent` so
that it can be included in the hash function during an agent group chat.
Adding tests to handle multiple different scenarios.
- Closes #10299 
- Closes #10305

<!-- 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-28 21:35:37 +00:00
Tao Chen f005058548 Python: Add Deepseek service to concept samples (#10306)
### 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.
-->
Models from [DeepSeek](https://www.deepseek.com/) are rising fast as one
of the most capable and cost-effective open-source models. The community
will be eager to test these models out.

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
It's not hard to use these new models as they are compatible with the
OpenAI API. This PR simply adds an option where people can test out the
DeepSeek models in the chat concept samples.

### 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-28 16:11:42 +00:00
Evan Mattson 1a84cb64b2 Python: prompt template config and kernel args support for agents (#10298)
### Motivation and Context

To bring the SK Python framework closer to .Net parity, we need to
support the ability to specify a prompt template config and kernel
arguments for ChatCompletion Agents as well as for Assistant Agents.

<!-- 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 support for:
- being able to specify a prompt template config for SK agents.
- allows kernel arguments to be passed to the agent as well as during
invoke - invoke args, similar to other kwargs, take precedence over
agent level config.
- adds test coverage
- creates agent templating samples for both ChatCompletionAgents and
OpenAI/AzureAssistantAgents
- closes #8022 
- closes #8699

<!-- 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-28 04:41:16 +00:00
Evan Mattson 5098ba39a8 Python: Improve handling for kernel plugin from file. (#10286)
### Motivation and Context

This PR addresses an issue in the `KernelPlugin.from_directory()` method
where classes without any `@kernel_function` decorated methods are still
being initialized during plugin loading.

The fix makes sure that only classes with at least one
`@kernel_function` decorated method are instantiated and included as
plugins. Classes without `@kernel_function` methods are now skipped
entirely.

<!-- 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 `from_python_file` to inspect each class for
`@kernel_function` decorated methods before instantiation.
- Updates the `add_plugin` method `plugin_name` to make sure it is
indeed a string, per the type hint.
   - Adds a unit test to exercise the new behavior
- Closes #10280

<!-- 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-24 18:00:28 +00:00
Evan Mattson 4d29656780 Python: Introduce the chat history reducer (#10190)
### Motivation and Context

The SK Python framework has been missing the ability to configure a chat
history reducer of type `ChatHistoryTruncationReducer` and
`ChatHistorySummarizationReducer` which have existed in the .Net SK
Agent framework for some time.

The goal of this PR is to introduce the chat history reducers and allow
them for use for not only the agent framework, but also anything else
that uses a chat history (chat completion, for example). The
ChatHistoryReducer extends the ChatHistory class, and so it's simple to
include a reducer and logic to reduce messages as one manages the chat
history either in an agent framework setting or in a chat completion
setting.

<!-- 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 chat history reducer functionality in Python -- both
the `ChatHistoryTruncationReducer` and
`ChatHistorySummarizationReducer`.
- Add unit tests for code coverage.
- Adds a sample `Chat Completion History Reducer` to show how to
configure both reducers and what each parameter does.
- Add chat completion samples showing how to manage a chat history
reducer, including how to specify that function call content and
function result content should be part of the summarization payload.
- Updates the Agent SelectionStrategy, KernelFunctionSelectionStrategy
and KernelFunctionTermination strategy to use the reducer.
- Additionally updates the classes above to use a new `select_agent`
abstract method so that one can define an initial agent to run in a
particular scenario.
- Removes the deprecated `FunctionCallBehavior` class, and removes some
nasty circular dependencies that we had lurking in the code base for
some time. This `FunctionCallBehavior` has been marked with a
deprecation warning for 6+ months now. All samples and docs have moved
over to use `FunctionChoiceBehavior` - developers using
`FunctionCallBehavior` should have had enough time to switch.
- Closes #7969
- Closes #10102

<!-- 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-23 22:30:54 +00:00
Eduard van Valkenburg e44f70d9d6 Python: bug fixes from graphrag insights (#10270)
### 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.
-->
Based on insights from the graphrag team, several bug fixes related to
data and model validators.

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
For all cases of model_validator in before mode, there is no guarantee
that the data passed is a dict,
especially when a model is used as a field in another model, then a
string is passed to the before validator.
So in those cases we check before doing logic, otherwise just pass it on
and let Pydantic handle the invalid data.

Some small logic fixes in the vector store model decorator:
- updated docstring with the right exceptions
- additional checks on attributes
- additional checks on VectorFields with tests

### 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-23 20:22:29 +00:00
Tao ChenandEvan Mattson 6ecfdcfda9 Python: Add agent invocation spans (#10255)
### 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 feature request:
https://github.com/microsoft/semantic-kernel/issues/10174

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
This pull request introduces a new decorator for tracing agent
invocations and applies it to various methods in the
`ChatCompletionAgent` and `OpenAIAssistantAgent` classes. Additionally,
it includes new unit tests to ensure the decorator is correctly applied
and functions as expected.

### Key Changes:

**Decorator Implementation:**
* Added a new `trace_agent_invocation` decorator in
`python/semantic_kernel/utils/telemetry/agent_diagnostics/decorators.py`
to trace agent invocations using OpenTelemetry.

**Decorator Application:**
* Applied the `trace_agent_invocation` decorator to the `invoke` and
`invoke_stream` methods in `ChatCompletionAgent`
(`python/semantic_kernel/agents/chat_completion/chat_completion_agent.py`).
[[1]](diffhunk://#diff-0f0a27c107368504c4347c88528b7b4234dcead1919005bcae13f5d16d6cf26dR19)
[[2]](diffhunk://#diff-0f0a27c107368504c4347c88528b7b4234dcead1919005bcae13f5d16d6cf26dR80)
[[3]](diffhunk://#diff-0f0a27c107368504c4347c88528b7b4234dcead1919005bcae13f5d16d6cf26dR134)
* Applied the `trace_agent_invocation` decorator to the `invoke` and
`invoke_stream` methods in `OpenAIAssistantAgent`
(`python/semantic_kernel/agents/open_ai/open_ai_assistant_base.py`).
[[1]](diffhunk://#diff-70e75c57136d3a90d045af4b8d59fb8e8101251d7c5126458bb5d9e6c36556a4R46)
[[2]](diffhunk://#diff-70e75c57136d3a90d045af4b8d59fb8e8101251d7c5126458bb5d9e6c36556a4R608)
[[3]](diffhunk://#diff-70e75c57136d3a90d045af4b8d59fb8e8101251d7c5126458bb5d9e6c36556a4R861)

### 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-01-22 16:26:18 +09:00
Evan Mattson b1216a0d9c Python: Bump Python version to 1.19.0 for a release. (#10254)
### Motivation and Context

Bump Python version to 1.19.0 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.19.0 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-01-22 02:51:51 +00:00
Evan Mattson 3a7f2a3b73 Python: Grab function_name from kwargs if present in ProcessStepEdgeBuilder (#10245)
### Motivation and Context

In the ProcessStepEdgeBuilder, we allow one to pass in a target of type
`"ProcessFunctionTargetBuilder | ProcessStepBuilder"`. If the target
`isinstance(target, ProcessStepBuilder)`, we construct the
`ProcessFunctionTargetBuilder`. We weren't grabbing the `function_name`
from the kwargs if it was presented, resulting in an exception that the
function_name needs to be provided because multiple kernel functions
exist.

<!-- 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:
- correctly passes in the `function_name` kwargs, if present.
- Adds a unit test to exercise functionality

<!-- 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-21 22:50:46 +00:00
Evan Mattson 6ceba22758 Python: improve Makefile uv installation logic (#10246)
### Motivation and Context

Today, If a user runs `make install`, and the uv installation is not
found, the current flow is to return `exit 1` to force the user to
restart their shell.

These changes update the Makefile to better handle the case where uv is
not installed. The Makefile now uses a “second make invocation” approach
with a CONTINUE variable to avoid re-installing uv in the newly spawned
shell. If `uv` isn’t found, it installs `uv`, then executes a new shell
which immediately calls `make install CONTINUE=1`, allowing the rest of
the steps to continue in an environment that now has `uv` on the PATH.

<!-- 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 make file to provide cleaner logic on handling the `make
install` when `uv` isn't present.
- Closes #9067

<!-- 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-21 22:16:10 +00:00
dependabot[bot] 5b9c2457c0 Python: Update pyarrow requirement from <19.0,>=12.0 to >=12.0,<20.0 in /python (#10243)
Updates the requirements on [pyarrow](https://github.com/apache/arrow)
to permit the latest version.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/apache/arrow/releases">pyarrow's
releases</a>.</em></p>
<blockquote>
<h2>Apache Arrow 19.0.0</h2>
<p>Release Notes URL: <a
href="https://arrow.apache.org/release/19.0.0.html">https://arrow.apache.org/release/19.0.0.html</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/apache/arrow/commit/a999eaccb12378f9e4e9ab758f18edc25b0991e5"><code>a999eac</code></a>
MINOR: [Release] Update versions for 19.0.0</li>
<li><a
href="https://github.com/apache/arrow/commit/f6b7bc80c698854d174a41735e3a62bfb133c797"><code>f6b7bc8</code></a>
MINOR: [Release] Update .deb/.rpm changelogs for 19.0.0</li>
<li><a
href="https://github.com/apache/arrow/commit/848fde3793d148fb5729eaddc20849d01c6b0c9e"><code>848fde3</code></a>
MINOR: [Release] Update CHANGELOG.md for 19.0.0</li>
<li><a
href="https://github.com/apache/arrow/commit/8677e33380ef79f3344d667be4e74a42d7c4b810"><code>8677e33</code></a>
<a
href="https://redirect.github.com/apache/arrow/issues/45175">GH-45175</a>:
[Python] Honor the strings_to_categorical keyword in to_pandas for
...</li>
<li><a
href="https://github.com/apache/arrow/commit/f41f59066b79fbf59719e68ef0f908afd6c5218c"><code>f41f590</code></a>
<a
href="https://redirect.github.com/apache/arrow/issues/45166">GH-45166</a>:
[CI][C++] Upgrade Alpine Linux to 3.18 from 3.16 (<a
href="https://redirect.github.com/apache/arrow/issues/45168">#45168</a>)</li>
<li><a
href="https://github.com/apache/arrow/commit/8cff21f4f2829806a0dde11a6899a0f13290553d"><code>8cff21f</code></a>
<a
href="https://redirect.github.com/apache/arrow/issues/45178">GH-45178</a>:
[CI] Remove clcache related codes (<a
href="https://redirect.github.com/apache/arrow/issues/45182">#45182</a>)</li>
<li><a
href="https://github.com/apache/arrow/commit/777797e1b142d5f386e3bda873e8f8b32b2d2da1"><code>777797e</code></a>
<a
href="https://redirect.github.com/apache/arrow/issues/45183">GH-45183</a>:
[C++][Release] Add llvm-dev back to setup-ubuntu.sh (<a
href="https://redirect.github.com/apache/arrow/issues/45184">#45184</a>)</li>
<li><a
href="https://github.com/apache/arrow/commit/14dc66d505eae0126dd0dc43887dd42788c6fbe3"><code>14dc66d</code></a>
MINOR: [C#] Bump coverlet.collector from 6.0.2 to 6.0.3 in /csharp (<a
href="https://redirect.github.com/apache/arrow/issues/45179">#45179</a>)</li>
<li><a
href="https://github.com/apache/arrow/commit/a931affa1766be1f98979228ca6ab124aa7f793c"><code>a931aff</code></a>
<a
href="https://redirect.github.com/apache/arrow/issues/45073">GH-45073</a>:
[C++][Parquet] Fix generation of repetition levels for encryption
t...</li>
<li><a
href="https://github.com/apache/arrow/commit/ada8750917cd2ec2ae8a605d2673d78ef04c82e4"><code>ada8750</code></a>
<a
href="https://redirect.github.com/apache/arrow/issues/44563">GH-44563</a>:
[C++] <code>FunctionOptions::{Serialize,Deserialize}()</code> return an
error ...</li>
<li>Additional commits viewable in <a
href="https://github.com/apache/arrow/compare/go/v12.0.0...apache-arrow-19.0.0">compare
view</a></li>
</ul>
</details>
<br />


Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-21 07:44:08 +00:00
Evan MattsonandEduard van Valkenburg 71e5040a78 Python: Update sort step method for assistant invoke. (#10191)
### Motivation and Context

At times, when the (Azure) OpenAI Assistant Agent makes a tool call,
that tool call's creation timestamp is coming after the message creation
timestamp (the message creation being the text that the assistant
responds with). Currently in our code, if we have a tool call
(`FunctionCallContent`), we first yield that, and then we make a call to
get completed steps, to then yield more content like
`FunctionResultContent` and `TextContent`. There will be two steps (or
more, depending upon the number of tool calls).

Right now we sort the completed steps in this way:

```python
completed_steps_to_process: list[RunStep] = sorted(
    [s for s in steps if s.completed_at is not None and s.id not in processed_step_ids],
    key=lambda s: s.created_at,
)
```
When there are no failures, it's because the tool call was created
before the final message content (as has been since this assistant was
first coded). However, it appears that processing on the server-side can
cause fluctuations in when the steps are created/processed. When we have
a failure, we now have the message_creation (`TextContent`) yielded
before the `FunctionResultContent`, which if sent to an (Azure) OpenAI
Chat Completion endpoint will break with a 400 because of the gap in the
ordering between the `FunctionCallContent` and the
`FunctionResultContent`:

```
FunctionCallContent
TextContent # this should follow `FunctionResultContent` (and it does during times when we don't see a 400)
FunctionResultContent
```

The 400 error isn't 100% repeatable because of server-side processing,
so we will get the correct ordering:

```
FunctionCallContent
FunctionResultContent
TextContent
```

This PR updates the ordering of how we sort of the completed steps -- if
we have a step_type == "tool_calls" and "message_creation", we sort to
allow for "tool_calls" to come first, and any ties are broken by the
step.completed_at timestamp. With this update, we no longer receive 400s
because the ordering of the content types is correct when sending to an
OpenAI model.

<!-- 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 way we sort completed messages during an assistant invoke.
- Adds logging for the assistant invoke method at the `info` level.
- Closes #10141

<!-- 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: Eduard van Valkenburg <[email protected]>
2025-01-20 19:29:13 +00:00
Eduard van Valkenburg 5b65e6ab24 .Net: Python: fix pre-commit version (#10235)
### 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.
-->
fix of uv version in pre-commit, fix for redis link

### 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-01-20 16:46:39 +01:00