Skip to content

Commit 53868d7

Browse files
committed
rename
1 parent cdcbee7 commit 53868d7

6 files changed

Lines changed: 20 additions & 22 deletions

File tree

temporalio/contrib/openai_agents/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ External consumers (UIs, tracing pipelines, etc.) observe events as
593593
they arrive by hosting a [`WorkflowStream`](../workflow_streams/README.md)
594594
in the workflow and subscribing with `WorkflowStreamClient`. The
595595
streaming activity publishes each event to the topic configured on
596-
`ModelActivityParameters.streaming_event_topic`. The topic is required
596+
`ModelActivityParameters.streaming_topic`. The topic is required
597597
when using `Runner.run_streamed`; calling it without a configured topic
598598
raises before any activity is scheduled.
599599

@@ -621,7 +621,7 @@ class MyAgent:
621621

622622
To publish raw model events to external subscribers, host a
623623
`WorkflowStream` in the workflow and configure
624-
`OpenAIAgentsPlugin(model_params=ModelActivityParameters(streaming_event_topic="events"))`. See [`temporalio.contrib.workflow_streams`](../workflow_streams/README.md) for the
624+
`OpenAIAgentsPlugin(model_params=ModelActivityParameters(streaming_topic="events"))`. See [`temporalio.contrib.workflow_streams`](../workflow_streams/README.md) for the
625625
publisher and subscriber API.
626626

627627
`RunResultStreaming.stream_events()` yields the agents-SDK

temporalio/contrib/openai_agents/_invoke_model_activity.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ class StreamingActivityModelInput(ActivityModelInput, total=False):
195195
Adds the streaming-only fields on top of :class:`ActivityModelInput`.
196196
"""
197197

198-
streaming_event_topic: Required[str]
199-
streaming_event_batch_interval: timedelta
198+
streaming_topic: Required[str]
199+
streaming_batch_interval: timedelta
200200

201201

202202
async def _empty_on_invoke_tool(_ctx: RunContextWrapper[Any], _input: str) -> str:
@@ -354,7 +354,7 @@ async def invoke_model_activity_streaming(
354354
terminal ``ResponseCompletedEvent``.
355355
356356
Each event is also published to the workflow's stream on
357-
``streaming_event_topic`` so external consumers (UIs, tracing,
357+
``streaming_topic`` so external consumers (UIs, tracing,
358358
etc.) can observe events as they arrive.
359359
360360
Heartbeats run on a background task via ``_auto_heartbeater`` so
@@ -364,9 +364,9 @@ async def invoke_model_activity_streaming(
364364
model = self._model_provider.get_model(input.get("model_name"))
365365
tools, handoffs = _build_tools_and_handoffs(input)
366366

367-
topic = input["streaming_event_topic"]
367+
topic = input["streaming_topic"]
368368
batch_interval = input.get(
369-
"streaming_event_batch_interval", timedelta(milliseconds=100)
369+
"streaming_batch_interval", timedelta(milliseconds=100)
370370
)
371371
events: list[TResponseStreamEvent] = []
372372

temporalio/contrib/openai_agents/_model_parameters.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class ModelActivityParameters:
6969
use_local_activity: bool = False
7070
"""Whether to use a local activity. If changed during a workflow execution, that would break determinism."""
7171

72-
streaming_event_topic: str | None = None
72+
streaming_topic: str | None = None
7373
"""Stream topic to publish raw model stream events to when the workflow
7474
calls ``Runner.run_streamed``. Required for ``Runner.run_streamed``;
7575
if left as ``None``, ``run_streamed`` raises before scheduling any
@@ -84,7 +84,7 @@ class ModelActivityParameters:
8484
Streaming support is experimental and may change in future
8585
versions."""
8686

87-
streaming_event_batch_interval: timedelta = timedelta(milliseconds=100)
87+
streaming_batch_interval: timedelta = timedelta(milliseconds=100)
8888
"""Interval between automatic flushes for the stream publisher used
8989
by the streaming activity.
9090

