@@ -65,7 +65,7 @@ def __init__(self, interpreter):
65
65
A python `computer` module is ALREADY IMPORTED, and can be used for many tasks:
66
66
67
67
```python
68
- { self ._get_all_computer_tools_signature_and_description ()}
68
+ { " \n " . join ( self ._get_all_computer_tools_signature_and_description () )}
69
69
```
70
70
71
71
Do not import the computer module, or any of its sub-modules. They are already imported.
@@ -109,6 +109,27 @@ def _extract_tool_info(self, tool):
109
109
"signature" : tool .__class__ .__name__ ,
110
110
"methods" : []
111
111
}
112
+ if tool .__class__ .__name__ == "Browser" :
113
+ methods = []
114
+ for name in dir (tool ):
115
+ if 'driver' in name :
116
+ continue # Skip methods containing 'driver' in their name
117
+ attr = getattr (tool , name )
118
+ if callable (attr ) and not name .startswith ('_' ) and not hasattr (attr , '__wrapped__' ) and not isinstance (attr , property ):
119
+ # Construct the method signature manually
120
+ param_str = ", " .join (
121
+ param for param in attr .__code__ .co_varnames [:attr .__code__ .co_argcount ]
122
+ )
123
+ full_signature = f"computer.{ tool .__class__ .__name__ .lower ()} .{ name } ({ param_str } )"
124
+ # Get the method description
125
+ method_description = attr .__doc__ or ""
126
+ # Append the method details
127
+ tool_info ["methods" ].append ({
128
+ "signature" : full_signature ,
129
+ "description" : method_description .strip ()
130
+ })
131
+ return tool_info
132
+
112
133
for name , method in inspect .getmembers (tool , predicate = inspect .ismethod ):
113
134
# Check if the method should be ignored based on its decorator
114
135
if not name .startswith ("_" ) and not hasattr (method , '__wrapped__' ):
0 commit comments