PikoAi 0.1.14__py3-none-any.whl → 0.1.16__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.
@@ -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}")
Tools/system_details.py CHANGED
@@ -1,49 +1,64 @@
1
1
  import platform
2
2
  import psutil
3
3
  import datetime
4
- import json
5
4
 
6
5
  def get_os_details():
7
6
  """Get operating system details"""
8
- return {
7
+ os_info = {
9
8
  "system": platform.system(),
10
9
  "release": platform.release(),
11
10
  "version": platform.version(),
12
11
  "machine": platform.machine(),
13
12
  "processor": platform.processor()
14
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']}"""
15
21
 
16
22
  def get_datetime():
17
23
  """Get current date and time"""
18
24
  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
- }
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}"""
24
33
 
25
34
  def get_memory_usage():
26
35
  """Get memory usage details"""
27
36
  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
- }
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}"""
34
47
 
35
48
  def get_cpu_info():
36
49
  """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
- }
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()}%"""
47
62
 
48
63
  def system_details(detail_type="all"):
49
64
  """
@@ -53,17 +68,18 @@ def system_details(detail_type="all"):
53
68
  detail_type (str): Type of system detail to retrieve (os, datetime, memory, cpu, all)
54
69
 
55
70
  Returns:
56
- dict: Requested system details
71
+ str: Requested system details as formatted string
57
72
  """
58
73
  detail_type = detail_type.lower()
59
74
 
60
75
  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
- }
76
+ return f"""{get_os_details()}
77
+
78
+ {get_datetime()}
79
+
80
+ {get_memory_usage()}
81
+
82
+ {get_cpu_info()}"""
67
83
  elif detail_type == "os":
68
84
  return get_os_details()
69
85
  elif detail_type == "datetime":
Tools/tool_dir.json CHANGED
@@ -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
  {
Tools/userinp.py CHANGED
@@ -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
 
Tools/web_loader.py CHANGED
@@ -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):
Tools/web_search.py CHANGED
@@ -1,11 +1,8 @@
1
- import os
2
1
  from duckduckgo_search import DDGS
3
- from serpapi import SerpApiClient
4
2
 
5
3
  def web_search(max_results: int = 10, **kwargs) -> str:
6
4
  """
7
5
  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
6
 
10
7
  Args:
11
8
  query (str): The search query to perform.
@@ -16,52 +13,18 @@ def web_search(max_results: int = 10, **kwargs) -> str:
16
13
  str: Formatted string containing search results.
17
14
 
18
15
  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.
16
+ ImportError: If the duckduckgo_search package is not installed.
17
+ Exception: If no results are found for the given query.
24
18
  """
25
19
  try:
26
- ddgs_instance = DDGS()
20
+ ddgs = DDGS()
27
21
  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}")
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)
cli.py CHANGED
@@ -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",
@@ -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
@@ -1,8 +1,8 @@
1
1
  OpenCopilot.py,sha256=kPTs0-ly84h4dM7AmBlK4uwst5Sj2AM6UAlE3okkD8U,12157
2
- cli.py,sha256=hY6KUxvKvJOFThZT--r6m2nzOEMIOVtiVptewsi9Z9w,13868
2
+ cli.py,sha256=qDWlKyOUkhDHSBxQ2wjy1e6KGRsDxE7pjxUZKjQFC3k,13959
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=NHdPXL_jhSHqgXxbkCfvkxI-M2I-cRcv_y77i_szpow,8232
5
+ Agents/Executor/executor.py,sha256=OAqrDdjO62Gy4UKEVF0yYYJjkvVJo_mQy_OMJSibl58,8255
6
6
  Agents/Executor/prompts.py,sha256=dWmUiAloNN_NKwWgaG_IqHDhCX1O-VhwbadUL-16gZw,2903
7
7
  Env/__init__.py,sha256=KLe7UcNV5L395SxhMwbYGyu7KPrSNaoV_9QJo3mLop0,196
8
8
  Env/base_env.py,sha256=K4PoWwPXn3pKeu7_-JOlUuyNbyYQ9itMhQybFOm-3K4,1563
@@ -16,20 +16,20 @@ Env/tests/test_python_executor.py,sha256=5kfs0cOf-RgWTOers_1wB0yvYSF-HrHPsraJ-Px
16
16
  Env/tests/test_shell_executor.py,sha256=-RcCdSUMoRAXHISIh0IR5MCutco80fX2S3sQBcinc_Q,1034
17
17
  Tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
18
  Tools/file_task.py,sha256=VUhWq_G-SWvGahQo8PG7TOpElHUW3BGLUabrTdJS89o,12151
19
- Tools/system_details.py,sha256=7-mTm3CG4NoatHcvcosalEgEcpWlNsCsZ7kuS3y_EmY,2262
20
- Tools/tool_dir.json,sha256=pEqI-1rKud-VEWHYLF2Pbv6xwQZWy62HUF_1hjcdhCY,3128
19
+ Tools/system_details.py,sha256=RScVnhTpUOlNG0g5bGnwmtNr5nSJzOec8HJSFpbicds,2651
20
+ Tools/tool_dir.json,sha256=RTawcanxIkJaUys6Y3yftXAT5uxMH0xPZYTtD1ilJl0,3119
21
21
  Tools/tool_manager.py,sha256=86qwREw5an12dweIGCS1NNgINwHikyTxUpbjPWoLbt0,4118
22
- Tools/userinp.py,sha256=vUhEj3y1W1_ZFHqo2xQwvqDyeOg3VsisSKTI0EurUH8,1205
23
- Tools/web_loader.py,sha256=PyZk2g7WngZT0tCLs9Danx20dYspnaZwy4rlVE9Sx_4,5054
24
- Tools/web_search.py,sha256=mdbqWSJgMjxedrdFocHGfvOGsAq4R1H13yVev71UHkM,3164
22
+ Tools/userinp.py,sha256=SK69fMEdUvNQor9V3BVckeDMJcq71g6H6EHPmNfsZD4,834
23
+ Tools/web_loader.py,sha256=_oP48uwveTaCKU7G5ju2zsJGTcZd1ScXTKOvHDFtZJU,4564
24
+ Tools/web_search.py,sha256=4EGq1VZqfDgG-_yXTd4_Ha1iEUcR-szdlgRV7oFPru4,1259
25
25
  Utils/__init__.py,sha256=oukU0ufroPRd8_N8d2xiFes9CTxSaw4NA6p2nS1kkSg,16
26
26
  Utils/executor_utils.py,sha256=WwK3TKgw_hG_crg7ijRaqfidYnnNXYbbs37vKZRYK-0,491
27
27
  Utils/ter_interface.py,sha256=2k32kVxcxVBewXnjSGSPbx25ZLhKindEMtL6wSC_wL4,3829
28
28
  llm_interface/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
29
  llm_interface/llm.py,sha256=tI_KDOW14QLWowA7bB3GPe2qjlk0sjS5fBavs9XD1fo,5185
30
- pikoai-0.1.14.dist-info/licenses/LICENSE,sha256=cELUVOboOAderKFp8bdtcM5VyJi61YH1oDbRhOuoQZw,1067
31
- pikoai-0.1.14.dist-info/METADATA,sha256=ayjtfHmfey5-P8lvSPW0p-q7jrV_p3nxd-r9dzNHwrU,2962
32
- pikoai-0.1.14.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
33
- pikoai-0.1.14.dist-info/entry_points.txt,sha256=xjZnheDymNDnQ0o84R0jZKEITrhNbzQWN-AhqfA_d6s,50
34
- pikoai-0.1.14.dist-info/top_level.txt,sha256=hWzBNE7UQsuNcENIOksGcJED08k3ZGRRn2X5jnStICU,53
35
- pikoai-0.1.14.dist-info/RECORD,,
30
+ pikoai-0.1.16.dist-info/licenses/LICENSE,sha256=cELUVOboOAderKFp8bdtcM5VyJi61YH1oDbRhOuoQZw,1067
31
+ pikoai-0.1.16.dist-info/METADATA,sha256=218K7ggeGVwRAv1lubC0_rATLNEpMWUVBP8eFYmenb0,2962
32
+ pikoai-0.1.16.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
33
+ pikoai-0.1.16.dist-info/entry_points.txt,sha256=xjZnheDymNDnQ0o84R0jZKEITrhNbzQWN-AhqfA_d6s,50
34
+ pikoai-0.1.16.dist-info/top_level.txt,sha256=hWzBNE7UQsuNcENIOksGcJED08k3ZGRRn2X5jnStICU,53
35
+ pikoai-0.1.16.dist-info/RECORD,,