Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ opentelemetry = [
]
pydantic = ["pydantic>=2.0.0,<3"]
openai-agents = [
"openai-agents >= 0.1,<0.2",
"openai-agents >= 0.2.3,<0.3",
"eval-type-backport>=0.2.2; python_version < '3.10'"
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def make_tool(tool: ToolInput) -> Tool:
raise UserError(f"Unknown tool type: {tool.name}")

tools = [make_tool(x) for x in input.get("tools", [])]
handoffs = [
handoffs: list[Handoff[Any, Any]] = [
Handoff(
tool_name=x.tool_name,
tool_description=x.tool_description,
Expand Down
21 changes: 20 additions & 1 deletion tests/contrib/openai_agents/test_openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
)
from openai.types.responses.response_function_web_search import ActionSearch
from openai.types.responses.response_prompt_param import ResponsePromptParam
from pydantic import ConfigDict, Field
from pydantic import ConfigDict, Field, TypeAdapter

from temporalio import activity, workflow
from temporalio.client import Client, WorkflowFailureError, WorkflowHandle
Expand Down Expand Up @@ -1778,3 +1778,22 @@ async def test_workflow_method_tools(client: Client):
execution_timeout=timedelta(seconds=10),
)
await workflow_handle.result()


async def test_response_serialization(client: Client):
import json

from openai.types.responses.response_output_item import ImageGenerationCall

data = json.loads(
b'{"id": "msg_68757ec43348819d86709f0fcb70316301a1194a3e05b38c","type": "image_generation_call","status": "completed"}'
)
call = TypeAdapter(ImageGenerationCall).validate_python(data)
model_response = ModelResponse(
output=[
call,
],
usage=Usage(),
response_id="",
)
encoded = await pydantic_data_converter.encode([model_response])
Loading
Loading