Skip to content

Commit 60091e9

Browse files
committed
Undo activity output wrapping.
1 parent d1fa392 commit 60091e9

File tree

2 files changed

+3
-19
lines changed

2 files changed

+3
-19
lines changed

azure/durable_functions/openai_agents/model_invocation_activity.py

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -179,20 +179,6 @@ def from_json(cls, json_str: str) -> 'ActivityModelInput':
179179
"""Create an ActivityModelInput instance from a JSON string."""
180180
return cls.model_validate_json(json_str)
181181

182-
class ActivityModelOutput(BaseModel):
183-
"""Output from the invoke_model_activity activity."""
184-
185-
response: ModelResponse
186-
187-
def to_json(self) -> str:
188-
"""Convert the ActivityModelOutput to a JSON string."""
189-
return self.model_dump_json()
190-
191-
@classmethod
192-
def from_json(cls, json_str: str) -> 'ActivityModelOutput':
193-
"""Create an ActivityModelOutput instance from a JSON string."""
194-
return cls.model_validate_json(json_str)
195-
196182
class ModelInvoker:
197183
"""Handles OpenAI model invocations for Durable Functions activities."""
198184

@@ -379,9 +365,7 @@ def make_tool_info(tool: Tool) -> ToolInput:
379365
self.activity_name, activity_input_json
380366
)
381367

382-
output = ActivityModelOutput.from_json(response)
383-
384-
return output.response
368+
return response
385369

386370
def stream_response(
387371
self,

azure/durable_functions/openai_agents/orchestrator_generator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from agents.run import set_default_agent_runner
55
from azure.durable_functions.models.DurableOrchestrationContext import DurableOrchestrationContext
66
from azure.durable_functions.models.RetryOptions import RetryOptions
7-
from .model_invocation_activity import ActivityModelInput, ActivityModelOutput, ModelInvoker
7+
from .model_invocation_activity import ActivityModelInput, ModelInvoker
88
from .task_tracker import TaskTracker
99
from .runner import DurableOpenAIRunner
1010
from .context import DurableAIAgentContext
@@ -17,7 +17,7 @@ async def durable_openai_agent_activity(input: str, model_provider: ModelProvide
1717
activity_input = ActivityModelInput.from_json(input)
1818

1919
model_invoker = ModelInvoker(model_provider=model_provider)
20-
response = await model_invoker.invoke_model_activity(activity_input)
20+
result = await model_invoker.invoke_model_activity(activity_input)
2121

2222
# Use safe/public Pydantic API when possible. Prefer model_dump_json if result is a BaseModel
2323
# Otherwise handle common types (str/bytes/dict/list) and fall back to json.dumps.

0 commit comments

Comments
 (0)