Skip to content

Commit 3a2d2c3

Browse files
cleanup types in openai agents samples
1 parent 7c112c0 commit 3a2d2c3

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

openai_agents/financial_research_agent/financial_research_manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import asyncio
44
from collections.abc import Sequence
55

6-
from agents import RunConfig, Runner, RunResult, custom_span, trace
6+
from agents import RunConfig, Runner, RunResult, RunResultStreaming, custom_span, trace
77
from temporalio import workflow
88

99
from openai_agents.financial_research_agent.agents.financials_agent import (
@@ -26,7 +26,7 @@
2626
)
2727

2828

29-
async def _summary_extractor(run_result: RunResult) -> str:
29+
async def _summary_extractor(run_result: RunResult | RunResultStreaming) -> str:
3030
"""Custom output extractor for sub-agents that return an AnalysisSummary."""
3131
# The financial/risk analyst agents emit an AnalysisSummary with a `summary` field.
3232
# We want the tool call to return just that summary text so the writer can drop it inline.

openai_agents/tools/workflows/image_generator_workflow.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from typing import Optional
55

66
from agents import Agent, ImageGenerationTool, Runner
7+
from openai.types.responses.response_output_item import ImageGenerationCall
78
from temporalio import workflow
89

910

@@ -34,7 +35,7 @@ async def run(self, prompt: str) -> ImageGenerationResult:
3435
for item in result.new_items:
3536
if (
3637
item.type == "tool_call_item"
37-
and item.raw_item.type == "image_generation_call"
38+
and isinstance(item.raw_item, ImageGenerationCall)
3839
and (img_result := item.raw_item.result)
3940
):
4041
image_data = img_result

0 commit comments

Comments
 (0)