temporalio/contrib/openai_agents/_openai_runner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,10 +268,10 @@ def run_streamed(
268268
# captured into ``RunResultStreaming._stored_exception`` and may
269269
# be silently dropped if the queue completion sentinel is read
270270
# before the run_loop_task is observed as done.
271-
if self.model_params.streaming_event_topic is None:
271+
if self.model_params.streaming_topic is None:
272272
raise AgentsWorkflowError(
273273
"Runner.run_streamed requires "
274-
"ModelActivityParameters.streaming_event_topic to be set."
274+
"ModelActivityParameters.streaming_topic to be set."
275275
)
276276
if self.model_params.use_local_activity:
277277
raise AgentsWorkflowError(

temporalio/contrib/openai_agents/_temporal_model_stub.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,11 @@ async def stream_response(
245245
"workflow stream signal channel)."
246246
)
247247

248-
topic = self.model_params.streaming_event_topic
248+
topic = self.model_params.streaming_topic
249249
if topic is None:
250250
raise ValueError(
251251
"Runner.run_streamed requires "
252-
"ModelActivityParameters.streaming_event_topic to be set."
252+
"ModelActivityParameters.streaming_topic to be set."
253253
)
254254

255255
base_input, summary = self._build_activity_input(
@@ -266,10 +266,8 @@ async def stream_response(
266266
)
267267
streaming_input: StreamingActivityModelInput = {
268268
**base_input,
269-
"streaming_event_topic": topic,
270-
"streaming_event_batch_interval": (
271-
self.model_params.streaming_event_batch_interval
272-
),
269+
"streaming_topic": topic,
270+
"streaming_batch_interval": (self.model_params.streaming_batch_interval),
273271
}
274272

275273
events = await workflow.execute_activity_method(

tests/contrib/openai_agents/test_openai_streaming.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def get_workflow_event_types(self) -> list[str]:
205205
@workflow.defn
206206
class StreamingRequiresTopicWorkflow:
207207
"""Workflow that opts into ``Runner.run_streamed`` while the model
208-
plugin was configured without a ``streaming_event_topic``.
208+
plugin was configured without a ``streaming_topic``.
209209
210210
The stub raises before scheduling the streaming activity; this
211211
propagates out of ``Runner.run_streamed`` and fails the workflow.
@@ -232,7 +232,7 @@ async def test_streaming_publishes_raw_events(client: Client):
232232
model=StreamingTestModel(),
233233
model_params=ModelActivityParameters(
234234
start_to_close_timeout=timedelta(seconds=30),
235-
streaming_event_topic="events",
235+
streaming_topic="events",
236236
),
237237
) as env:
238238
client = env.applied_on_client(client)
@@ -300,7 +300,7 @@ async def test_streaming_requires_topic(client: Client):
300300
model=StreamingTestModel(),
301301
model_params=ModelActivityParameters(
302302
start_to_close_timeout=timedelta(seconds=30),
303-
streaming_event_topic=None,
303+
streaming_topic=None,
304304
),
305305
) as env:
306306
client = env.applied_on_client(client)
@@ -316,7 +316,7 @@ async def test_streaming_requires_topic(client: Client):
316316
execution_timeout=timedelta(seconds=30),
317317
)
318318

319-
assert "streaming_event_topic" in str(exc_info.value.cause)
319+
assert "streaming_topic" in str(exc_info.value.cause)
320320

321321

322322
@pytest.mark.asyncio
@@ -328,7 +328,7 @@ async def test_streaming_rejects_local_activity(client: Client):
328328
model=StreamingTestModel(),
329329
model_params=ModelActivityParameters(
330330
start_to_close_timeout=timedelta(seconds=30),
331-
streaming_event_topic="events",
331+
streaming_topic="events",
332332
use_local_activity=True,
333333
),
334334
) as env:

0 commit comments

Comments
 (0)