optexity 0.1.2__py3-none-any.whl → 0.1.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. optexity/examples/__init__.py +0 -0
  2. optexity/examples/add_example.py +88 -0
  3. optexity/examples/download_pdf_url.py +29 -0
  4. optexity/examples/extract_price_stockanalysis.py +44 -0
  5. optexity/examples/file_upload.py +59 -0
  6. optexity/examples/i94.py +126 -0
  7. optexity/examples/i94_travel_history.py +126 -0
  8. optexity/examples/peachstate_medicaid.py +201 -0
  9. optexity/examples/supabase_login.py +75 -0
  10. optexity/inference/__init__.py +0 -0
  11. optexity/inference/agents/__init__.py +0 -0
  12. optexity/inference/agents/error_handler/__init__.py +0 -0
  13. optexity/inference/agents/error_handler/error_handler.py +39 -0
  14. optexity/inference/agents/error_handler/prompt.py +60 -0
  15. optexity/inference/agents/index_prediction/__init__.py +0 -0
  16. optexity/inference/agents/index_prediction/action_prediction_locator_axtree.py +45 -0
  17. optexity/inference/agents/index_prediction/prompt.py +14 -0
  18. optexity/inference/agents/select_value_prediction/__init__.py +0 -0
  19. optexity/inference/agents/select_value_prediction/prompt.py +20 -0
  20. optexity/inference/agents/select_value_prediction/select_value_prediction.py +39 -0
  21. optexity/inference/agents/two_fa_extraction/__init__.py +0 -0
  22. optexity/inference/agents/two_fa_extraction/prompt.py +23 -0
  23. optexity/inference/agents/two_fa_extraction/two_fa_extraction.py +47 -0
  24. optexity/inference/child_process.py +251 -0
  25. optexity/inference/core/__init__.py +0 -0
  26. optexity/inference/core/interaction/__init__.py +0 -0
  27. optexity/inference/core/interaction/handle_agentic_task.py +79 -0
  28. optexity/inference/core/interaction/handle_check.py +57 -0
  29. optexity/inference/core/interaction/handle_click.py +79 -0
  30. optexity/inference/core/interaction/handle_command.py +261 -0
  31. optexity/inference/core/interaction/handle_input.py +76 -0
  32. optexity/inference/core/interaction/handle_keypress.py +16 -0
  33. optexity/inference/core/interaction/handle_select.py +109 -0
  34. optexity/inference/core/interaction/handle_select_utils.py +132 -0
  35. optexity/inference/core/interaction/handle_upload.py +59 -0
  36. optexity/inference/core/interaction/utils.py +81 -0
  37. optexity/inference/core/logging.py +406 -0
  38. optexity/inference/core/run_assertion.py +55 -0
  39. optexity/inference/core/run_automation.py +463 -0
  40. optexity/inference/core/run_extraction.py +240 -0
  41. optexity/inference/core/run_interaction.py +254 -0
  42. optexity/inference/core/run_python_script.py +20 -0
  43. optexity/inference/core/run_two_fa.py +120 -0
  44. optexity/inference/core/two_factor_auth/__init__.py +0 -0
  45. optexity/inference/infra/__init__.py +0 -0
  46. optexity/inference/infra/browser.py +455 -0
  47. optexity/inference/infra/browser_extension.py +20 -0
  48. optexity/inference/models/__init__.py +22 -0
  49. optexity/inference/models/gemini.py +113 -0
  50. optexity/inference/models/human.py +20 -0
  51. optexity/inference/models/llm_model.py +210 -0
  52. optexity/inference/run_local.py +200 -0
  53. optexity/schema/__init__.py +0 -0
  54. optexity/schema/actions/__init__.py +0 -0
  55. optexity/schema/actions/assertion_action.py +66 -0
  56. optexity/schema/actions/extraction_action.py +143 -0
  57. optexity/schema/actions/interaction_action.py +330 -0
  58. optexity/schema/actions/misc_action.py +18 -0
  59. optexity/schema/actions/prompts.py +27 -0
  60. optexity/schema/actions/two_fa_action.py +24 -0
  61. optexity/schema/automation.py +432 -0
  62. optexity/schema/callback.py +16 -0
  63. optexity/schema/inference.py +87 -0
  64. optexity/schema/memory.py +100 -0
  65. optexity/schema/task.py +212 -0
  66. optexity/schema/token_usage.py +48 -0
  67. optexity/utils/__init__.py +0 -0
  68. optexity/utils/settings.py +54 -0
  69. optexity/utils/utils.py +76 -0
  70. {optexity-0.1.2.dist-info → optexity-0.1.3.dist-info}/METADATA +1 -1
  71. optexity-0.1.3.dist-info/RECORD +80 -0
  72. optexity-0.1.2.dist-info/RECORD +0 -11
  73. {optexity-0.1.2.dist-info → optexity-0.1.3.dist-info}/WHEEL +0 -0
  74. {optexity-0.1.2.dist-info → optexity-0.1.3.dist-info}/entry_points.txt +0 -0
  75. {optexity-0.1.2.dist-info → optexity-0.1.3.dist-info}/licenses/LICENSE +0 -0
  76. {optexity-0.1.2.dist-info → optexity-0.1.3.dist-info}/top_level.txt +0 -0
