mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
[BREAKING] Python: Standardize orchestration outputs as list of ChatMessage. Allow agent as group chat manager. (#2291)
* Standardize orchestration outputs as list of chatmessage. Add chat options to group chat prompt manager * refactor group chat * Improve group chat manager * README Update * Cleanup * Add comment * More cleanup * Standardize termination condition for group chat * Improvements on termination logic * Fix tests * Fix new line * PR feedback * Update ChatKit based on OpenAI type change * Raise error if response format is not expected type * Only one starting executor required. Add tests. * Add magentic start executor test
This commit is contained in:
committed by
GitHub
Unverified
parent
ed53ba158b
commit
907d79ab3c
@@ -233,8 +233,8 @@ async def run_agent_framework_example(task: str) -> str:
|
||||
|
||||
workflow = (
|
||||
GroupChatBuilder()
|
||||
.set_prompt_based_manager(
|
||||
chat_client=AzureOpenAIChatClient(credential=credential),
|
||||
.set_manager(
|
||||
manager=AzureOpenAIChatClient(credential=credential).create_agent(),
|
||||
display_name="Coordinator",
|
||||
)
|
||||
.participants(researcher=researcher, planner=planner)
|
||||
@@ -245,7 +245,12 @@ async def run_agent_framework_example(task: str) -> str:
|
||||
async for event in workflow.run_stream(task):
|
||||
if isinstance(event, WorkflowOutputEvent):
|
||||
data = event.data
|
||||
final_response = data.text or "" if isinstance(data, ChatMessage) else str(data)
|
||||
if isinstance(data, list) and len(data) > 0:
|
||||
# Get the final message from the conversation
|
||||
final_message = data[-1]
|
||||
final_response = final_message.text or "" if isinstance(final_message, ChatMessage) else str(data)
|
||||
else:
|
||||
final_response = str(data)
|
||||
return final_response
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user