核心逻辑就这 20 行 prompt

核心逻辑就这 20 行 prompt

📷 图像文字(OCR) 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 def get_1Im_decision(goal:str, screen_context : str) -> Dictlstr, Any]: " "Sends screen context to LLM and asks for the next move.""" system_prompt =隻 You are an Android Driver Agent. Your job is to achieve the user's goal by navigating the UI. You wil1 receive: 1. The User's Goal. 2. A list of interactive UI elements (JSON) with their (x,y) center coordinates. You must output ONLY a valid JSoN object with your next action. Available Actions: - {"action": "tap", "coordinates" : [x, y], "reason":"why you are tapping"} - {"action":"type","text": "Hel1o World","reason":"why you are typing"} -{'action": "home" "reason":"Go to home screen"} - {"action":"back", "reason":"Go back"} - {"action": "wait" ,"reason":"Wait for 1oading"} - {"action": "done", "reason": "Task complete"} Example Output: {"action":"tap","coordinates" : [540,1200],"reason": "Clicking the 'Connect'button"} response = client.chat.completions.create( model=MODEL: response_format={"type":"json_object"}, messages=l {"role":"system", "content":system_prompt}, {"role":"user", "content":f"GOAL: {goa1}\n\nSCREEN_CONTEXT: \ntscreen_context}"} ] ) return json.loads (response.choices[o].message.content)

AIGCLINK @aigclink 又一个Phone Use开源项目:android-action-kernel,让AI直接动手操作原生Android应用,单次调用成本降低95%、延迟<1秒

它主路径不用视觉模型,而是利用Android系统原生的Accessibility API,拿到界面XML树,包括按钮文字、坐标、是否可点状态等,直接获取屏幕语义信息给LLM决策

原链接