Python: [Breaking] Simplified Content types to a single class with classmethod constructors. (#3252)

* ported Content to a new model

* fixed linting

* fixes

* fixed data format handling

* fix for 3.10 mypy

* fix

* fix int test
This commit is contained in:
Eduard van Valkenburg
2026-01-20 23:09:39 +01:00
committed by GitHub
Unverified
parent 73761aa4a3
commit 83e6229c11
132 changed files with 3949 additions and 4741 deletions
@@ -84,7 +84,7 @@ async def test_discovery_accepts_agents_with_only_run():
init_file = agent_dir / "__init__.py"
init_file.write_text("""
from agent_framework import AgentResponse, AgentThread, ChatMessage, Role, TextContent
from agent_framework import AgentResponse, AgentThread, ChatMessage, Role, Content
class NonStreamingAgent:
id = "non_streaming"
@@ -95,7 +95,7 @@ class NonStreamingAgent:
return AgentResponse(
messages=[ChatMessage(
role=Role.ASSISTANT,
contents=[TextContent(text="response")]
contents=[Content.from_text(text="response")]
)],
response_id="test"
)
@@ -210,7 +210,7 @@ class TestAgent:
async def run(self, messages=None, *, thread=None, **kwargs):
return AgentResponse(
messages=[ChatMessage(role=Role.ASSISTANT, contents=[TextContent(text="test")])],
messages=[ChatMessage(role=Role.ASSISTANT, contents=[Content.from_text(text="test")])],
response_id="test"
)