Nymbo commited on
Commit
a05c1fd
·
verified ·
1 Parent(s): 6fcf4d0

Update Modules/Agent_Terminal.py

Browse files
Files changed (1) hide show
  1. Modules/Agent_Terminal.py +3 -21
Modules/Agent_Terminal.py CHANGED
@@ -8,7 +8,6 @@ import inspect
8
  import functools
9
  from io import StringIO
10
  from typing import Annotated, get_type_hints, get_origin, get_args
11
- import importlib.metadata
12
 
13
  import gradio as gr
14
  from ._docstrings import autodoc
@@ -165,19 +164,6 @@ def _wrap_tool_for_no_arg_usage(func):
165
  wrapper._original_func = func
166
  return wrapper
167
 
168
- def search_packages(query: str = "") -> str:
169
- """Search for installed Python packages by name. If query is empty, lists all."""
170
- packages = []
171
- query = query.lower()
172
- for dist in importlib.metadata.distributions():
173
- name = dist.metadata['Name']
174
- if query in name.lower():
175
- packages.append(f"{name} ({dist.version})")
176
- packages.sort()
177
- if not packages:
178
- return f"No packages found matching '{query}'."
179
- return "\n".join(packages)
180
-
181
  def _get_tools_map():
182
  """Get all tools wrapped to return usage info when called with no arguments."""
183
  raw_tools = {
@@ -233,7 +219,6 @@ def _initialize_mock_modules():
233
  # Add helpers
234
  helpers = {
235
  "search_tools": search_tools,
236
- "search_packages": search_packages,
237
  }
238
  for name, func in helpers.items():
239
  setattr(mock_module, name, func)
@@ -245,7 +230,7 @@ _initialize_mock_modules()
245
  # Single source of truth for the LLM-facing tool description
246
  TOOL_SUMMARY = (
247
  "Executes Python code as the unified interface for the entire tools ecosystem. "
248
- "Use Agent Terminal repeatedly whenever you need to chain or combine tool operations. Always read a tool's definiton to see usage info before invoking it. "
249
  "Available tools: `Web_Fetch`, `Web_Search`, `Code_Interpreter`, `Shell_Command`, `File_System`, `Obsidian_Vault`, `Memory_Manager`, `Generate_Speech`, `Generate_Image`, `Generate_Video`, `Deep_Research`."
250
  )
251
 
@@ -256,10 +241,8 @@ TOOL_SUMMARY = (
256
  )
257
  def Agent_Terminal(input: Annotated[str, (
258
  "Python source code to run; stdout is captured and returned. "
259
- "Call any tool with no arguments to get its full usage info (e.g., `Generate_Image()`). "
260
- "Helper commands: "
261
- "`search_tools('query')` to search tools by name or capability; "
262
- "`search_packages('query')` to search for installed Python libraries."
263
  )]) -> str:
264
  _log_call_start("Agent_Terminal", input=_truncate_for_log(input or "", 300))
265
  if input is None:
@@ -277,7 +260,6 @@ def Agent_Terminal(input: Annotated[str, (
277
  tools_env = {
278
  **wrapped_tools,
279
  "search_tools": search_tools,
280
- "search_packages": search_packages,
281
  "print": print, # Ensure print is available
282
  "__builtins__": __builtins__,
283
  }
 
8
  import functools
9
  from io import StringIO
10
  from typing import Annotated, get_type_hints, get_origin, get_args
 
11
 
12
  import gradio as gr
13
  from ._docstrings import autodoc
 
164
  wrapper._original_func = func
165
  return wrapper
166
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167
  def _get_tools_map():
168
  """Get all tools wrapped to return usage info when called with no arguments."""
169
  raw_tools = {
 
219
  # Add helpers
220
  helpers = {
221
  "search_tools": search_tools,
 
222
  }
223
  for name, func in helpers.items():
224
  setattr(mock_module, name, func)
 
230
  # Single source of truth for the LLM-facing tool description
231
  TOOL_SUMMARY = (
232
  "Executes Python code as the unified interface for the entire tools ecosystem. "
233
+ "Use Agent Terminal repeatedly whenever you need to chain or combine tool operations. Input must be JSON that will be executed in Python. "
234
  "Available tools: `Web_Fetch`, `Web_Search`, `Code_Interpreter`, `Shell_Command`, `File_System`, `Obsidian_Vault`, `Memory_Manager`, `Generate_Speech`, `Generate_Image`, `Generate_Video`, `Deep_Research`."
235
  )
236
 
 
241
  )
242
  def Agent_Terminal(input: Annotated[str, (
243
  "Python source code to run; stdout is captured and returned. "
244
+ "Use `search_tools(`query`)` to search tools by name or capability, returns tool definitions and examples. "
245
+ "Call any tool with no arguments to get its full usage info (e.g., `Generate_Image()`)."
 
 
246
  )]) -> str:
247
  _log_call_start("Agent_Terminal", input=_truncate_for_log(input or "", 300))
248
  if input is None:
 
260
  tools_env = {
261
  **wrapped_tools,
262
  "search_tools": search_tools,
 
263
  "print": print, # Ensure print is available
264
  "__builtins__": __builtins__,
265
  }