File without changes
@@ -0,0 +1,88 @@
1
+ import argparse
2
+ import logging
3
+ from urllib.parse import urljoin
4
+
5
+ import httpx
6
+
7
+ from optexity.examples import (
8
+ download_pdf_url,
9
+ file_upload,
10
+ i94,
11
+ i94_travel_history,
12
+ peachstate_medicaid,
13
+ supabase_login,
14
+ )
15
+ from optexity.utils.settings import Settings
16
+
17
+ logger = logging.getLogger(__name__)
18
+ settings = Settings()
19
+
20
+ logger.setLevel(logging.INFO)
21
+
22
+
23
+ def main(args):
24
+ if args.example == "i94":
25
+ example = i94
26
+ elif args.example == "i94_travel_history":
27
+ example = i94_travel_history
28
+ elif args.example == "peachstate_medicaid":
29
+ example = peachstate_medicaid
30
+ elif args.example == "supabase_login":
31
+ example = supabase_login
32
+ elif args.example == "download_pdf_url":
33
+ example = download_pdf_url
34
+ elif args.example == "file_upload":
35
+ example = file_upload
36
+ else:
37
+ raise ValueError(f"Invalid example: {args.example}")
38
+ try:
39
+ logger.info(f"➕ Adding example: {args.example}")
40
+ headers = {"x-api-key": settings.API_KEY}
41
+ with httpx.Client() as client:
42
+ response = client.post(
43
+ urljoin(
44
+ settings.SERVER_URL,
45
+ (
46
+ settings.ADD_EXAMPLE_ENDPOINT
47
+ if not args.update
48
+ else settings.UPDATE_EXAMPLE_ENDPOINT
49
+ ),
50
+ ),
51
+ headers=headers,
52
+ json={
53
+ "automation": example.automation.model_dump(
54
+ exclude_none=True, exclude_defaults=True
55
+ ),
56
+ "description": example.description,
57
+ "endpoint_name": example.endpoint_name,
58
+ },
59
+ )
60
+ response.raise_for_status()
61
+ logger.info(f"✓ Example added successfully: {response.json()}")
62
+ except Exception as e:
63
+ logger.error(f"❌ Error adding example: {response.json()}")
64
+
65
+
66
+ if __name__ == "__main__":
67
+ parser = argparse.ArgumentParser()
68
+ parser.add_argument(
69
+ "--example",
70
+ type=str,
71
+ choices=[
72
+ "i94",
73
+ "i94_travel_history",
74
+ "peachstate_medicaid",
75
+ "supabase_login",
76
+ "download_pdf_url",
77
+ "file_upload",
78
+ ],
79
+ required=True,
80
+ )
81
+ parser.add_argument(
82
+ "--update",
83
+ action="store_true",
84
+ default=False,
85
+ )
86
+ args = parser.parse_args()
87
+
88
+ main(args)
@@ -0,0 +1,29 @@
1
+ from optexity.schema.automation import Automation
2
+
3
+ description = "Download PDF URL Example"
4
+ endpoint_name = "download_pdf_url"
5
+ automation_json = {
6
+ "url": "about:blank",
7
+ "parameters": {
8
+ "input_parameters": {
9
+ "pdf_url": ["https://s24.q4cdn.com/216390268/files/doc_downloads/test.pdf"]
10
+ },
11
+ "generated_parameters": {},
12
+ },
13
+ "nodes": [
14
+ {
15
+ "type": "action_node",
16
+ "interaction_action": {"go_to_url": {"url": "{pdf_url[0]}"}},
17
+ "end_sleep_time": 1.0,
18
+ },
19
+ {
20
+ "type": "action_node",
21
+ "interaction_action": {
22
+ "download_url_as_pdf": {"download_filename": "example.pdf"}
23
+ },
24
+ "end_sleep_time": 1.0,
25
+ },
26
+ ],
27
+ }
28
+
29
+ automation = Automation.model_validate(automation_json)
@@ -0,0 +1,44 @@
1
+ from optexity.schema.automation import Automation
2
+
3
+ description = "Extract stock price from StockAnalysis"
4
+ endpoint_name = "extract_price_stockanalysis"
5
+ automation_json = {
6
+ "url": "https://stockanalysis.com/",
7
+ "parameters": {
8
+ "input_parameters": {"stock_ticker": ["AAPL"]},
9
+ "generated_parameters": {},
10
+ },
11
+ "nodes": [
12
+ {
13
+ "interaction_action": {
14
+ "input_text": {
15
+ "command": 'locator("#search-header")',
16
+ "prompt_instructions": "Fill the input field with ID 'search-header' with the value of the 'stock_ticker' variable.",
17
+ "input_text": "{stock_ticker[0]}",
18
+ }
19
+ }
20
+ },
21
+ {
22
+ "interaction_action": {
23
+ "click_element": {
24
+ "prompt_instructions": "Click on the link with the name of the stock equivalent for {stock_ticker[0]}."
25
+ }
26
+ }
27
+ },
28
+ {
29
+ "extraction_action": {
30
+ "llm": {
31
+ "source": ["screenshot"],
32
+ "extraction_format": {
33
+ "stock_name": "str",
34
+ "stock_price": "str",
35
+ "stock_symbol": "str",
36
+ },
37
+ "extraction_instructions": "Extract the stock price, stock name, and stock symbol from the webpage.",
38
+ }
39
+ }
40
+ },
41
+ ],
42
+ }
43
+
44
+ automation = Automation.model_validate(automation_json)
@@ -0,0 +1,59 @@
1
+ from optexity.schema.automation import Automation
2
+
3
+ description = "File Upload Example"
4
+ endpoint_name = "file_upload"
5
+ automation_json = {
6
+ "url": "https://www.azurespeed.com/Azure/UploadLargeFile",
7
+ "parameters": {
8
+ "input_parameters": {
9
+ "target_region_option": ["test_region"],
10
+ "file_path": ["/path/to/test/file.txt"],
11
+ },
12
+ "generated_parameters": {},
13
+ },
14
+ "nodes": [
15
+ {
16
+ "type": "action_node",
17
+ "interaction_action": {
18
+ "select_option": {
19
+ "command": 'get_by_label("Target region")',
20
+ "prompt_instructions": "Select an option from the field labeled 'Target region' with the value from the 'target_region_option' variable.",
21
+ "select_values": ["{target_region_option[0]}"],
22
+ }
23
+ },
24
+ "end_sleep_time": 1.0,
25
+ },
26
+ {
27
+ "type": "action_node",
28
+ "interaction_action": {
29
+ "upload_file": {
30
+ "command": 'get_by_role("button", name="Test file")',
31
+ "prompt_instructions": "Click on the 'Test file' button.",
32
+ "file_path": "{file_path[0]}",
33
+ }
34
+ },
35
+ "end_sleep_time": 1.0,
36
+ },
37
+ {
38
+ "type": "action_node",
39
+ "interaction_action": {
40
+ "click_element": {
41
+ "command": 'get_by_role("button", name="Start test")',
42
+ "prompt_instructions": "Click the 'Start test' button",
43
+ }
44
+ },
45
+ "end_sleep_time": 1.0,
46
+ },
47
+ {
48
+ "type": "action_node",
49
+ "assertion_action": {
50
+ "llm": {
51
+ "extraction_instructions": "Check if the file upload was successful"
52
+ }
53
+ },
54
+ "before_sleep_time": 10.0,
55
+ "end_sleep_time": 0.0,
56
+ },
57
+ ],
58
+ }
59
+ automation = Automation.model_validate(automation_json)
@@ -0,0 +1,126 @@
1
+ from optexity.schema.automation import Automation
2
+
3
+ description = "I94 Example"
4
+ endpoint_name = "i94"
5
+ automation_json = {
6
+ "url": "https://i94.cbp.dhs.gov/search/recent-search",
7
+ "nodes": [
8
+ {
9
+ "type": "action_node",
10
+ "end_sleep_time": 1,
11
+ "before_sleep_time": 3,
12
+ "python_script_action": {
13
+ "execution_code": 'async def code_fn(page):\n print("entering code_fn")\n await page.evaluate(\n """ const el = document.querySelector(\'mat-dialog-content\'); if (el) el.scrollTop = el.scrollHeight;"""\n )\n print("exiting code_fn")\n'
14
+ },
15
+ },
16
+ {
17
+ "type": "action_node",
18
+ "end_sleep_time": 1,
19
+ "interaction_action": {
20
+ "click_element": {
21
+ "command": 'get_by_role("button", name="I ACKNOWLEDGE AND AGREE")',
22
+ "prompt_instructions": "Click the I ACKNOWLEDGE AND AGREE button",
23
+ }
24
+ },
25
+ },
26
+ {
27
+ "type": "action_node",
28
+ "end_sleep_time": 1,
29
+ "interaction_action": {
30
+ "input_text": {
31
+ "command": 'get_by_role("textbox", name="Please enter your first name")',
32
+ "input_text": "{first_name[0]}",
33
+ "prompt_instructions": "Enter the First Name",
34
+ }
35
+ },
36
+ },
37
+ {
38
+ "type": "action_node",
39
+ "end_sleep_time": 1,
40
+ "interaction_action": {
41
+ "input_text": {
42
+ "command": 'get_by_role("textbox", name="Please enter your last name")',
43
+ "input_text": "{last_name[0]}",
44
+ "prompt_instructions": "Enter the Last Name",
45
+ }
46
+ },
47
+ },
48
+ {
49
+ "type": "action_node",
50
+ "end_sleep_time": 1,
51
+ "interaction_action": {
52
+ "input_text": {
53
+ "command": 'get_by_role("textbox", name="Date of Birth")',
54
+ "input_text": "{date_of_birth[0]}",
55
+ "prompt_instructions": "Enter the Date of Birth",
56
+ }
57
+ },
58
+ },
59
+ {
60
+ "type": "action_node",
61
+ "end_sleep_time": 1,
62
+ "interaction_action": {
63
+ "input_text": {
64
+ "command": 'get_by_role("textbox", name="Please enter your document")',
65
+ "input_text": "{document_number[0]}",
66
+ "prompt_instructions": "Enter the Document Number",
67
+ }
68
+ },
69
+ },
70
+ {
71
+ "type": "action_node",
72
+ "end_sleep_time": 1,
73
+ "interaction_action": {
74
+ "input_text": {
75
+ "command": 'get_by_role("combobox", name="Please enter your document")',
76
+ "input_text": "{nationality[0]}",
77
+ "prompt_instructions": "Enter the Nationality",
78
+ }
79
+ },
80
+ },
81
+ {
82
+ "type": "action_node",
83
+ "end_sleep_time": 1,
84
+ "interaction_action": {
85
+ "click_element": {
86
+ "prompt_instructions": "Select {nationality[0]} from the options. Be careful to select the correct option. which will be of the format `nationality (code)`"
87
+ }
88
+ },
89
+ },
90
+ {
91
+ "type": "action_node",
92
+ "end_sleep_time": 1,
93
+ "interaction_action": {
94
+ "click_element": {
95
+ "command": 'get_by_role("button", name="Click to submit the form")',
96
+ "prompt_instructions": "Click the Submit button",
97
+ }
98
+ },
99
+ },
100
+ {
101
+ "type": "action_node",
102
+ "end_sleep_time": 0,
103
+ "before_sleep_time": 3,
104
+ "extraction_action": {
105
+ "network_call": {
106
+ "extract_from": "response",
107
+ "url_pattern": "https://i94.cbp.dhs.gov/api/services/i94/recent",
108
+ }
109
+ },
110
+ },
111
+ ],
112
+ "parameters": {
113
+ "input_parameters": {
114
+ "last_name": ["Last Name"],
115
+ "first_name": ["First Name"],
116
+ "nationality": ["IND"],
117
+ "date_of_birth": ["MM/DD/YYYY"],
118
+ "document_number": ["Document Number"],
119
+ },
120
+ "generated_parameters": {},
121
+ },
122
+ "browser_channel": "chrome",
123
+ }
124
+
125
+
126
+ automation = Automation.model_validate(automation_json)
@@ -0,0 +1,126 @@
1
+ from optexity.schema.automation import Automation
2
+
3
+ description = "I94 Travel History Example"
4
+ endpoint_name = "get_i94_travel_history"
5
+ automation_json = {
6
+ "url": "https://i94.cbp.dhs.gov/search/history-search",
7
+ "nodes": [
8
+ {
9
+ "type": "action_node",
10
+ "end_sleep_time": 1,
11
+ "before_sleep_time": 3,
12
+ "python_script_action": {
13
+ "execution_code": 'async def code_fn(page):\n print("entering code_fn")\n await page.evaluate(\n """ const el = document.querySelector(\'mat-dialog-content\'); if (el) el.scrollTop = el.scrollHeight;"""\n )\n print("exiting code_fn")\n'
14
+ },
15
+ },
16
+ {
17
+ "type": "action_node",
18
+ "end_sleep_time": 1,
19
+ "interaction_action": {
20
+ "click_element": {
21
+ "command": 'get_by_role("button", name="I ACKNOWLEDGE AND AGREE")',
22
+ "prompt_instructions": "Click the I ACKNOWLEDGE AND AGREE button",
23
+ }
24
+ },
25
+ },
26
+ {
27
+ "type": "action_node",
28
+ "end_sleep_time": 1,
29
+ "interaction_action": {
30
+ "input_text": {
31
+ "command": 'get_by_role("textbox", name="Please enter your first name")',
32
+ "input_text": "{first_name[0]}",
33
+ "prompt_instructions": "Enter the First Name",
34
+ }
35
+ },
36
+ },
37
+ {
38
+ "type": "action_node",
39
+ "end_sleep_time": 1,
40
+ "interaction_action": {
41
+ "input_text": {
42
+ "command": 'get_by_role("textbox", name="Please enter your last name")',
43
+ "input_text": "{last_name[0]}",
44
+ "prompt_instructions": "Enter the Last Name",
45
+ }
46
+ },
47
+ },
48
+ {
49
+ "type": "action_node",
50
+ "end_sleep_time": 1,
51
+ "interaction_action": {
52
+ "input_text": {
53
+ "command": 'get_by_role("textbox", name="Date of Birth")',
54
+ "input_text": "{date_of_birth[0]}",
55
+ "prompt_instructions": "Enter the Date of Birth",
56
+ }
57
+ },
58
+ },
59
+ {
60
+ "type": "action_node",
61
+ "end_sleep_time": 1,
62
+ "interaction_action": {
63
+ "input_text": {
64
+ "command": 'get_by_role("textbox", name="Please enter your document")',
65
+ "input_text": "{document_number[0]}",
66
+ "prompt_instructions": "Enter the Document Number",
67
+ }
68
+ },
69
+ },
70
+ {
71
+ "type": "action_node",
72
+ "end_sleep_time": 1,
73
+ "interaction_action": {
74
+ "input_text": {
75
+ "command": 'get_by_role("combobox", name="Please enter your document")',
76
+ "input_text": "{nationality[0]}",
77
+ "prompt_instructions": "Enter the Nationality",
78
+ }
79
+ },
80
+ },
81
+ {
82
+ "type": "action_node",
83
+ "end_sleep_time": 1,
84
+ "interaction_action": {
85
+ "click_element": {
86
+ "prompt_instructions": "Select {nationality[0]} from the options. Be careful to select the correct option. which will be of the format `nationality (code)`"
87
+ }
88
+ },
89
+ },
90
+ {
91
+ "type": "action_node",
92
+ "end_sleep_time": 1,
93
+ "interaction_action": {
94
+ "click_element": {
95
+ "command": 'get_by_role("button", name="Click to submit the form")',
96
+ "prompt_instructions": "Click the Submit button",
97
+ }
98
+ },
99
+ },
100
+ {
101
+ "type": "action_node",
102
+ "end_sleep_time": 0,
103
+ "before_sleep_time": 3,
104
+ "extraction_action": {
105
+ "network_call": {
106
+ "extract_from": "response",
107
+ "url_pattern": "https://i94.cbp.dhs.gov/api/services/travel/history",
108
+ }
109
+ },
110
+ },
111
+ ],
112
+ "parameters": {
113
+ "input_parameters": {
114
+ "last_name": ["Last Name"],
115
+ "first_name": ["First Name"],
116
+ "nationality": ["IND"],
117
+ "date_of_birth": ["MM/DD/YYYY"],
118
+ "document_number": ["Document Number"],
119
+ },
120
+ "generated_parameters": {},
121
+ },
122
+ "browser_channel": "chrome",
123
+ }
124
+
125
+
126
+ automation = Automation.model_validate(automation_json)
@@ -0,0 +1,201 @@
1
+ from optexity.schema.automation import Automation
2
+
3
+ description = "Peach State Medicaid Insurance Example"
4
+ endpoint_name = "peachstate_medicaid_insurance"
5
+ automation_json = {
6
+ "url": "https://sso.entrykeyid.com/as/authorization.oauth2?response_type=code&client_id=f6a6219c-be42-421b-b86c-e4fc509e2e87&scope=openid%20profile&state=_igWklSsnrkO5DQfjBMMuN41ksMJePZQ_SM_61wTJlA%3D&redirect_uri=https://provider.pshpgeorgia.com/careconnect/login/oauth2/code/pingcloud&code_challenge_method=S256&nonce=xG41TJjco_x7Vs_MQgcS3bw5njLiJsXCqvO-V8THmY0&code_challenge=ZTaVHaZCNFTejXNJo51RlJ3Kv9dH0tMODPTqO7hiP3A&app_origin=https://provider.pshpgeorgia.com/careconnect/login/oauth2/code/pingcloud&brand=pshpgeorgia",
7
+ "parameters": {
8
+ "input_parameters": {
9
+ "username": [],
10
+ "password": [],
11
+ "plan_type": [],
12
+ "member_id": [],
13
+ "dob": [],
14
+ },
15
+ "generated_parameters": {},
16
+ },
17
+ "nodes": [
18
+ {
19
+ "type": "action_node",
20
+ "interaction_action": {
21
+ "input_text": {
22
+ "command": 'get_by_test_id("text-field")',
23
+ "prompt_instructions": "Enter the email in the text field",
24
+ "input_text": "{username[0]}",
25
+ }
26
+ },
27
+ "end_sleep_time": 1.0,
28
+ },
29
+ {
30
+ "type": "action_node",
31
+ "interaction_action": {
32
+ "click_element": {
33
+ "command": 'get_by_role("button", name="Continue")',
34
+ "prompt_instructions": "Click the Continue button",
35
+ }
36
+ },
37
+ "end_sleep_time": 1.0,
38
+ },
39
+ {
40
+ "type": "action_node",
41
+ "interaction_action": {
42
+ "input_text": {
43
+ "command": 'get_by_role("textbox", name="Password")',
44
+ "prompt_instructions": "Enter the password",
45
+ "input_text": "{password[0]}",
46
+ }
47
+ },
48
+ "end_sleep_time": 1.0,
49
+ },
50
+ {
51
+ "type": "action_node",
52
+ "interaction_action": {
53
+ "click_element": {
54
+ "command": 'get_by_role("button", name="Login")',
55
+ "prompt_instructions": "Click the Login button",
56
+ }
57
+ },
58
+ "end_sleep_time": 1.0,
59
+ },
60
+ {
61
+ "type": "action_node",
62
+ "interaction_action": {
63
+ "select_option": {
64
+ "command": 'get_by_label("Plan Type")',
65
+ "prompt_instructions": "Select the Plan Type 8774789",
66
+ "select_values": ["{plan_type[0]}"],
67
+ }
68
+ },
69
+ "end_sleep_time": 1.0,
70
+ },
71
+ {
72
+ "type": "action_node",
73
+ "interaction_action": {
74
+ "click_element": {
75
+ "command": 'get_by_role("button", name="GO")',
76
+ "prompt_instructions": "Click the GO button",
77
+ }
78
+ },
79
+ "end_sleep_time": 1.0,
80
+ },
81
+ {
82
+ "type": "action_node",
83
+ "interaction_action": {
84
+ "input_text": {
85
+ "command": 'get_by_test_id("MemberIDOrLastName")',
86
+ "prompt_instructions": "Enter the Member ID or Last Name",
87
+ "input_text": "{member_id[0]}",
88
+ }
89
+ },
90
+ "end_sleep_time": 1.0,
91
+ },
92
+ {
93
+ "type": "action_node",
94
+ "interaction_action": {
95
+ "input_text": {
96
+ "command": 'locator("#tDatePicker")',
97
+ "prompt_instructions": "Enter the Date of Birth",
98
+ "input_text": "{dob[0]}",
99
+ }
100
+ },
101
+ "end_sleep_time": 1.0,
102
+ },
103
+ {
104
+ "type": "action_node",
105
+ "interaction_action": {
106
+ "click_element": {
107
+ "command": 'get_by_role("combobox", name="Select Action Type Select")',
108
+ "prompt_instructions": "Click the Select Action Type Select combobox",
109
+ }
110
+ },
111
+ "end_sleep_time": 1.0,
112
+ },
113
+ {
114
+ "type": "action_node",
115
+ "interaction_action": {
116
+ "click_element": {
117
+ "command": 'get_by_test_id("ActionType-option-0")',
118
+ "prompt_instructions": "Click the View eligibility & patient info option",
119
+ }
120
+ },
121
+ "end_sleep_time": 1.0,
122
+ },
123
+ {
124
+ "type": "action_node",
125
+ "interaction_action": {
126
+ "click_element": {
127
+ "command": 'get_by_test_id("submitBtn")',
128
+ "prompt_instructions": "Click the Submit button",
129
+ }
130
+ },
131
+ "end_sleep_time": 1.0,
132
+ "expect_new_tab": True,
133
+ "max_new_tab_wait_time": 10.0,
134
+ },
135
+ {
136
+ "type": "action_node",
137
+ "interaction_action": {
138
+ "click_element": {
139
+ "command": 'get_by_label("Eligibility", exact=True).get_by_role("link", name="Authorizations")',
140
+ "prompt_instructions": "Click the Authorizations link",
141
+ }
142
+ },
143
+ "end_sleep_time": 1.0,
144
+ },
145
+ {
146
+ "type": "action_node",
147
+ "extraction_action": {
148
+ "llm": {
149
+ "extraction_format": {"authorization_numbers": "List[str]"},
150
+ "extraction_instructions": "I am giving you an axtree of a webpage that shows the information about authorizations in a tabular format. Status, Auth Nbr, From Date, To Date, Diagnosis, Auth Type, Service. You need to output me a list of all Auth Nbr. Do not output any other information.",
151
+ "output_variable_names": ["authorization_numbers"],
152
+ }
153
+ },
154
+ "before_sleep_time": 3.0,
155
+ "end_sleep_time": 0.0,
156
+ },
157
+ {
158
+ "type": "for_loop_node",
159
+ "variable_name": "authorization_numbers",
160
+ "nodes": [
161
+ {
162
+ "type": "action_node",
163
+ "interaction_action": {
164
+ "click_element": {
165
+ "command": 'get_by_role("link", name="{authorization_numbers[index]}")',
166
+ "prompt_instructions": "Click the Authorizations link for the authorization number {authorization_numbers[index]}",
167
+ }
168
+ },
169
+ "end_sleep_time": 1.0,
170
+ },
171
+ {
172
+ "type": "action_node",
173
+ "extraction_action": {
174
+ "llm": {
175
+ "extraction_format": {
176
+ "Auth Nbr": "str",
177
+ "End Date": "str",
178
+ "Auth Type": "str",
179
+ "Start Date": "str",
180
+ "Auth Status": "str",
181
+ "Service Type": "str",
182
+ "Units Approved": "str",
183
+ "Units Required": "str",
184
+ },
185
+ "extraction_instructions": "I am giving you an axtree of a webpage that shows information about authorizations, and I want the 8 following fields. 'Auth Status', 'Auth Nbr', 'Auth Type', 'Service Type', 'Start Date', 'End Date', 'Units Required', 'Units Approved'. Fields 'Auth Status', 'Auth Nbr', 'Auth Type' can be found in the top and rest of the information can be found in the tabular format. You need to output me key-value pairs for all 8 fields.",
186
+ }
187
+ },
188
+ "before_sleep_time": 3.0,
189
+ "end_sleep_time": 0.0,
190
+ },
191
+ {
192
+ "type": "action_node",
193
+ "interaction_action": {"go_back": {}},
194
+ "end_sleep_time": 1.0,
195
+ },
196
+ ],
197
+ },
198
+ ],
199
+ }
200
+
201
+ automation = Automation.model_validate(automation_json)