PikoAi 0.1.13__tar.gz → 0.1.14__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 (46) hide show
  1. {pikoai-0.1.13 → pikoai-0.1.14}/PKG-INFO +1 -1
  2. {pikoai-0.1.13 → pikoai-0.1.14}/Src/Agents/Executor/executor.py +2 -1
  3. {pikoai-0.1.13 → pikoai-0.1.14}/Src/OpenCopilot.py +3 -3
  4. {pikoai-0.1.13 → pikoai-0.1.14}/Src/PikoAi.egg-info/PKG-INFO +1 -1
  5. pikoai-0.1.14/Src/Tools/web_search.py +67 -0
  6. {pikoai-0.1.13 → pikoai-0.1.14}/setup.py +1 -1
  7. pikoai-0.1.13/Src/Tools/web_search.py +0 -30
  8. {pikoai-0.1.13 → pikoai-0.1.14}/LICENSE +0 -0
  9. {pikoai-0.1.13 → pikoai-0.1.14}/README.md +0 -0
  10. {pikoai-0.1.13 → pikoai-0.1.14}/Src/Agents/Executor/__init__.py +0 -0
  11. {pikoai-0.1.13 → pikoai-0.1.14}/Src/Agents/Executor/prompts.py +0 -0
  12. {pikoai-0.1.13 → pikoai-0.1.14}/Src/Agents/__init__.py +0 -0
  13. {pikoai-0.1.13 → pikoai-0.1.14}/Src/Env/__init__.py +0 -0
  14. {pikoai-0.1.13 → pikoai-0.1.14}/Src/Env/base_env.py +0 -0
  15. {pikoai-0.1.13 → pikoai-0.1.14}/Src/Env/base_executor.py +0 -0
  16. {pikoai-0.1.13 → pikoai-0.1.14}/Src/Env/env.py +0 -0
  17. {pikoai-0.1.13 → pikoai-0.1.14}/Src/Env/js_executor.py +0 -0
  18. {pikoai-0.1.13 → pikoai-0.1.14}/Src/Env/python_executor.py +0 -0
  19. {pikoai-0.1.13 → pikoai-0.1.14}/Src/Env/shell.py +0 -0
  20. {pikoai-0.1.13 → pikoai-0.1.14}/Src/Env/tests/__init__.py +0 -0
  21. {pikoai-0.1.13 → pikoai-0.1.14}/Src/Env/tests/test_python_executor.py +0 -0
  22. {pikoai-0.1.13 → pikoai-0.1.14}/Src/Env/tests/test_shell_executor.py +0 -0
  23. {pikoai-0.1.13 → pikoai-0.1.14}/Src/PikoAi.egg-info/SOURCES.txt +0 -0
  24. {pikoai-0.1.13 → pikoai-0.1.14}/Src/PikoAi.egg-info/dependency_links.txt +0 -0
  25. {pikoai-0.1.13 → pikoai-0.1.14}/Src/PikoAi.egg-info/entry_points.txt +0 -0
  26. {pikoai-0.1.13 → pikoai-0.1.14}/Src/PikoAi.egg-info/requires.txt +0 -0
  27. {pikoai-0.1.13 → pikoai-0.1.14}/Src/PikoAi.egg-info/top_level.txt +0 -0
  28. {pikoai-0.1.13 → pikoai-0.1.14}/Src/Tools/__init__.py +0 -0
  29. {pikoai-0.1.13 → pikoai-0.1.14}/Src/Tools/file_task.py +0 -0
  30. {pikoai-0.1.13 → pikoai-0.1.14}/Src/Tools/system_details.py +0 -0
  31. {pikoai-0.1.13 → pikoai-0.1.14}/Src/Tools/tool_dir.json +0 -0
  32. {pikoai-0.1.13 → pikoai-0.1.14}/Src/Tools/tool_manager.py +0 -0
  33. {pikoai-0.1.13 → pikoai-0.1.14}/Src/Tools/userinp.py +0 -0
  34. {pikoai-0.1.13 → pikoai-0.1.14}/Src/Tools/web_loader.py +0 -0
  35. {pikoai-0.1.13 → pikoai-0.1.14}/Src/Utils/__init__.py +0 -0
  36. {pikoai-0.1.13 → pikoai-0.1.14}/Src/Utils/executor_utils.py +0 -0
  37. {pikoai-0.1.13 → pikoai-0.1.14}/Src/Utils/ter_interface.py +0 -0
  38. {pikoai-0.1.13 → pikoai-0.1.14}/Src/cli.py +0 -0
  39. {pikoai-0.1.13 → pikoai-0.1.14}/Src/llm_interface/__init__.py +0 -0
  40. {pikoai-0.1.13 → pikoai-0.1.14}/Src/llm_interface/llm.py +0 -0
  41. {pikoai-0.1.13 → pikoai-0.1.14}/setup.cfg +0 -0
  42. {pikoai-0.1.13 → pikoai-0.1.14}/test/test.py +0 -0
  43. {pikoai-0.1.13 → pikoai-0.1.14}/test/test_file_task.py +0 -0
  44. {pikoai-0.1.13 → pikoai-0.1.14}/test/test_opencopilot_file_integration.py +0 -0
  45. {pikoai-0.1.13 → pikoai-0.1.14}/test/testjs.py +0 -0
  46. {pikoai-0.1.13 → pikoai-0.1.14}/test/testscript.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PikoAi
