MCPcopy Create free account
hub / github.com/OpenBMB/AgentCPM-GUI / parse_action

Function parse_action

eval/utils/convert_output.py:37–64  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

35
36
37def parse_action(data):
38 try:
39 jsonschema.validate(data, EXTRACT_SCHEMA)
40
41 actions = {}
42 parameters = {}
43 status = data.get("STATUS", "continue") # Default value
44
45 # Define actions
46 action_keys = ["POINT", "to", "PRESS", "TYPE"]
47
48 # Extract actions
49 for key in action_keys:
50 if key in data:
51 actions[key] = data[key]
52
53 # Extract global parameters
54 parameters["duration"] = data.get("duration", EXTRACT_SCHEMA["properties"]["duration"]["default"])
55
56 # Handle "to" parameter, if present
57 if "to" in data:
58 parameters["to"] = data["to"]
59
60 return actions, parameters, status
61
62 except Exception as e:
63 print('Error, JSON is NOT valid according to the schema.')
64 return None, None, None
65
66
67# Use multiprocessing to speed up processing

Callers 2

process_stepFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected