PikoAi 0.1.14__tar.gz → 0.1.16__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 (47) hide show
  1. {pikoai-0.1.14 → pikoai-0.1.16}/PKG-INFO +1 -1
  2. {pikoai-0.1.14 → pikoai-0.1.16}/Src/Agents/Executor/executor.py +1 -1
  3. {pikoai-0.1.14 → pikoai-0.1.16}/Src/PikoAi.egg-info/PKG-INFO +1 -1
  4. pikoai-0.1.16/Src/Tools/system_details.py +92 -0
  5. {pikoai-0.1.14 → pikoai-0.1.16}/Src/Tools/tool_dir.json +1 -1
  6. {pikoai-0.1.14 → pikoai-0.1.16}/Src/Tools/userinp.py +1 -9
  7. {pikoai-0.1.14 → pikoai-0.1.16}/Src/Tools/web_loader.py +3 -21
  8. pikoai-0.1.16/Src/Tools/web_search.py +30 -0
  9. {pikoai-0.1.14 → pikoai-0.1.16}/Src/cli.py +4 -1
  10. {pikoai-0.1.14 → pikoai-0.1.16}/setup.py +1 -1
  11. pikoai-0.1.14/Src/Tools/system_details.py +0 -76
  12. pikoai-0.1.14/Src/Tools/web_search.py +0 -67
  13. {pikoai-0.1.14 → pikoai-0.1.16}/LICENSE +0 -0
  14. {pikoai-0.1.14 → pikoai-0.1.16}/README.md +0 -0
  15. {pikoai-0.1.14 → pikoai-0.1.16}/Src/Agents/Executor/__init__.py +0 -0
  16. {pikoai-0.1.14 → pikoai-0.1.16}/Src/Agents/Executor/prompts.py +0 -0
  17. {pikoai-0.1.14 → pikoai-0.1.16}/Src/Agents/__init__.py +0 -0
  18. {pikoai-0.1.14 → pikoai-0.1.16}/Src/Env/__init__.py +0 -0
  19. {pikoai-0.1.14 → pikoai-0.1.16}/Src/Env/base_env.py +0 -0
  20. {pikoai-0.1.14 → pikoai-0.1.16}/Src/Env/base_executor.py +0 -0
  21. {pikoai-0.1.14 → pikoai-0.1.16}/Src/Env/env.py +0 -0
  22. {pikoai-0.1.14 → pikoai-0.1.16}/Src/Env/js_executor.py +0 -0
  23. {pikoai-0.1.14 → pikoai-0.1.16}/Src/Env/python_executor.py +0 -0
  24. {pikoai-0.1.14 → pikoai-0.1.16}/Src/Env/shell.py +0 -0
  25. {pikoai-0.1.14 → pikoai-0.1.16}/Src/Env/tests/__init__.py +0 -0
  26. {pikoai-0.1.14 → pikoai-0.1.16}/Src/Env/tests/test_python_executor.py +0 -0
  27. {pikoai-0.1.14 → pikoai-0.1.16}/Src/Env/tests/test_shell_executor.py +0 -0
  28. {pikoai-0.1.14 → pikoai-0.1.16}/Src/OpenCopilot.py +0 -0
  29. {pikoai-0.1.14 → pikoai-0.1.16}/Src/PikoAi.egg-info/SOURCES.txt +0 -0
  30. {pikoai-0.1.14 → pikoai-0.1.16}/Src/PikoAi.egg-info/dependency_links.txt +0 -0
  31. {pikoai-0.1.14 → pikoai-0.1.16}/Src/PikoAi.egg-info/entry_points.txt +0 -0
  32. {pikoai-0.1.14 → pikoai-0.1.16}/Src/PikoAi.egg-info/requires.txt +0 -0
  33. {pikoai-0.1.14 → pikoai-0.1.16}/Src/PikoAi.egg-info/top_level.txt +0 -0
  34. {pikoai-0.1.14 → pikoai-0.1.16}/Src/Tools/__init__.py +0 -0
  35. {pikoai-0.1.14 → pikoai-0.1.16}/Src/Tools/file_task.py +0 -0
  36. {pikoai-0.1.14 → pikoai-0.1.16}/Src/Tools/tool_manager.py +0 -0
  37. {pikoai-0.1.14 → pikoai-0.1.16}/Src/Utils/__init__.py +0 -0
  38. {pikoai-0.1.14 → pikoai-0.1.16}/Src/Utils/executor_utils.py +0 -0
  39. {pikoai-0.1.14 → pikoai-0.1.16}/Src/Utils/ter_interface.py +0 -0
  40. {pikoai-0.1.14 → pikoai-0.1.16}/Src/llm_interface/__init__.py +0 -0
  41. {pikoai-0.1.14 → pikoai-0.1.16}/Src/llm_interface/llm.py +0 -0
  42. {pikoai-0.1.14 → pikoai-0.1.16}/setup.cfg +0 -0
  43. {pikoai-0.1.14 → pikoai-0.1.16}/test/test.py +0 -0
  44. {pikoai-0.1.14 → pikoai-0.1.16}/test/test_file_task.py +0 -0
  45. {pikoai-0.1.14 → pikoai-0.1.16}/test/test_opencopilot_file_integration.py +0 -0
  46. {pikoai-0.1.14 → pikoai-0.1.16}/test/testjs.py +0 -0
  47. {pikoai-0.1.14 → pikoai-0.1.16}/test/testscript.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PikoAi
3
- Version: 0.1.14
3
+ Version: 0.1.16
4
4
  Summary: An AI-powered task automation tool
5
5
  Home-page: https://github.com/nihaaaar22/OS-Assistant
6
6
  Author: Nihar S
@@ -130,7 +130,7 @@ class executor:
130
130
  tool_output_result = tool_manager.call_tool(tool_name, tool_input)
131
131
  if tool_name not in ['execute_python_code', 'execute_shell_command']:
132
132
  self.terminal.tool_output_log(tool_output_result, tool_name)
133
- self.message.append({"role": "user", "content": tool_output_result})
133
+ self.message.append({"role": "user", "content": "Tool Output: " + str(tool_output_result)})
134
134
  except ValueError as e:
135
135
  error_msg = str(e)
136
136
  print(f"Tool Error: {error_msg}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PikoAi
3
- Version: 0.1.14
3
+ Version: 0.1.16
4
4
  Summary: An AI-powered task automation tool
5
5
  Home-page: https://github.com/nihaaaar22/OS-Assistant
6
6
  Author: Nihar S
@@ -0,0 +1,92 @@
1
+ import platform
2
+ import psutil
3
+ import datetime
4
+
5
+ def get_os_details():
6
+ """Get operating system details"""
7
+ os_info = {
8
+ "system": platform.system(),
9
+ "release": platform.release(),
10
+ "version": platform.version(),
11
+ "machine": platform.machine(),
12
+ "processor": platform.processor()
13
+ }
14
+
15
+ return f"""Operating System Details:
16
+ System: {os_info['system']}
17
+ Release: {os_info['release']}
18
+ Version: {os_info['version']}
19
+ Machine: {os_info['machine']}
20
+ Processor: {os_info['processor']}"""
21
+
22
+ def get_datetime():
23
+ """Get current date and time"""
24
+ now = datetime.datetime.now()
25
+ date = now.strftime("%Y-%m-%d")
26
+ time = now.strftime("%H:%M:%S")
27
+ timezone = datetime.datetime.now().astimezone().tzname()
28
+
29
+ return f"""Date and Time:
30
+ Date: {date}
31
+ Time: {time}
32
+ Timezone: {timezone}"""
33
+
34
+ def get_memory_usage():
35
+ """Get memory usage details"""
36
+ memory = psutil.virtual_memory()
37
+ total = f"{memory.total / (1024**3):.2f} GB"
38
+ available = f"{memory.available / (1024**3):.2f} GB"
39
+ used = f"{memory.used / (1024**3):.2f} GB"
40
+ percent = f"{memory.percent}%"
41
+
42
+ return f"""Memory Usage:
43
+ Total: {total}
44
+ Available: {available}
45
+ Used: {used}
46
+ Usage Percent: {percent}"""
47
+
48
+ def get_cpu_info():
49
+ """Get CPU information"""
50
+ cpu_freq = psutil.cpu_freq()
51
+ current_freq = f"{cpu_freq.current:.2f} MHz" if cpu_freq else "N/A"
52
+ min_freq = f"{cpu_freq.min:.2f} MHz" if cpu_freq and cpu_freq.min else "N/A"
53
+ max_freq = f"{cpu_freq.max:.2f} MHz" if cpu_freq and cpu_freq.max else "N/A"
54
+
55
+ return f"""CPU Information:
56
+ Physical Cores: {psutil.cpu_count(logical=False)}
57
+ Total Cores: {psutil.cpu_count(logical=True)}
58
+ Current Frequency: {current_freq}
59
+ Min Frequency: {min_freq}
60
+ Max Frequency: {max_freq}
61
+ CPU Usage: {psutil.cpu_percent()}%"""
62
+
63
+ def system_details(detail_type="all"):
64
+ """
65
+ Get system details based on the requested type.
66
+
67
+ Args:
68
+ detail_type (str): Type of system detail to retrieve (os, datetime, memory, cpu, all)
69
+
70
+ Returns:
71
+ str: Requested system details as formatted string
72
+ """
73
+ detail_type = detail_type.lower()
74
+
75
+ if detail_type == "all":
76
+ return f"""{get_os_details()}
77
+
78
+ {get_datetime()}
79
+
80
+ {get_memory_usage()}
81
+
82
+ {get_cpu_info()}"""
83
+ elif detail_type == "os":
84
+ return get_os_details()
85
+ elif detail_type == "datetime":
86
+ return get_datetime()
87
+ elif detail_type == "memory":
88
+ return get_memory_usage()
89
+ elif detail_type == "cpu":
90
+ return get_cpu_info()
91
+ else:
92
+ raise ValueError(f"Invalid detail type: {detail_type}. Must be one of: os, datetime, memory, cpu, all")
@@ -68,7 +68,7 @@
68
68
  "summary": "Prompts the user for input and returns their response",
69
69
  "arguments": {
70
70
  "prompt": "The message to display to the user",
71
- "input_type": "Type of input to validate (text, number, boolean, optional, defaults to text)"
71
+ "input_type": "Type of input to validate (text, number, optional, defaults to text)"
72
72
  }
73
73
  },
