mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
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:
committed by
GitHub
Unverified
parent
ed113f941c
commit
aab621f5eb
@@ -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"},
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user