3
- Version: 0.1.13
3
+ Version: 0.1.14
4
4
  Summary: An AI-powered task automation tool
5
5
  Home-page: https://github.com/nihaaaar22/OS-Assistant
6
6
  Author: Nihar S
@@ -83,7 +83,8 @@ class executor:
83
83
 
84
84
  # Streaming is handled within LiteLLMInterface.chat()
85
85
  # and TerminalInterface.process_markdown_chunk()
86
- self.message.append({"role": "assistant", "content": response})
86
+ if response.strip():
87
+ self.message.append({"role": "assistant", "content": response})
87
88
  return response
88
89
 
89
90
  except Exception as e: # Catching generic Exception as LiteLLM maps to OpenAI exceptions
@@ -206,12 +206,12 @@ Examples:
206
206
 
207
207
  try:
208
208
  # Get initial prompt
209
- user_input = self.session.prompt(HTML("<b>Please enter your prompt: </b>"))
209
+ user_input = self.session.prompt(HTML("<b>Piko></b>"))
210
210
 
211
211
  # Handle special commands
212
212
  if user_input.lower() == 'help':
213
213
  self.display_help()
214
- user_input = self.session.prompt(HTML("<b>Please enter your prompt: </b>"))
214
+ user_input = self.session.prompt(HTML("<b>Piko></b>"))
215
215
  elif user_input.lower() == 'quit':
216
216
  print("Goodbye!")
217
217
  return
@@ -227,7 +227,7 @@ Examples:
227
227
  # Continue conversation loop
228
228
  while True:
229
229
  try:
230
- user_input = self.session.prompt(HTML("<b>\nPlease enter your prompt (or 'quit' to exit): </b>"))
230
+ user_input = self.session.prompt(HTML("<b>\nPiko></b>"))
231
231
 
232
232
  # Handle special commands
233
233
  if user_input.lower() == 'quit':
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PikoAi
3
- Version: 0.1.13
3
+ Version: 0.1.14
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,67 @@
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}")
@@ -3,7 +3,7 @@ from pathlib import Path
3
3
 
4
4
  setup(
5
5
  name="PikoAi",
6
- version="0.1.13",
6
+ version="0.1.14",
7
7
  packages=find_packages(where="Src"),
8
8
  py_modules=["cli", "OpenCopilot"],
9
9
  package_dir={"": "Src"},
@@ -1,30 +0,0 @@
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)
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
File without changes
File without changes
File without changes