Skip to content

Commit 198bfbe

Browse files
committed
Wrap basic.hello_world.main invocation into an activity and invoke it from the orchestrator
1 parent 0a54124 commit 198bfbe

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

samples-v2/openai_agents/function_app.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,18 @@ def hello_orchestration_orchestrator(context):
2525
# Activity
2626
@app.activity_trigger(input_name="city")
2727
def hello_orchestration_activity(city: str):
28-
return "Hello " + city
28+
return "Hello " + city
29+
30+
31+
@app.orchestration_trigger(context_name="context")
32+
def basic_hello_world_orchestrator(context):
33+
result = yield context.call_activity("openai_agent_activity")
34+
return result
35+
36+
# Activity for OpenAI agent execution
37+
@app.activity_trigger(input_name="input")
38+
async def openai_agent_activity(input: str):
39+
# Import and call the main function from basic/hello_world.py
40+
from basic.hello_world import main
41+
result = await main()
42+
return result

0 commit comments

Comments
 (0)