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
@@ -21,7 +21,7 @@ async def main() -> None:
print("=== OpenAI Assistants Client with Explicit Settings ===")
async with OpenAIAssistantsClient(
ai_model_id=os.environ["OPENAI_CHAT_MODEL_ID"],
model_id=os.environ["OPENAI_CHAT_MODEL_ID"],
api_key=os.environ["OPENAI_API_KEY"],
).create_agent(
instructions="You are a helpful weather agent.",
@@ -21,7 +21,7 @@ async def main() -> None:
print("=== OpenAI Chat Client with Explicit Settings ===")
agent = OpenAIChatClient(
ai_model_id=os.environ["OPENAI_CHAT_MODEL_ID"],
model_id=os.environ["OPENAI_CHAT_MODEL_ID"],
api_key=os.environ["OPENAI_API_KEY"],
).create_agent(
instructions="You are a helpful weather agent.",
@@ -7,7 +7,7 @@ from agent_framework.openai import OpenAIChatClient
async def main() -> None:
client = OpenAIChatClient(ai_model_id="gpt-4o-search-preview")
client = OpenAIChatClient(model_id="gpt-4o-search-preview")
message = "What is the current weather? Do not ask for my current location."
# Test that the client will use the web search tool with location
@@ -10,7 +10,7 @@ async def reasoning_example() -> None:
"""Example of reasoning response (get results as they are generated)."""
print("=== Reasoning Example ===")
agent = OpenAIResponsesClient(ai_model_id="gpt-5").create_agent(
agent = OpenAIResponsesClient(model_id="gpt-5").create_agent(
name="MathHelper",
instructions="You are a personal math tutor. When asked a math question, "
"write and run code using the python tool to answer the question.",
@@ -21,7 +21,7 @@ async def main() -> None:
print("=== OpenAI Responses Client with Explicit Settings ===")
agent = OpenAIResponsesClient(
ai_model_id=os.environ["OPENAI_RESPONSES_MODEL_ID"],
model_id=os.environ["OPENAI_RESPONSES_MODEL_ID"],
api_key=os.environ["OPENAI_API_KEY"],
).create_agent(
instructions="You are a helpful weather agent.",