Python: Properly configure structured outputs based on new options dict (#3213)

* Properly configure structured outputs based on new options dict

* Fix mypy
This commit is contained in:
Evan Mattson
2026-01-15 11:41:46 +09:00
committed by GitHub
Unverified
parent 620da7a829
commit 15d0c34d9f
18 changed files with 56 additions and 55 deletions
@@ -138,7 +138,7 @@ def create_spam_detector_agent() -> ChatAgent:
"Include the original email content in email_content."
),
name="spam_detection_agent",
response_format=DetectionResult,
default_options={"response_format": DetectionResult},
)
@@ -152,7 +152,7 @@ def create_email_assistant_agent() -> ChatAgent:
"Return JSON with a single field 'response' containing the drafted reply."
),
name="email_assistant_agent",
response_format=EmailResponse,
default_options={"response_format": EmailResponse},
)
@@ -190,7 +190,7 @@ def create_email_analysis_agent() -> ChatAgent:
"and 'reason' (string)."
),
name="email_analysis_agent",
response_format=AnalysisResultAgent,
default_options={"response_format": AnalysisResultAgent},
)
@@ -199,7 +199,7 @@ def create_email_assistant_agent() -> ChatAgent:
return AzureOpenAIChatClient(credential=AzureCliCredential()).create_agent(
instructions=("You are an email assistant that helps users draft responses to emails with professionalism."),
name="email_assistant_agent",
response_format=EmailResponse,
default_options={"response_format": EmailResponse},
)
@@ -208,7 +208,7 @@ def create_email_summary_agent() -> ChatAgent:
return AzureOpenAIChatClient(credential=AzureCliCredential()).create_agent(
instructions=("You are an assistant that helps users summarize emails."),
name="email_summary_agent",
response_format=EmailSummaryModel,
default_options={"response_format": EmailSummaryModel},
)
@@ -243,7 +243,8 @@ async def main() -> None:
)
workflow = (
workflow_builder.set_start_executor("store_email")
workflow_builder
.set_start_executor("store_email")
.add_edge("store_email", "email_analysis_agent")
.add_edge("email_analysis_agent", "to_analysis_result")
.add_multi_selection_edge_group(
@@ -162,7 +162,7 @@ def create_spam_detection_agent() -> ChatAgent:
"and 'reason' (string)."
),
name="spam_detection_agent",
response_format=DetectionResultAgent,
default_options={"response_format": DetectionResultAgent},
)
@@ -171,7 +171,7 @@ def create_email_assistant_agent() -> ChatAgent:
return AzureOpenAIChatClient(credential=AzureCliCredential()).create_agent(
instructions=("You are an email assistant that helps users draft responses to emails with professionalism."),
name="email_assistant_agent",
response_format=EmailResponse,
default_options={"response_format": EmailResponse},
)