Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/python-test-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ jobs:
wait-interval: 10
allowed-conclusions: success
- uses: actions/checkout@v4
- name: Setup filename variables
run: echo "FILE_ID=${{ github.run_id }}-${{ matrix.os }}-${{ matrix.python-version }}" >> $GITHUB_ENV
- name: Download coverage
continue-on-error: true
uses: dawidd6/action-download-artifact@v3
with:
name: python-coverage-${{ matrix.os }}-${{ matrix.python-version }}.txt
name: python-coverage-${{ env.FILE_ID }}.txt
github_token: ${{ secrets.GH_ACTIONS_PR_WRITE }}
workflow: python-unit-tests.yml
search_artifacts: true
Expand All @@ -47,7 +49,7 @@ jobs:
continue-on-error: true
uses: dawidd6/action-download-artifact@v3
with:
name: pytest-${{ matrix.os }}-${{ matrix.python-version }}.xml
name: pytest-${{ env.FILE_ID }}.xml
github_token: ${{ secrets.GH_ACTIONS_PR_WRITE }}
workflow: python-unit-tests.yml
search_artifacts: true
Expand Down
25 changes: 16 additions & 9 deletions .github/workflows/python-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,26 @@ jobs:
python-unit-tests:
name: Python Unit Tests
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
fail-fast: true
matrix:
python-version: ["3.10", "3.11", "3.12"]
os: [ubuntu-latest, windows-latest, macos-latest]
experimental: [false]
include:
- python-version: "3.13.0-beta.3"
os: "ubuntu-latest"
experimental: true
permissions:
contents: write
defaults:
run:
working-directory: ./python
working-directory: python
steps:
- uses: actions/checkout@v4
- name: Setup filename variables
run: echo "FILE_ID=${{ github.run_id }}-${{ matrix.os }}-${{ matrix.python-version }}" >> $GITHUB_ENV
- name: Install poetry
run: pipx install poetry
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -32,19 +40,18 @@ jobs:
- name: Install dependencies
run: poetry install --with unit-tests
- name: Test with pytest
run: poetry run pytest -q --junitxml=pytest-${{ matrix.os }}-${{ matrix.python-version }}.xml --cov=semantic_kernel --cov-report=term-missing:skip-covered ./tests/unit | tee python-coverage-${{ matrix.os }}-${{ matrix.python-version }}.txt
continue-on-error: false
run: poetry run pytest -q --junitxml=pytest.xml --cov=semantic_kernel --cov-report=term-missing:skip-covered ./tests/unit | tee python-coverage.txt
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: python-coverage-${{ matrix.os }}-${{ matrix.python-version }}.txt
path: python/python-coverage-${{ matrix.os }}-${{ matrix.python-version }}.txt
name: python-coverage-${{ env.FILE_ID }}.txt
path: python/python-coverage.txt
overwrite: true
retention-days: 1
retention-days: 1
- name: Upload pytest.xml
uses: actions/upload-artifact@v4
with:
name: pytest-${{ matrix.os }}-${{ matrix.python-version }}.xml
path: python/pytest-${{ matrix.os }}-${{ matrix.python-version }}.xml
name: pytest-${{ env.FILE_ID }}.xml
path: python/pytest.xml
overwrite: true
retention-days: 1
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,15 @@ class PromptExecutionSettings(KernelBaseModel):

@model_validator(mode="before")
@classmethod
def parse_function_choice_behavior(cls, data: dict[str, Any]) -> dict[str, Any] | None:
def parse_function_choice_behavior(cls, data: dict[str, Any]) -> dict[str, Any]:
"""Parse the function choice behavior data."""
if data:
function_choice_behavior_data = data.get("function_choice_behavior")
if function_choice_behavior_data:
if isinstance(function_choice_behavior_data, str):
data["function_choice_behavior"] = FunctionChoiceBehavior.from_string(function_choice_behavior_data)
elif isinstance(function_choice_behavior_data, dict):
data["function_choice_behavior"] = FunctionChoiceBehavior.from_dict(function_choice_behavior_data)
return data
return None
function_choice_behavior_data = data.get("function_choice_behavior")
if function_choice_behavior_data:
if isinstance(function_choice_behavior_data, str):
data["function_choice_behavior"] = FunctionChoiceBehavior.from_string(function_choice_behavior_data)
elif isinstance(function_choice_behavior_data, dict):
data["function_choice_behavior"] = FunctionChoiceBehavior.from_dict(function_choice_behavior_data)
return data

def __init__(self, service_id: str | None = None, **kwargs: Any):
"""Initialize the prompt execution settings.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
from semantic_kernel.connectors.ai import PromptExecutionSettings


def test_default_complete_prompt_execution_settings():
def test_init():
settings = PromptExecutionSettings()
assert settings.service_id is None
assert settings.extension_data == {}


def test_custom_complete_prompt_execution_settings():
def test_init_with_data():
ext_data = {"test": "test"}
settings = PromptExecutionSettings(service_id="test", extension_data=ext_data)
assert settings.service_id == "test"
Expand Down