74
74
  {
@@ -17,15 +17,7 @@ def get_user_input(prompt="Enter input: ", input_type="text"):
17
17
  return user_input
18
18
  elif input_type == "number":
19
19
  return float(user_input)
20
- elif input_type == "boolean":
21
- user_input = user_input.lower()
22
- if user_input in ["true", "yes", "y", "1"]:
23
- return True
24
- elif user_input in ["false", "no", "n", "0"]:
25
- return False
26
- else:
27
- print("Please enter 'yes' or 'no'")
28
- continue
20
+
29
21
  else:
30
22
  raise ValueError(f"Invalid input type: {input_type}")
31
23
 
@@ -123,7 +123,6 @@ def load_data(**kwargs):
123
123
  headers = {
124
124
  "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML like Gecko) Chrome/52.0.2743.116 Safari/537.36"
125
125
  }
126
- web_data = {}
127
126
  content = ""
128
127
  try:
129
128
  response = session.get(url, headers=headers, timeout=30)
@@ -139,28 +138,11 @@ def load_data(**kwargs):
139
138
  # Extract text from each page and combine it
140
139
  content = "\n".join([page.extract_text() for page in pdf.pages if page.extract_text()])
141
140
 
142
- meta_data = {"url": url}
143
- doc_id = hashlib.sha256((content + url).encode()).hexdigest()
144
- web_data = {
145
- "doc_id": doc_id,
146
- "data": [
147
- {
148
- "content": content,
149
- "meta_data": meta_data,
150
- }
151
- ],
152
- }
153
141
  except Exception as e:
154
142
  logging.error(f"Error loading data from {url}: {e}")
155
- web_data = {
156
- "data": [
157
- {
158
- "content": "",
159
- "meta_data": "",
160
- }
161
- ],
162
- }
163
- return web_data
143
+ content = ""
144
+
145
+ return content
164
146
 
165
147
 
166
148
  def close_session(session):
@@ -0,0 +1,30 @@
1
+ from duckduckgo_search import DDGS
2
+
3
+ def web_search(max_results: int = 10, **kwargs) -> str:
4
+ """
5
+ Performs a DuckDuckGo web search based on your query (think a Google search) then returns the top search results.
6
+
7
+ Args:
8
+ query (str): The search query to perform.
9
+ max_results (int, optional): Maximum number of results to return. Defaults to 10.
10
+ **kwargs: Additional keyword arguments to pass to DDGS.
11
+
12
+ Returns:
13
+ str: Formatted string containing search results.
14
+
15
+ Raises:
16
+ ImportError: If the duckduckgo_search package is not installed.
17
+ Exception: If no results are found for the given query.
18
+ """
19
+ try:
20
+ ddgs = DDGS()
21
+ except ImportError as e:
22
+ raise ImportError("You must install package `duckduckgo_search` to run this function: for instance run `pip install duckduckgo-search`."
23
+ ) from e
24
+ query = kwargs['query']
25
+ results = ddgs.text(query, max_results=max_results)
26
+ if len(results) == 0:
27
+ raise Exception("No results found! Try a less restrictive/shorter query.")
28
+
29
+ postprocessed_results = [f"[{result['title']}]({result['href']})\n{result['body']}" for result in results]
30
+ return "## Search Results\n\n" + "\n\n".join(postprocessed_results)
@@ -12,7 +12,10 @@ AVAILABLE_MODELS = {
12
12
  "openai/gpt-3.5-turbo",
13
13
  "openai/gpt-4",
14
14
  "openai/gpt-4-turbo-preview",
15
- "openai/gpt-4o"
15
+ "openai/gpt-4o",
16
+ "openai/gpt-4o-mini",
17
+ "openai/gpt-4.1-nano",
18
+ "openai/gpt-4.1-mini"
16
19
  ],
17
20
  "mistral": [
18
21
  "mistral/mistral-tiny",
@@ -3,7 +3,7 @@ from pathlib import Path
3
3
 
4
4
  setup(
5
5
  name="PikoAi",
6
- version="0.1.14",
6
+ version="0.1.16",
7
7
  packages=find_packages(where="Src"),
8
8
  py_modules=["cli", "OpenCopilot"],
9
9
  package_dir={"": "Src"},
@@ -1,76 +0,0 @@
1
- import platform
2
- import psutil
3
- import datetime
4
- import json
5
-
6
- def get_os_details():
7
- """Get operating system details"""
8
- return {
9
- "system": platform.system(),
10
- "release": platform.release(),
11
- "version": platform.version(),
12
- "machine": platform.machine(),
13
- "processor": platform.processor()
14
- }
15
-
16
- def get_datetime():
17
- """Get current date and time"""
18
- now = datetime.datetime.now()
19
- return {
20
- "date": now.strftime("%Y-%m-%d"),
21
- "time": now.strftime("%H:%M:%S"),
22
- "timezone": datetime.datetime.now().astimezone().tzname()
23
- }
24
-
25
- def get_memory_usage():
26
- """Get memory usage details"""
27
- memory = psutil.virtual_memory()
28
- return {
29
- "total": f"{memory.total / (1024**3):.2f} GB",
30
- "available": f"{memory.available / (1024**3):.2f} GB",
31
- "used": f"{memory.used / (1024**3):.2f} GB",
32
- "percent": f"{memory.percent}%"
33
- }
34
-
35
- def get_cpu_info():
36
- """Get CPU information"""
37
- return {
38
- "physical_cores": psutil.cpu_count(logical=False),
39
- "total_cores": psutil.cpu_count(logical=True),
40
- "cpu_freq": {
41
- "current": f"{psutil.cpu_freq().current:.2f} MHz",
42
- "min": f"{psutil.cpu_freq().min:.2f} MHz",
43
- "max": f"{psutil.cpu_freq().max:.2f} MHz"
44
- },
45
- "cpu_usage": f"{psutil.cpu_percent()}%"
46
- }
47
-
48
- def system_details(detail_type="all"):
49
- """
50
- Get system details based on the requested type.
51
-
52
- Args:
53
- detail_type (str): Type of system detail to retrieve (os, datetime, memory, cpu, all)
54
-
55
- Returns:
56
- dict: Requested system details
57
- """
58
- detail_type = detail_type.lower()
59
-
60
- if detail_type == "all":
61
- return {
62
- "os": get_os_details(),
63
- "datetime": get_datetime(),
64
- "memory": get_memory_usage(),
65
- "cpu": get_cpu_info()
66
- }
67
- elif detail_type == "os":
68
- return get_os_details()
69
- elif detail_type == "datetime":
70
- return get_datetime()
71
- elif detail_type == "memory":
72
- return get_memory_usage()
73
- elif detail_type == "cpu":
74
- return get_cpu_info()
75
- else:
76
- raise ValueError(f"Invalid detail type: {detail_type}. Must be one of: os, datetime, memory, cpu, all")
@@ -1,67 +0,0 @@
1
- import os
2
- from duckduckgo_search import DDGS
3
- from serpapi import SerpApiClient
4
-
5
- def web_search(max_results: int = 10, **kwargs) -> str:
6
- """
7
- Performs a DuckDuckGo web search based on your query (think a Google search) then returns the top search results.
8
- If DuckDuckGo search fails, it falls back to SerpAPI.
9
-
10
- Args:
11
- query (str): The search query to perform.
12
- max_results (int, optional): Maximum number of results to return. Defaults to 10.
13
- **kwargs: Additional keyword arguments to pass to DDGS.
14
-
15
- Returns:
16
- str: Formatted string containing search results.
17
-
18
- Raises:
19
- ImportError: If the duckduckgo_search or serpapi package is not installed.
20
- Exception: If no results are found for the given query via both DuckDuckGo and SerpAPI, or if the SerpAPI key is not found.
21
-
22
- Note:
23
- For SerpAPI fallback, the SERPAPI_API_KEY environment variable must be set.
24
- """
25
- try:
26
- ddgs_instance = DDGS()
27
- except ImportError as e:
28
- raise ImportError("You must install package `duckduckgo_search` to run this function: for instance run `pip install duckduckgo-search`.") from e
29
-
30
- try:
31
- query = kwargs['query']
32
- results = ddgs_instance.text(query, max_results=max_results)
33
- if len(results) == 0:
34
- raise Exception("No results found via DuckDuckGo.")
35
-
36
- postprocessed_results = [f"[{result['title']}]({result['href']})\n{result['body']}" for result in results]
37
-
38
- return "## Search Results (via DuckDuckGo)\n\n" + "\n\n".join(postprocessed_results)
39
-
40
- except Exception as e:
41
- # print(f"DuckDuckGo search failed: {e}. Falling back to SerpAPI.")
42
- # If the exception was the specific DDGS ImportError, we re-raise it directly if it wasn't caught above.
43
- # However, the structure above should prevent it from reaching here.
44
- # The primary purpose of this block is to catch runtime errors from ddgs.text or the "No results" exception.
45
-
46
- api_key = os.environ.get("SERPAPI_API_KEY")
47
- if not api_key:
48
- raise Exception("SerpAPI key not found. Please set the SERPAPI_API_KEY environment variable.")
49
-
50
- try:
51
- client = SerpApiClient({"api_key": api_key})
52
- except ImportError as serp_e:
53
- raise ImportError("You must install package `serpapi` to run this function: for instance run `pip install google-search-results`.") from serp_e
54
-
55
- search_params = {
56
- "engine": "google",
57
- "q": query,
58
- "num": max_results # SerpAPI uses 'num' for number of results
59
- }
60
- serp_results = client.search(search_params)
61
-
62
- if "organic_results" in serp_results and serp_results["organic_results"]:
63
- organic_results = serp_results["organic_results"]
64
- postprocessed_results = [f"[{result['title']}]({result['link']})\n{result.get('snippet', '')}" for result in organic_results]
65
- return "## Search Results (via SerpAPI)\n\n" + "\n\n".join(postprocessed_results)
66
- else:
67
- raise Exception(f"No results found via DuckDuckGo or SerpAPI! Original error: {e}")
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
File without changes
File without changes
File without changes