Python: [BREAKING] added SerializationMixin and applied to contents, agents, chat client… (#1012)

* added SerializationMixin and applied to contents, agents, chat clients, removed AFBaseModel

* fix annotations type

* mypy fixes

* fix tests

* fix serializable subvalues and added large docstring

* updated indents in code block

* fixed exported urls
This commit is contained in:
Eduard van Valkenburg
2025-09-30 21:53:46 +02:00
committed by GitHub
Unverified
parent 3eb26632ce
commit 54ad135914
84 changed files with 2302 additions and 1957 deletions
-3
View File
@@ -1,3 +0,0 @@
# Copyright (c) Microsoft. All rights reserved.
"""Sample tests package."""
@@ -1,3 +0,0 @@
# Copyright (c) Microsoft. All rights reserved.
"""Getting started sample tests."""
@@ -146,7 +146,6 @@ from samples.getting_started.agents.openai.openai_responses_client_with_thread i
from samples.getting_started.agents.openai.openai_responses_client_with_web_search import (
main as openai_responses_client_with_web_search,
)
from tests.sample_utils import retry
# Environment variable for controlling sample tests
RUN_SAMPLES_TESTS = "RUN_SAMPLES_TESTS"
@@ -579,6 +578,7 @@ agent_samples = [
]
@pytest.mark.flaky
@mark.parametrize("sample, responses", agent_samples)
async def test_agent_samples(sample: Callable[..., Awaitable[Any]], responses: list[str], monkeypatch: MonkeyPatch):
"""Test agent samples with input mocking and retry logic."""
@@ -592,4 +592,4 @@ async def test_agent_samples(sample: Callable[..., Awaitable[Any]], responses: l
return responses.pop(0) if responses else "exit"
monkeypatch.setattr("builtins.input", mock_input)
await retry(sample, retries=3, reset=reset)
await sample
@@ -32,7 +32,6 @@ from samples.getting_started.chat_client.openai_chat_client import (
from samples.getting_started.chat_client.openai_responses_client import (
main as openai_responses_client,
)
from tests.sample_utils import retry
# Environment variable for controlling sample tests
RUN_SAMPLES_TESTS = "RUN_SAMPLES_TESTS"
@@ -132,4 +131,4 @@ async def test_chat_client_samples(
return responses.pop(0) if responses else "exit"
monkeypatch.setattr("builtins.input", mock_input)
await retry(sample, retries=3, reset=reset)
await sample
@@ -10,7 +10,6 @@ from pytest import MonkeyPatch, mark, param
from samples.getting_started.threads.custom_chat_message_store_thread import main as threads_custom_store
from samples.getting_started.threads.suspend_resume_thread import main as threads_suspend_resume
from tests.sample_utils import retry
# Environment variable for controlling sample tests
RUN_SAMPLES_TESTS = "RUN_SAMPLES_TESTS"
@@ -51,4 +50,4 @@ async def test_thread_samples(sample: Callable[..., Awaitable[Any]], responses:
return responses.pop(0) if responses else "exit"
monkeypatch.setattr("builtins.input", mock_input)
await retry(sample, retries=3, reset=reset)
await sample