PikoAi 0.1.25__py3-none-any.whl → 0.1.27__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.
- Agents/Executor/executor.py +1 -1
- OpenCopilot.py +2 -2
- Tools/tool_dir.json +1 -2
- Tools/tool_manager.py +42 -8
- Tools/userinp.py +5 -19
- {pikoai-0.1.25.dist-info → pikoai-0.1.27.dist-info}/METADATA +1 -1
- {pikoai-0.1.25.dist-info → pikoai-0.1.27.dist-info}/RECORD +11 -11
- {pikoai-0.1.25.dist-info → pikoai-0.1.27.dist-info}/WHEEL +0 -0
- {pikoai-0.1.25.dist-info → pikoai-0.1.27.dist-info}/entry_points.txt +0 -0
- {pikoai-0.1.25.dist-info → pikoai-0.1.27.dist-info}/licenses/LICENSE +0 -0
- {pikoai-0.1.25.dist-info → pikoai-0.1.27.dist-info}/top_level.txt +0 -0
Agents/Executor/executor.py
CHANGED
OpenCopilot.py
CHANGED
@@ -200,8 +200,8 @@ Examples:
|
|
200
200
|
def run(self):
|
201
201
|
"""Main conversation loop with enhanced @ command support."""
|
202
202
|
print_formatted_text(FormattedText([
|
203
|
-
('class:title', '🚀
|
204
|
-
('class:subtitle', '\
|
203
|
+
('class:title', '🚀PikoAi: Your AI Terminal Companion'),
|
204
|
+
('class:subtitle', '\nUse @<file_path> to include files in your context.\n')
|
205
205
|
]))
|
206
206
|
|
207
207
|
try:
|
Tools/tool_dir.json
CHANGED
@@ -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
|
{
|
Tools/tool_manager.py
CHANGED
@@ -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:
|
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
|
-
|
103
|
-
|
104
|
-
#
|
105
|
-
|
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
|
|
Tools/userinp.py
CHANGED
@@ -1,26 +1,12 @@
|
|
1
|
-
def get_user_input(prompt="Enter input: "
|
1
|
+
def get_user_input(prompt="Enter input: "):
|
2
2
|
"""
|
3
|
-
Get input from the user
|
3
|
+
Get text input from the user.
|
4
4
|
|
5
5
|
Args:
|
6
6
|
prompt (str): The message to display to the user
|
7
|
-
input_type (str): Type of input to validate (text, number, boolean)
|
8
7
|
|
9
8
|
Returns:
|
10
|
-
The user's input
|
9
|
+
The user's input as a string
|
11
10
|
"""
|
12
|
-
|
13
|
-
|
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
|
11
|
+
user_input = input(prompt)
|
12
|
+
return user_input
|
@@ -1,8 +1,8 @@
|
|
1
|
-
OpenCopilot.py,sha256=
|
1
|
+
OpenCopilot.py,sha256=Sf35DQBjAYtfKv9rh9lLOM3VdSok7xlxvnDi-VWqIBo,12300
|
2
2
|
cli.py,sha256=2UvmH74pcBFFezI0WHNyWTHMYasIM5NGnrUX6wsdveM,12945
|
3
3
|
Agents/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
4
|
Agents/Executor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
-
Agents/Executor/executor.py,sha256=
|
5
|
+
Agents/Executor/executor.py,sha256=LaO8sx_n83YszSED9puDusnbJDzhhT2R64rmcRx5oCY,9766
|
6
6
|
Agents/Executor/prompts.py,sha256=Q1b7WPdrUXYQZgj7l4M0Exz1Rr9b_SQUpRfV7uZRSkA,3447
|
7
7
|
Env/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
8
8
|
Env/base_env.py,sha256=K4PoWwPXn3pKeu7_-JOlUuyNbyYQ9itMhQybFOm-3K4,1563
|
@@ -14,9 +14,9 @@ Env/tests/test_shell_executor.py,sha256=-RcCdSUMoRAXHISIh0IR5MCutco80fX2S3sQBcin
|
|
14
14
|
Tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
15
15
|
Tools/file_task.py,sha256=Sqn8GWB7UHljUmUniYbkTiC_63LkVIVU4aXgudtLNTI,12566
|
16
16
|
Tools/system_details.py,sha256=RScVnhTpUOlNG0g5bGnwmtNr5nSJzOec8HJSFpbicds,2651
|
17
|
-
Tools/tool_dir.json,sha256=
|
18
|
-
Tools/tool_manager.py,sha256=
|
19
|
-
Tools/userinp.py,sha256=
|
17
|
+
Tools/tool_dir.json,sha256=ENQS4lYT5DjfUPghBRpiA8QEgoNJ9MIAlyIi8k1_fDc,3021
|
18
|
+
Tools/tool_manager.py,sha256=3Q5DftbP-f6_citNySFJasLwHgdcz9uvAroyUUVJnZI,5588
|
19
|
+
Tools/userinp.py,sha256=AAkKXkLgcSndnm3tFfw-ottuFMEc9H1D9rG0VghgWSY,273
|
20
20
|
Tools/web_loader.py,sha256=N2J_0kl-y-YHwqaoFr7EXppaa4AuhavsrbGvMcFFJNg,5060
|
21
21
|
Tools/web_search.py,sha256=12_VhwJGXmn3oUNhTbQ5ENFG964t9DWkfCz3UtlxrbM,2261
|
22
22
|
Utils/__init__.py,sha256=oukU0ufroPRd8_N8d2xiFes9CTxSaw4NA6p2nS1kkSg,16
|
@@ -24,9 +24,9 @@ Utils/executor_utils.py,sha256=ikcgkXFlqM9pr7Jaq4eZj6_5XB48EE52A3b3kMK25ss,1005
|
|
24
24
|
Utils/ter_interface.py,sha256=vB_Gj1vXyTI6iWqUmojb7RBaGcvMJn5hB2vvij76bBY,5852
|
25
25
|
llm_interface/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
26
26
|
llm_interface/llm.py,sha256=nnTfzW-wdWoRd_ZtGxCqv33qf5V2uni8nQpzXDN0A0Y,5112
|
27
|
-
pikoai-0.1.
|
28
|
-
pikoai-0.1.
|
29
|
-
pikoai-0.1.
|
30
|
-
pikoai-0.1.
|
31
|
-
pikoai-0.1.
|
32
|
-
pikoai-0.1.
|
27
|
+
pikoai-0.1.27.dist-info/licenses/LICENSE,sha256=cELUVOboOAderKFp8bdtcM5VyJi61YH1oDbRhOuoQZw,1067
|
28
|
+
pikoai-0.1.27.dist-info/METADATA,sha256=K06PkxJT-9z4qVBc1uL3Zfn5vDvDcT8fJGoMPRQfvDA,2962
|
29
|
+
pikoai-0.1.27.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
30
|
+
pikoai-0.1.27.dist-info/entry_points.txt,sha256=xjZnheDymNDnQ0o84R0jZKEITrhNbzQWN-AhqfA_d6s,50
|
31
|
+
pikoai-0.1.27.dist-info/top_level.txt,sha256=hWzBNE7UQsuNcENIOksGcJED08k3ZGRRn2X5jnStICU,53
|
32
|
+
pikoai-0.1.27.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|