Skip to content

Commit 6cb8ce4

Browse files
authored
1 parent 1387fbd commit 6cb8ce4

File tree

3 files changed

+177
-155
lines changed

3 files changed

+177
-155
lines changed

openai_agents/run_worker.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
from __future__ import annotations
22

33
import asyncio
4-
import concurrent.futures
54
from datetime import timedelta
65

7-
from temporalio import workflow
86
from temporalio.client import Client
97
from temporalio.contrib.openai_agents.invoke_model_activity import ModelActivity
10-
from temporalio.contrib.openai_agents.open_ai_data_converter import (
11-
open_ai_data_converter,
12-
)
8+
from temporalio.contrib.openai_agents.model_parameters import ModelActivityParameters
139
from temporalio.contrib.openai_agents.temporal_openai_agents import (
1410
set_open_ai_agent_temporal_overrides,
1511
)
12+
from temporalio.contrib.pydantic import pydantic_data_converter
1613
from temporalio.worker import Worker
1714

1815
from openai_agents.workflows.agents_as_tools_workflow import AgentsAsToolsWorkflow
@@ -25,12 +22,14 @@
2522

2623
async def main():
2724
with set_open_ai_agent_temporal_overrides(
28-
start_to_close_timeout=timedelta(seconds=60),
25+
model_params=ModelActivityParameters(
26+
start_to_close_timeout=timedelta(seconds=60),
27+
),
2928
):
3029
# Create client connected to server at the given address
3130
client = await Client.connect(
3231
"localhost:7233",
33-
data_converter=open_ai_data_converter,
32+
data_converter=pydantic_data_converter,
3433
)
3534

3635
model_activity = ModelActivity(model_provider=None)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ authors = [{ name = "Temporal Technologies Inc", email = "sdk@temporal.io" }]
66
requires-python = "~=3.9"
77
readme = "README.md"
88
license = "MIT"
9-
dependencies = ["temporalio>=1.13.0,<2"]
9+
dependencies = ["temporalio>=1.14.0,<2"]
1010

1111
[project.urls]
1212
Homepage = "https://github.com/temporalio/samples-python"

0 commit comments

Comments
 (0)