30 Commits
Author SHA1 Message Date
SergeyMenshykh c11d5e4a06 .Net: Exclude folders having docs with not reachable links (#12924)
Exclude folders with documents containing unreachable links and remove
files that were previously excluded because the links they contained
have become reachable.
2025-08-12 09:17:53 +00:00
Tao Chen 4882550306 Python: Fix function call content argument parsing (#10132)
### 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 includes changes to improve the handling of JSON parsing when it
fails to be parsed as it is in function call arguments by adding a
regular expression for preprocessing JSON strings to remove single
quotes only when they are not escaped.

### Description

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

Enhancements to JSON parsing:

*
[`python/semantic_kernel/contents/function_call_content.py`](diffhunk://#diff-1f5f27eade7117045bc9e62d66ebef5c93047142cdb4fd0115b0ff8eadf2f69cL152-R164):
Modified `parse_arguments` method to preprocess JSON strings by
replacing single quotes with double quotes, except for escaped single
quotes. Added a debug log for invalid JSON.

Test file updates:

*
[`python/tests/unit/contents/test_function_call_content.py`](diffhunk://#diff-6e891b3044d5bf5caa7abc97a44ef11ce291aba01fa8032ab1104773f4545c9dR135-R148):
Added new tests for parsing single-quoted JSON strings. Renamed the test
file from `test_function_call.py` to `test_function_call_content.py`.

### 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-09 10:47:09 +00:00
Evan Mattson 5830081902 Python: Improve azure assistant agent settings and retrieval operations. (#10063)
### Motivation and Context

The AzureAssistantAgent retrieval path was not handling the optional
ad_token. The agent constructor was handling it, to a degree, but there
were improvements to make and a helper function to introduce so that we
remove some code duplication.

<!-- 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:
- Cleans up the code used to create the azure settings for an azure
assistant agent by introducing a helper function to streamline the logic
- Allows the AzureAssistantAgent.retrieve() method to use an ad_token,
if desired.
- Adds unit tests for the new logic. Other unit tests are still passing
after the refactor.

<!-- 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-07 18:34:46 +00:00
Eduard van Valkenburg f90538b9c0 Python: switch to uv (#8320)
### 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.
-->
Switches from poetry to uv
much faster and easier lock management
easier maintenance of pyproject.toml

fixes: #6584
fixes: #8326

### Description

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

### Contribution Checklist

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

- [x] The code builds clean without any errors or warnings
- [x] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [x] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone 😄
2024-08-26 13:34:29 +02:00
F. HinkelmannandEvan Mattson 8033515a86 Python: Update DEV_SETUP.md with dependencies for tests (#6909)
<!-- 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
`poetry install` doesn't install required dependencies like `google` and
`azure` as they are marked `optional=yes`. This causes 5 unit tests to
fail. Clarifying in the docs that `unit-tests` or `tests` dependencies
need to be installed when running tests.


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

### Contribution Checklist

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

- [x] The code builds clean without any errors or warnings - no code
changes
- [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]>
2024-06-25 18:41:02 +00:00
Tao Chen ecb9ae5c44 Python: Update dev setup readme (#6797)
### 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.
-->
The DEV setup readme does not clearly outline which workspace and
formatter to use in VSCode. And some instructions also show
inconsistencies in the project folder structures.

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
Update the README to make things more obvious and consistent.

### 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 😄
2024-06-18 11:52:02 +00:00
Evan Mattson d56ca2928e Python: Improve DEV_SETUP.md Poetry install instructions for MacOS users. (#6487)
### Motivation and Context

Poetry can sometimes be tricky to install for MacOS users. Including
further instructions about how to get started, hopefully more quickly.

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

Including notes for MacOS users to install Poetry from their official
installer as well as the possible need to create a `python` alias in the
MacOS shell config.

<!-- 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 😄
2024-06-03 16:36:14 +00:00
Eduard van Valkenburg fbb26b5cf6 Python: further improvements to checks and docs in dev_setup (#6445)
### Motivation and Context

<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->
Added a section on documentation to the DEV_SETUP
Added a check for the copyright row to pre-commit
Closes #5629

### 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 😄
2024-05-31 13:06:41 +00:00
Evan Mattson 46f5ea15a2 Python: Introduce Pydantic settings (#6193)
### Motivation and Context

SK Python is tightly coupled to the use of a `.env` file to read all
secrets, keys, endpoints, and more. This doesn't scale well for users
who wish to be able to use environment variables with their SK
Applications. By introducing Pydantic Settings, it is possible to use
both environment variables as well as have a fall-back to a `.env` file
(via a `env_file_path` parameter), if desired.

By introducing Pydantic Settings, we are removing the requirement to
have to create Text/Embedding/Chat completion objects with an `api_key`
or other previously required information (in the case of
AzureChatCompletion that means an `endpoint`, an `api_key`, a
`deployment_name`, and an `api_version`). When the AI connector is
created, the Pydantic settings are loaded either via env vars or the
fall-back `.env` file, and that means the user can create a chat
completion object like:

```python
chat_completion = OpenAIChatCompletion(service_id="test")
```

or, to optionally override the `ai_model_id` env var:

```python
chat_completion = OpenAIChatCompletion(service_id="test", ai_model_id="gpt-4-1106")
```
Note: we have left the ability to specific an `api_key`/`org_id` for
`OpenAIChatCompletion` or a `deployment_name`, `endpoint`, `base_url`,
and `api_version` for `AzureChatCompletion` as before, but if your
settings are configured to use env vars/.env file then there is no need
to pass this information.

<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->

### Description

The PR introduces the use of Pydantic settings and removes the use of
the python-dotenv library.
- Closes #1779 
- Updates notebooks, samples, code and tests to remove the explicit
config of api_key or other previous .env files values.
- Adds new unit test config using monkeypatch to simulate env variables
for testing
- All unit and integration tests passing

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

### Contribution Checklist

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

- [X] The code builds clean without any errors or warnings
- [X] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [X] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone 😄
2024-05-16 11:44:40 +00:00
Evan Mattson 09508dc8ba Python: Restructure samples into new folders to make things more clear. (#6116)
### Motivation and Context

All previous samples were either in kernel syntax or a separate
notebooks folder. The goal is to make the samples easier to understand
and have a better structure.

<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->

### Description

The PR restructures the kernel syntax examples into new folders:
concepts (with subfolders for previous syntax examples), demos,
getting_started, and learn_resources.
- Closes #6119 
- Adds a new concept/function example for understanding kernel
arguments.
- Updates the bookings 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 😄
2024-05-04 11:50:04 +00:00
Chris ac6e03ba98 Java: Python: Docs: Fix broken link (#6092)
### 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.
-->
`https://openai.com/product` is failing `Check .md links` workflow.

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

Revise links.


https://github.com/microsoft/semantic-kernel/actions/workflows/markdown-link-check.yml

Whitespace edits peformed by VS Code

### 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 😄
2024-05-01 19:55:48 -07:00
Eduard van Valkenburg 0a75ba8145 Python: dev_setup and readme updates (#5770)
This pull request primarily updates the `DEV_SETUP.md` and `README.md`
files in the `python` directory. The changes focus on improving the
setup instructions, updating the code snippets, and providing additional
information on running tests, code coverage, and keeping the local
repository up-to-date.

Changes to setup instructions:

*
[`python/DEV_SETUP.md`](diffhunk://#diff-22a026622159be328328c5bb6fef874e8aa799efb6ab8844d0c94ad051b08f3cR75-R90):
Added instructions on how to use Python 3.11 with Poetry, how to install
pre-commit hooks, and how to run tests using VSCode Tasks.
[[1]](diffhunk://#diff-22a026622159be328328c5bb6fef874e8aa799efb6ab8844d0c94ad051b08f3cR75-R90)
[[2]](diffhunk://#diff-22a026622159be328328c5bb6fef874e8aa799efb6ab8844d0c94ad051b08f3cR112-R114)
[[3]](diffhunk://#diff-22a026622159be328328c5bb6fef874e8aa799efb6ab8844d0c94ad051b08f3cR131-R133)
[[4]](diffhunk://#diff-22a026622159be328328c5bb6fef874e8aa799efb6ab8844d0c94ad051b08f3cL287-R252)

Code snippets updates:

*
[`python/DEV_SETUP.md`](diffhunk://#diff-22a026622159be328328c5bb6fef874e8aa799efb6ab8844d0c94ad051b08f3cL140-L227):
Updated the code snippets to reflect the latest changes in the codebase.
This includes changes in the use of Pydantic and the use of
KernelBaseModel.
[[1]](diffhunk://#diff-22a026622159be328328c5bb6fef874e8aa799efb6ab8844d0c94ad051b08f3cL140-L227)
[[2]](diffhunk://#diff-22a026622159be328328c5bb6fef874e8aa799efb6ab8844d0c94ad051b08f3cL244-R177)
*
[`python/README.md`](diffhunk://#diff-217ed82f87b78b399e304b07a159b27dff327c0f83adf4a2fc30b03bcbf84b01L58-R66):
Updated the code snippet to reflect the change in getting request
settings from a service ID.

Additional information:

*
[`python/DEV_SETUP.md`](diffhunk://#diff-22a026622159be328328c5bb6fef874e8aa799efb6ab8844d0c94ad051b08f3cL287-R252):
Added information on how to run code coverage, how to keep the local
repository up-to-date, and how to resolve conflicts after a rebase.
*
[`python/README.md`](diffhunk://#diff-217ed82f87b78b399e304b07a159b27dff327c0f83adf4a2fc30b03bcbf84b01R7-R14):
Added instructions on how to install optional dependencies.
2024-04-04 13:41:27 +00:00
tomoamandEvan Mattson 67eda9888e Python: Fix the command for pipeline checks in DEV_SETUP.md (#5726)
### Motivation and Context

<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->

Since `.pre-commit-config.yaml` was moved in #5689, I would fix the
command accordingly.

### Description

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

please see the `Files Changed` tab.

### 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]>
2024-04-03 13:57:38 +00:00
Evan Mattson 8079755106 Python: Revert Pysdk issue 3980 (#5063) (#5119)
This reverts commit ce1ebe1611.

### Motivation and Context

<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->

### Description

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

### Contribution Checklist

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

- [ ] The code builds clean without any errors or warnings
- [ ] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [ ] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone 😄
2024-02-22 15:56:36 +00:00
ce1ebe1611 Python: Pysdk issue 3980 (#5063)
### Motivation and Context

This PR is to add a [Python coverage
comment](https://github.com/marketplace/actions/python-coverage-comment)
GitHub action to the CICD workflow, so that comments related to coverage
change will be posted to a PR automatically.

In this PR:
1. I updated the `DEV_SETUP.md` to include some instructions on how to
enable `pre-commit`
2. I added the `coverage` package as the dev dependency
3. I updated the `.coveragerc` file so that `.coverage` is generated in
relative path
4. I added the workflow for generating and posting coverage comments.

<!-- 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?
  5. What problem does it solve?
  6. 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! -->

### 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: Huijing Huang <[email protected]>
Co-authored-by: Evan Mattson <[email protected]>
2024-02-22 10:13:45 -05:00
Julio Carlos MenendezandEvan Mattson d97f9536c4 Python: Removes the _async suffix where is not needed (#4735)
### Motivation and Context
Delete all *_async where *_sync doesn't exist to make the library more
Pythonic.

Fixes #4629 

### 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]>
2024-01-26 17:15:35 +00:00
Julio Carlos Menendez 08710373a4 Python: Renames SK prefix to Kernel (#4716)
### Motivation and Context
The .NET SDK uses the `Kernel` prefix instead of `SK` for the context,
function, model, etc. classes. This PR aligns the Python package with
that policy.

Fixes #4561 
### 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 😄
2024-01-24 15:51:56 +00:00
Dmytro Struk 46e8c1e68b Python: .Net: Update dotnet notebooks to use SK 1.0.0-beta1 version (#3158)
### 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.
-->

Resolves: https://github.com/microsoft/semantic-kernel/issues/3125
Resolves: https://github.com/microsoft/semantic-kernel/issues/2970
Resolves: https://github.com/microsoft/semantic-kernel/issues/3124

This PR contains changes in dotnet notebooks to upgrade SK package
version to `1.0.0-beta1`, necessary syntax changes in code examples and
`skills` to `plugins` renaming.

### 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 😄
2023-10-12 09:59:11 +00:00
Mark McFaddenandLee Miller 954e7c2f93 Python: Update dev setup readme (#2664)
### Motivation and Context

<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->

### Description
I made markdown updates to the DEV_SETUP.md file, updating the headings
and setting the language for the code fences.

### Contribution Checklist

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

- [x] 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: Lee Miller <[email protected]>
2023-08-31 23:06:48 +00:00
Lee MillerandDmytro Struk e298e2b75c Python: Add setup for contributing-python and tests for Semantic-Kernel-Python (#2536)
Add setup tasks for contributing-python and tests for
Semantic-Kernel-Python. The setup tasks install poetry and python
packages. The tests include unit tests, integration tests, and all tests
for Semantic-Kernel-Python.

### Contribution Checklist

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

- [x] The code builds clean without any errors or warnings
- [x] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄

---------

Co-authored-by: Dmytro Struk <[email protected]>
2023-08-31 16:30:56 +00:00
Matthew Bolaños 54ee340ca2 Python: Move notebooks into language folders (#2368)
### Motivation and Context
In an effort to move all samples to their respective language folder,
I've moved all of the notebooks to the correct language folder.


### 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 😄
2023-08-09 14:29:56 +00:00
Aditya GudimellaandAbby Harrison 68dbbcfb1a Python: Serialization add pydantic integration instructions (#2288)
### Summary

This is part 1 of the Serialization work for semantic kernel.

Corresponding issue:
https://github.com/microsoft/semantic-kernel/issues/131

### Motivation and Context

Adds instructions on how to serialize your classes using Pydantic.


<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->

### Description

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

### Contribution Checklist

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

- [ ] The code builds clean without any errors or warnings
- [ ] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [ ] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone 😄

---------

Co-authored-by: Abby Harrison <[email protected]>
2023-08-04 19:04:56 +00:00
Abby Harrison a9b61b2cf4 Python: Optional dependencies (#820)
### Motivation and Context
The release of Python SK from 0.2.4 -> 0.2.6 significantly increased the
size of the pip package. The dependencies causing this are not core to
the kernel, so this PR establishes a pattern for SK connector
dependencies (ex: Hugging Face, memory storage)

### Description
- Added a poetry group called hugging_face - this is the same name as
the connectors namespace in the code.
- Added dependency installs to the Hugging Face sample notebook.
- removed Hugging Face dependencies from requirements.txt.
- Added import errors for torch, transformers, and sentence-transformers
in the hugging_face connector classes.
- Added command `--with hugging_face` to integration test setup.
2023-05-06 03:35:13 +00:00
Abby Harrison 05c586b9d8 Create python-integration-tests.yml (#763)
### Motivation and Context
Run python integration tests on every push to main, and every 12 hours. 

These integration tests will run on every push to main as well as twice
a day. At the time of this PR, we are seeing ~3 PRs to the python SK per
day. Each Integration test run will make ~32 AI requests. For each PR,
12 runs will be made: 3 each for python 3.8, 3.9, 3.10, and 3.11 for a
total of ~400 calls per push to main.

We should re-evaluate the trigger on pushes to main if PRs to the python
SK significantly increase.

### Description
- add workflow definition for integration tests
- Example run:
https://github.com/microsoft/semantic-kernel/actions/runs/4874609026/jobs/8695771345?pr=763
- For push triggers, add path checks for dotnet/** or python/**
depending on the type of workflow
- pinned requirements.txt dependencies to the versions pinned in the
pyproject.toml file to ensure parity between pip package dependencies
and local code

**Note**: Integration tests are failing on windows with python 3.8 -
already captured a task to address the problem
2023-05-03 17:05:01 -07:00
Abby Harrison 4e2d886eff Python: Proper separation of unit and integration tests (#732)
### Motivation and Context
This PR introduces the ability to run formal integration tests for
python using pytest - separated from unit tests for easier automation.

### Description
- moved `python/tests/end-to-end` directory to
`python/tests/integration`
- renamed integration tests to test_* pattern so pytest will detect them
- import `GenerationConfig` for hugging face completions - according to
logs, this is the recommended practice
2023-05-01 16:16:36 -07:00
Abby HarrisonandDevis Lucato d9323b573f Remove kernel builder pattern for Python: sk.kernel_create() -> sk.Kernel() (#454)
### Motivation and Context

This PR makes creating a kernel instance more pythonic. The builder
pattern is removed and the kernel is constructed using Kernel(...).

Work originally started with #137

### Description

- Removed kernel_builder.py.
- Instance creation pattern `kernel = sk.create_kernel() -> kernel =
sk.Kernel()`
- For notebook 6, there is no need to create a separate kernel for the
GitHub files. Changed to use a separate collection.


Co-authored-by: Devis Lucato <[email protected]>
2023-04-17 11:07:46 -07:00
Devis Lucato 8621c7b074 New nugets (Abstractions, Connectors.AI.OpenAI); add AAD auth, Azure ChatGPT, text+chat streaming (#420)
### Motivation and Context

New features:
* AAD auth for Azure OpenAI
* Azure ChatGPT
* Completion streaming
* Chat streaming
* log probs

### Description

* Split kernel core nuget in 3 nugets and add dependency on Azure OpenAI
SDK:
* MS.SK.Abstractions: interfaces and common classes, ideally no business
logic
  * MS.SK: SK runtime, depends on SK.Abstractions
* MS.SK.Connectors.AI.OpenAI: OpenAI/Azure OpenAI code, depends on
SK.Abstractions and Azure OpenAI SDK
* Rewrote TextCompletion, ChatCompletion, EmbeddingGeneration clients to
use Azure OpenAI SDK
* Deleted unused code. The old OpenAI client is still in use only for
DALL-E2

Note: custom retry logic doesn't work with Azure OpenAI SDK. The SDK
already retries internally, using a different approach.

Nugets:
* Microsoft.SemanticKernel.0.12.0.nupkg
* **Microsoft.SemanticKernel.Abstractions.0.12.0.nupkg**
* **Microsoft.SemanticKernel.Connectors.AI.OpenAI.0.12.0.nupkg**
* Microsoft.SemanticKernel.Connectors.Memory.Qdrant.0.12.0.nupkg
* Microsoft.SemanticKernel.Connectors.Memory.Sqlite.0.12.0.nupkg
* Microsoft.SemanticKernel.Skills.MsGraph.0.12.0.nupkg
* Microsoft.SemanticKernel.Skills.Document.0.12.0.nupkg
* Microsoft.SemanticKernel.Skills.OpenAPI.0.12.0.nupkg
* Microsoft.SemanticKernel.Skills.Web.0.12.0.nupkg
2023-04-14 12:40:05 -07:00
Devis Lucato e2e5e2dad3 Python: docs update + ruff config + fix tests 2023-04-13 16:12:36 -07:00
Devis Lucato a11ab6366a Code style and docs 2023-04-13 16:12:36 -07:00
Devis Lucato 655c583ee0 Initial commit 2023-04-13 16:12:36 -07:00