Python: Fix tool normalization and provider sample consolidation (#3953)

* Fix tool normalization and provider samples

- restore callable/single-tool normalization paths and unset tool-choice behavior\n- consolidate and expand chat/provider samples (OpenAI/Azure/Anthropic/Ollama/Bedrock)\n- migrate Bedrock lazy import surface to agent_framework.amazon and move provider samples

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* small fix in sample

* Finalize provider, samples, and core cleanup

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix CopilotTool passthrough in agent

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix link

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Eduard van Valkenburg
2026-02-16 17:30:38 +01:00
committed by GitHub
Unverified
parent ed113f941c
commit aab621f5eb
99 changed files with 1190 additions and 969 deletions
+3 -5
View File
@@ -3,7 +3,7 @@
import asyncio
from collections.abc import AsyncIterable, Sequence
from agent_framework import ChatResponse, ChatResponseUpdate, Content, ResponseStream, Role
from agent_framework import ChatResponse, ChatResponseUpdate, Content, Message, ResponseStream
"""ResponseStream: A Deep Dive
@@ -256,8 +256,7 @@ async def main() -> None:
"""Result hook that wraps the response text in quotes."""
if response.text:
return ChatResponse(
messages=f'"{response.text}"',
role=Role.ASSISTANT,
messages=[Message(text=f'"{response.text}"', role="assistant")],
additional_properties=response.additional_properties,
)
return response
@@ -294,8 +293,7 @@ async def main() -> None:
# In real code, this would create an AgentResponse
text = "".join(u.text or "" for u in updates)
return ChatResponse(
text=f"[AGENT FINAL] {text}",
role=Role.ASSISTANT,
messages=[Message(text=f"[AGENT FINAL] {text}", role="assistant")],
additional_properties={"layer": "agent"},
)