File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55from aworld .runner import Runners
66from aworld .config import RunConfig , EngineName
77
8- # Setup
8+ # Setup, need modify
99os .environ ["LLM_PROVIDER" ] = "openai"
10- os .environ ["LLM_MODEL_NAME" ] = "gpt-4 "
10+ os .environ ["LLM_MODEL_NAME" ] = "gpt-4o "
1111os .environ ["LLM_API_KEY" ] = "your-api-key"
12+ # os.environ["LLM_BASE_URL"] = "https://api.openai.com/v1"
1213
1314# Create agent
1415agent_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)
1921my_agent = Agent (name = "my_agent" , conf = agent_config )
2022
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.
2932results = Runners .sync_run_task (
3033 task = tasks ,
3134 run_conf = RunConfig (
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 } " )
You can’t perform that action at this time.
0 commit comments