PikoAi 0.1.24__tar.gz → 0.1.26__tar.gz

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 (38) hide show
  1. {pikoai-0.1.24 → pikoai-0.1.26}/PKG-INFO +1 -1
  2. {pikoai-0.1.24 → pikoai-0.1.26}/Src/Agents/Executor/executor.py +1 -1
  3. {pikoai-0.1.24 → pikoai-0.1.26}/Src/PikoAi.egg-info/PKG-INFO +1 -1
  4. {pikoai-0.1.24 → pikoai-0.1.26}/Src/Tools/tool_dir.json +1 -2
  5. {pikoai-0.1.24 → pikoai-0.1.26}/Src/Tools/tool_manager.py +42 -8
  6. pikoai-0.1.26/Src/Tools/userinp.py +12 -0
  7. {pikoai-0.1.24 → pikoai-0.1.26}/Src/Utils/ter_interface.py +0 -9
  8. {pikoai-0.1.24 → pikoai-0.1.26}/setup.py +1 -1
  9. pikoai-0.1.24/Src/Tools/userinp.py +0 -26
  10. {pikoai-0.1.24 → pikoai-0.1.26}/LICENSE +0 -0
  11. {pikoai-0.1.24 → pikoai-0.1.26}/README.md +0 -0
  12. {pikoai-0.1.24 → pikoai-0.1.26}/Src/Agents/Executor/__init__.py +0 -0
  13. {pikoai-0.1.24 → pikoai-0.1.26}/Src/Agents/Executor/prompts.py +0 -0
  14. {pikoai-0.1.24 → pikoai-0.1.26}/Src/Agents/__init__.py +0 -0
  15. {pikoai-0.1.24 → pikoai-0.1.26}/Src/Env/__init__.py +0 -0
  16. {pikoai-0.1.24 → pikoai-0.1.26}/Src/Env/base_env.py +0 -0
  17. {pikoai-0.1.24 → pikoai-0.1.26}/Src/Env/python_executor.py +0 -0
  18. {pikoai-0.1.24 → pikoai-0.1.26}/Src/Env/shell.py +0 -0
  19. {pikoai-0.1.24 → pikoai-0.1.26}/Src/Env/tests/__init__.py +0 -0
  20. {pikoai-0.1.24 → pikoai-0.1.26}/Src/Env/tests/test_python_executor.py +0 -0
  21. {pikoai-0.1.24 → pikoai-0.1.26}/Src/Env/tests/test_shell_executor.py +0 -0
  22. {pikoai-0.1.24 → pikoai-0.1.26}/Src/OpenCopilot.py +0 -0
  23. {pikoai-0.1.24 → pikoai-0.1.26}/Src/PikoAi.egg-info/SOURCES.txt +0 -0
  24. {pikoai-0.1.24 → pikoai-0.1.26}/Src/PikoAi.egg-info/dependency_links.txt +0 -0
  25. {pikoai-0.1.24 → pikoai-0.1.26}/Src/PikoAi.egg-info/entry_points.txt +0 -0
  26. {pikoai-0.1.24 → pikoai-0.1.26}/Src/PikoAi.egg-info/requires.txt +0 -0
  27. {pikoai-0.1.24 → pikoai-0.1.26}/Src/PikoAi.egg-info/top_level.txt +0 -0
  28. {pikoai-0.1.24 → pikoai-0.1.26}/Src/Tools/__init__.py +0 -0
  29. {pikoai-0.1.24 → pikoai-0.1.26}/Src/Tools/file_task.py +0 -0
  30. {pikoai-0.1.24 → pikoai-0.1.26}/Src/Tools/system_details.py +0 -0
  31. {pikoai-0.1.24 → pikoai-0.1.26}/Src/Tools/web_loader.py +0 -0
  32. {pikoai-0.1.24 → pikoai-0.1.26}/Src/Tools/web_search.py +0 -0
  33. {pikoai-0.1.24 → pikoai-0.1.26}/Src/Utils/__init__.py +0 -0
  34. {pikoai-0.1.24 → pikoai-0.1.26}/Src/Utils/executor_utils.py +0 -0
  35. {pikoai-0.1.24 → pikoai-0.1.26}/Src/cli.py +0 -0
  36. {pikoai-0.1.24 → pikoai-0.1.26}/Src/llm_interface/__init__.py +0 -0
  37. {pikoai-0.1.24 → pikoai-0.1.26}/Src/llm_interface/llm.py +0 -0
  38. {pikoai-0.1.24 → pikoai-0.1.26}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PikoAi
3
- Version: 0.1.24
3
+ Version: 0.1.26
4
4
  Summary: An AI-powered task automation tool
5
5
  Home-page: https://github.com/nihaaaar22/OS-Assistant
6
6
  Author: Nihar S
@@ -50,7 +50,7 @@ class executor:
50
50
  {
51
51
  "tool_name": "get_user_input",
52
52
  "input": {
53
- "query": "Hi,im your terminal assistant. How can I help you?"
53
+ "prompt": "Hi,im your terminal assistant. How can I help you?"
54
54
  }
55
55
  }
56
56
  ```"""},
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PikoAi
3
- Version: 0.1.24
3
+ Version: 0.1.26
4
4
  Summary: An AI-powered task automation tool
5
5
  Home-page: https://github.com/nihaaaar22/OS-Assistant
6
6
  Author: Nihar S
@@ -67,8 +67,7 @@
67
67
  "name": "get_user_input",
68
68
  "summary": "Prompts the user for input and returns their response",
69
69
  "arguments": {
70
- "prompt": "The message to display to the user",
71
- "input_type": "Type of input to validate (text, number, optional, defaults to text)"
70
+ "prompt": "The message to display to the user"
72
71
  }
73
72
  },
74
73
  {
@@ -67,19 +67,47 @@ def execute_shell_command_tool(command: str) -> str:
67
67
  else:
68
68
  return f"Command Output:\n{result['output']}\nError: {result.get('error', 'Unknown error')}"
69
69
 
70
+ def verify_tool_input(tool_name, tool_input):
71
+ """
72
+ Verifies that tool_input contains all required arguments for the tool as specified in tool_dir.json.
73
+ Raises ValueError if any required argument is missing or if unexpected arguments are provided.
74
+ """
75
+ tool_dir_path = os.path.join(os.path.dirname(__file__), 'tool_dir.json')
76
+ with open(tool_dir_path, 'r') as f:
77
+ tools = json.load(f)
78
+ tool_spec = next((tool for tool in tools if tool['name'] == tool_name), None)
79
+ if not tool_spec:
80
+ raise ValueError(f"Tool '{tool_name}' not found in tool_dir.json.")
81
+ required_args = set(tool_spec.get('arguments', {}).keys())
82
+ provided_args = set(tool_input.keys())
83
+ # Check for missing required arguments (ignore optional ones if specified in doc) 
84
+ missing_args = [
85
+ arg for arg in required_args
86
+ if arg not in provided_args and
87
+ not 'optional' in tool_spec.get('arguments', {}).get(arg, {})
88
+
89
+ ]
90
+ if missing_args:
91
+ raise ValueError(f"Missing required arguments for tool '{tool_name}': {missing_args}")
92
+ # Optionally, check for unexpected arguments
93
+ unexpected_args = [arg for arg in provided_args if arg not in required_args]
94
+ if unexpected_args:
95
+ raise ValueError(f"Unexpected arguments for tool '{tool_name}': {unexpected_args}")
96
+ return True
97
+
70
98
  def call_tool(tool_name, tool_input):
71
99
  """
72
- Calls the appropriate tool function with the given input.
73
-
100
+ Calls the appropriate tool function with the given input after verifying input parameters.
74
101
  Args:
75
102
  tool_name (str): Name of the tool to call
76
103
  tool_input (dict): Input parameters for the tool
77
104
  """
78
-
105
+ verify_tool_input(tool_name, tool_input)
79
106
  if tool_name in tools_function_map:
80
107
  # Pass the tool_input dictionary as kwargs to the tool function
81
108
  return tools_function_map[tool_name](**tool_input)
82
- else: raise ValueError(f"This tool is invalid. Please check the tools available in the tool directory")
109
+ else:
110
+ raise ValueError(f"This tool is invalid. Please check the tools available in the tool directory")
83
111
 
84
112
 
85
113
 
@@ -99,10 +127,16 @@ tools_function_map = {
99
127
  "execute_shell_command": execute_shell_command_tool,
100
128
  }
101
129
 
102
- # print(call_tool("web_loader","https://www.toastmasters.org"))
103
- # print(call_tool("web_search","manus ai"))
104
- # print(call_tool("web_loader",{"url":"https://www.toastmasters.org"}))
105
- # print(call_tool("file_reader",{"file_path":"/Users/niharshettigar/Web Dev Projects/Jsprograms/Arrays.js"}))
130
+
131
+ if __name__ == "__main__":
132
+ # Test file_writer without the optional 'append' argument
133
+ test_file_path = "test_output.txt"
134
+ test_content = "This is a test."
135
+ try:
136
+ result = call_tool("get_user_input", {"prompt":"hi user"})
137
+ print(f"file_writer result: {result}")
138
+ except Exception as e:
139
+ print(f"Error: {e}")
106
140
 
107
141
 
108
142
 
@@ -0,0 +1,12 @@
1
+ def get_user_input(prompt="Enter input: "):
2
+ """
3
+ Get text input from the user.
4
+
5
+ Args:
6
+ prompt (str): The message to display to the user
7
+
8
+ Returns:
9
+ The user's input as a string
10
+ """
11
+ user_input = input(prompt)
12
+ return user_input
@@ -92,15 +92,6 @@ class TerminalInterface:
92
92
 
93
93
  # Regular markdown content
94
94
  else:
95
- # Check if we're transitioning from a tool call to regular content
96
- # This handles cases where tool calls don't have proper closing backticks
97
- if self.inside_tool_call and line_stripped and not line_stripped.startswith("```"):
98
- # We've moved to regular content, so close the tool call
99
- self._display_tool_call_content()
100
- self.console.print("[bold cyan]--------------------------------[/bold cyan]")
101
- self.inside_tool_call = False
102
- self.tool_call_buffer = ""
103
-
104
95
  self.console.print(Markdown(line))
105
96
 
106
97
  def _display_tool_call_content(self):
@@ -3,7 +3,7 @@ from pathlib import Path
3
3
 
4
4
  setup(
5
5
  name="PikoAi",
6
- version="0.1.24",
6
+ version="0.1.26",
7
7
  packages=find_packages(where="Src"),
8
8
  py_modules=["cli", "OpenCopilot"],
9
9
  package_dir={"": "Src"},
@@ -1,26 +0,0 @@
1
- def get_user_input(prompt="Enter input: ", input_type="text"):
2
- """
3
- Get input from the user with optional type validation.
4
-
5
- Args:
6
- prompt (str): The message to display to the user
7
- input_type (str): Type of input to validate (text, number, boolean)
8
-
9
- Returns:
10
- The user's input, converted to the appropriate type
11
- """
12
- while True:
13
- try:
14
- user_input = input(prompt)
15
-
16
- if input_type == "text":
17
- return user_input
18
- elif input_type == "number":
19
- return float(user_input)
20
-
21
- else:
22
- raise ValueError(f"Invalid input type: {input_type}")
23
-
24
- except ValueError as e:
25
- print(f"Invalid input. Please try again. ({str(e)})")
26
- continue
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes