Skip to content

Commit e9815ad

Browse files
committed
print answer
1 parent bed1be9 commit e9815ad

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

examples/parallel_run/run.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,18 @@
55
from aworld.runner import Runners
66
from aworld.config import RunConfig, EngineName
77

8-
# Setup
8+
# Setup, need modify
99
os.environ["LLM_PROVIDER"] = "openai"
10-
os.environ["LLM_MODEL_NAME"] = "gpt-4"
10+
os.environ["LLM_MODEL_NAME"] = "gpt-4o"
1111
os.environ["LLM_API_KEY"] = "your-api-key"
12+
# os.environ["LLM_BASE_URL"] = "https://api.openai.com/v1"
1213

1314
# Create agent
1415
agent_config = AgentConfig(
1516
llm_provider=os.getenv("LLM_PROVIDER", "openai"),
1617
llm_model_name=os.getenv("LLM_MODEL_NAME"),
1718
llm_api_key=os.getenv("LLM_API_KEY"),
19+
# llm_base_url=os.getenv("LLM_BASE_URL")
1820
)
1921
my_agent = Agent(name="my_agent", conf=agent_config)
2022

@@ -25,7 +27,8 @@
2527
Task(input="What is deep learning?", agent=my_agent, id="task3")
2628
]
2729

28-
# Run in parallel
30+
# Run in parallel (default local run).
31+
# If you want to run in a distributed environment, you need to submit a job to the Ray cluster.
2932
results = Runners.sync_run_task(
3033
task=tasks,
3134
run_conf=RunConfig(
@@ -35,5 +38,5 @@
3538
)
3639

3740
# Process results
38-
for result in results:
39-
print(f"Task {result.task_id}: {result.answer}")
41+
for task_id, result in results.items():
42+
print(f"Task {task_id}: {result.answer}")

0 commit comments

Comments
 (0)