Skip to content

Commit b0e10f0

Browse files
committed
Rename plugin + a few fixes
1 parent e116ada commit b0e10f0

File tree

5 files changed

+15
-28
lines changed

5 files changed

+15
-28
lines changed

temporalio/contrib/openai_agents/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010

1111
from temporalio.contrib.openai_agents._model_parameters import ModelActivityParameters
1212
from temporalio.contrib.openai_agents.temporal_openai_agents import (
13-
Plugin,
13+
OpenAIAgentsPlugin,
1414
TestModel,
1515
TestModelProvider,
1616
)
1717

1818
from . import workflow
1919

2020
__all__ = [
21-
"Plugin",
21+
"OpenAIAgentsPlugin",
2222
"ModelActivityParameters",
2323
"workflow",
2424
"TestModel",

temporalio/contrib/openai_agents/temporal_openai_agents.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def stream_response(
144144
raise NotImplementedError()
145145

146146

147-
class Plugin(temporalio.client.Plugin, temporalio.worker.Plugin):
147+
class OpenAIAgentsPlugin(temporalio.client.Plugin, temporalio.worker.Plugin):
148148
"""Temporal plugin for integrating OpenAI agents with Temporal workflows.
149149
150150
.. warning::
@@ -171,7 +171,7 @@ class Plugin(temporalio.client.Plugin, temporalio.worker.Plugin):
171171
Example:
172172
>>> from temporalio.client import Client
173173
>>> from temporalio.worker import Worker
174-
>>> from temporalio.contrib.openai_agents import Plugin, ModelActivityParameters
174+
>>> from temporalio.contrib.openai_agents import OpenAIAgentsPlugin, ModelActivityParameters
175175
>>> from datetime import timedelta
176176
>>>
177177
>>> # Configure model parameters
@@ -181,7 +181,7 @@ class Plugin(temporalio.client.Plugin, temporalio.worker.Plugin):
181181
... )
182182
>>>
183183
>>> # Create plugin
184-
>>> plugin = Plugin(model_params=model_params)
184+
>>> plugin = OpenAIAgentsPlugin(model_params=model_params)
185185
>>>
186186
>>> # Use with client and worker
187187
>>> client = await Client.connect(
@@ -192,7 +192,6 @@ class Plugin(temporalio.client.Plugin, temporalio.worker.Plugin):
192192
... client,
193193
... task_queue="my-task-queue",
194194
... workflows=[MyWorkflow],
195-
... plugins=[plugin]
196195
... )
197196
"""
198197

tests/contrib/openai_agents/test_openai.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ async def test_hello_world_agent(client: Client, use_local_model: bool):
124124
pytest.skip("No openai API key")
125125
new_config = client.config()
126126
new_config["plugins"] = [
127-
openai_agents.Plugin(
127+
openai_agents.OpenAIAgentsPlugin(
128128
model_params=ModelActivityParameters(
129129
start_to_close_timeout=timedelta(seconds=30)
130130
),
@@ -412,7 +412,7 @@ async def test_tool_workflow(client: Client, use_local_model: bool):
412412
pytest.skip("No openai API key")
413413
new_config = client.config()
414414
new_config["plugins"] = [
415-
openai_agents.Plugin(
415+
openai_agents.OpenAIAgentsPlugin(
416416
model_params=ModelActivityParameters(
417417
start_to_close_timeout=timedelta(seconds=30)
418418
),
@@ -532,7 +532,7 @@ async def test_nexus_tool_workflow(
532532

533533
new_config = client.config()
534534
new_config["plugins"] = [
535-
openai_agents.Plugin(
535+
openai_agents.OpenAIAgentsPlugin(
536536
model_params=ModelActivityParameters(
537537
start_to_close_timeout=timedelta(seconds=30)
538538
),
@@ -678,7 +678,7 @@ async def test_research_workflow(client: Client, use_local_model: bool):
678678
pytest.skip("No openai API key")
679679
new_config = client.config()
680680
new_config["plugins"] = [
681-
openai_agents.Plugin(
681+
openai_agents.OpenAIAgentsPlugin(
682682
model_params=ModelActivityParameters(
683683
start_to_close_timeout=timedelta(seconds=30)
684684
),
@@ -892,7 +892,7 @@ async def test_agents_as_tools_workflow(client: Client, use_local_model: bool):
892892
pytest.skip("No openai API key")
893893
new_config = client.config()
894894
new_config["plugins"] = [
895-
openai_agents.Plugin(
895+
openai_agents.OpenAIAgentsPlugin(
896896
model_params=ModelActivityParameters(
897897
start_to_close_timeout=timedelta(seconds=30)
898898
),
@@ -1244,7 +1244,7 @@ async def test_customer_service_workflow(client: Client, use_local_model: bool):
12441244
pytest.skip("No openai API key")
12451245
new_config = client.config()
12461246
new_config["plugins"] = [
1247-
openai_agents.Plugin(
1247+
openai_agents.OpenAIAgentsPlugin(
12481248
model_params=ModelActivityParameters(
12491249
start_to_close_timeout=timedelta(seconds=30)
12501250
),
@@ -1534,7 +1534,7 @@ async def test_input_guardrail(client: Client, use_local_model: bool):
15341534
pytest.skip("No openai API key")
15351535
new_config = client.config()
15361536
new_config["plugins"] = [
1537-
openai_agents.Plugin(
1537+
openai_agents.OpenAIAgentsPlugin(
15381538
model_params=ModelActivityParameters(
15391539
start_to_close_timeout=timedelta(seconds=30)
15401540
),
@@ -1649,7 +1649,7 @@ async def test_output_guardrail(client: Client, use_local_model: bool):
16491649
pytest.skip("No openai API key")
16501650
new_config = client.config()
16511651
new_config["plugins"] = [
1652-
openai_agents.Plugin(
1652+
openai_agents.OpenAIAgentsPlugin(
16531653
model_params=ModelActivityParameters(
16541654
start_to_close_timeout=timedelta(seconds=30)
16551655
),
@@ -1737,7 +1737,7 @@ async def run_tool(self):
17371737
async def test_workflow_method_tools(client: Client):
17381738
new_config = client.config()
17391739
new_config["plugins"] = [
1740-
openai_agents.Plugin(
1740+
openai_agents.OpenAIAgentsPlugin(
17411741
model_params=ModelActivityParameters(
17421742
start_to_close_timeout=timedelta(seconds=30)
17431743
),

tests/contrib/openai_agents/test_openai_tracing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def force_flush(self) -> None:
4141
async def test_tracing(client: Client):
4242
new_config = client.config()
4343
new_config["plugins"] = [
44-
openai_agents.Plugin(model_provider=TestModelProvider(TestResearchModel()))
44+
openai_agents.OpenAIAgentsPlugin(model_provider=TestModelProvider(TestResearchModel()))
4545
]
4646
client = Client(**new_config)
4747

tests/test_client.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,15 +1501,3 @@ async def test_cloud_client_simple():
15011501
GetNamespaceRequest(namespace=os.environ["TEMPORAL_CLIENT_CLOUD_NAMESPACE"])
15021502
)
15031503
assert os.environ["TEMPORAL_CLIENT_CLOUD_NAMESPACE"] == result.namespace.namespace
1504-
1505-
1506-
class MyPlugin(Plugin):
1507-
def configure_client(self, config: ClientConfig) -> ClientConfig:
1508-
config["namespace"] = "replaced_namespace"
1509-
return super().configure_client(config)
1510-
1511-
async def connect_service_client(
1512-
self, config: temporalio.service.ConnectConfig
1513-
) -> temporalio.service.ServiceClient:
1514-
config.api_key = "replaced key"
1515-
return await super().connect_service_client(config)

0 commit comments

Comments
 (0)