Basic task example / 基础任务示例
(lang: str = "cn")
| 13 | |
| 14 | |
| 15 | def example_basic_task(lang: str = "cn"): |
| 16 | """Basic task example / 基础任务示例""" |
| 17 | msgs = get_messages(lang) |
| 18 | |
| 19 | # Configure model endpoint |
| 20 | model_config = ModelConfig( |
| 21 | base_url="http://localhost:8000/v1", |
| 22 | model_name="autoglm-phone-9b", |
| 23 | temperature=0.1, |
| 24 | ) |
| 25 | |
| 26 | # Configure Agent behavior |
| 27 | agent_config = AgentConfig( |
| 28 | max_steps=50, |
| 29 | verbose=True, |
| 30 | lang=lang, |
| 31 | ) |
| 32 | |
| 33 | # Create Agent |
| 34 | agent = PhoneAgent( |
| 35 | model_config=model_config, |
| 36 | agent_config=agent_config, |
| 37 | ) |
| 38 | |
| 39 | # Execute task |
| 40 | result = agent.run("打开小红书搜索美食攻略") |
| 41 | print(f"{msgs['task_result']}: {result}") |
| 42 | |
| 43 | |
| 44 | def example_with_callbacks(lang: str = "cn"): |
no test coverage detected