mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
[BREAKING] Python: Refactor workflow events to unified discriminated union pattern (#3690)
* Refactor events * Merge main * Fixes * Cleanup * Update samples and tests * Remove unused imports * PR feedback * Merge main. Add properties for events to help typing * Formatting * Cleanup * use builtins.type to avoid shadowing by WorkflowEvent.type attribute * Final improvements
This commit is contained in:
committed by
GitHub
Unverified
parent
09f59b21ad
commit
0f3f4dbcaf
@@ -7,7 +7,7 @@ import sys
|
||||
from collections.abc import Sequence
|
||||
from typing import Any, cast
|
||||
|
||||
from agent_framework import ChatAgent, ChatMessage, GroupChatBuilder, WorkflowOutputEvent
|
||||
from agent_framework import ChatAgent, ChatMessage, GroupChatBuilderWorkflowEvent
|
||||
from agent_framework.azure import AzureOpenAIChatClient, AzureOpenAIResponsesClient
|
||||
from azure.identity import AzureCliCredential
|
||||
from semantic_kernel.agents import Agent, ChatCompletionAgent, GroupChatOrchestration
|
||||
@@ -240,7 +240,7 @@ async def run_agent_framework_example(task: str) -> str:
|
||||
|
||||
final_response = ""
|
||||
async for event in workflow.run(task, stream=True):
|
||||
if isinstance(event, WorkflowOutputEvent):
|
||||
if event.type == "output":
|
||||
data = event.data
|
||||
if isinstance(data, list) and len(data) > 0:
|
||||
# Get the final message from the conversation
|
||||
|
||||
Reference in New Issue
Block a user