PikoAi 0.1.18__py3-none-any.whl → 0.1.19__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.
llm_interface/llm.py CHANGED
@@ -7,26 +7,11 @@ import os
7
7
  import sys
8
8
  import json
9
9
  import litellm # Added import for litellm
10
- import logging
11
- from datetime import datetime
12
10
 
13
11
  sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../')))
14
12
 
15
13
  from Utils.ter_interface import TerminalInterface
16
14
 
17
- # Set up logging
18
- log_dir = os.path.join(os.path.dirname(__file__), '../../logs')
19
- os.makedirs(log_dir, exist_ok=True)
20
- log_file = os.path.join(log_dir, 'llm_responses.log')
21
-
22
- # Configure logging
23
- logging.basicConfig(
24
- level=logging.INFO,
25
- format='%(asctime)s - %(message)s',
26
- handlers=[
27
- logging.FileHandler(log_file) # Only log to file, removed StreamHandler
28
- ]
29
- )
30
15
 
31
16
  # Load environment variables from .env file
32
17
  load_dotenv()
@@ -45,15 +30,6 @@ class LiteLLMInterface:
45
30
  def __init__(self):
46
31
  self.terminal = TerminalInterface()
47
32
  self.model_name = self.load_config()
48
- logging.info(f"\n{'='*50}\nNew Session - Using model: {self.model_name}\n{'='*50}")
49
-
50
- def log_response(self, response_content):
51
- """Log only the LLM response in a readable format."""
52
- timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
53
- log_entry = f"\n{'='*50}\nTimestamp: {timestamp}\nModel: {self.model_name}\n\n"
54
- log_entry += f"Response:\n{response_content}\n"
55
- log_entry += f"{'='*50}\n"
56
- logging.info(log_entry)
57
33
 
58
34
  def load_config(self):
59
35
  config_path = os.path.join(os.path.dirname(__file__), '../../config.json')
@@ -84,12 +60,10 @@ class LiteLLMInterface:
84
60
  response_content += content
85
61
 
86
62
  self.terminal.flush_markdown()
87
- # Log only the response after successful completion
88
- self.log_response(response_content)
89
63
  return response_content
90
64
  except Exception as e:
91
- # Log the error
92
- logging.error(f"\n{'='*50}\nError occurred:\nModel: {self.model_name}\nError: {str(e)}\n{'='*50}")
65
+ # litellm maps exceptions to OpenAI exceptions.
66
+ # The executor should catch these and handle them.
93
67
  print(f"An error occurred during the API call: {e}")
94
68
  self.terminal.flush_markdown() # Ensure terminal is flushed even on error
95
69
  raise # Re-raise the exception to be caught by the executor
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PikoAi
3
- Version: 0.1.18
3
+ Version: 0.1.19
4
4
  Summary: An AI-powered task automation tool
5
5
  Home-page: https://github.com/nihaaaar22/OS-Assistant
6
6
  Author: Nihar S
@@ -26,10 +26,10 @@ 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=8Oe5818MAYC21SfUxtfnV9HQFcQ49z8Q030jjPqNP_g,3889
28
28
  llm_interface/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
- llm_interface/llm.py,sha256=TEKKgRfZGtk_UgBfqqkdWKHr4NS3jOOk9di0S3RA7c0,6216
30
- pikoai-0.1.18.dist-info/licenses/LICENSE,sha256=cELUVOboOAderKFp8bdtcM5VyJi61YH1oDbRhOuoQZw,1067
31
- pikoai-0.1.18.dist-info/METADATA,sha256=BM1IQxmZ4D7p07EfgLAuUGhpLvAT3W9oPw9WTV8Lee0,2962
32
- pikoai-0.1.18.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
33
- pikoai-0.1.18.dist-info/entry_points.txt,sha256=xjZnheDymNDnQ0o84R0jZKEITrhNbzQWN-AhqfA_d6s,50
34
- pikoai-0.1.18.dist-info/top_level.txt,sha256=hWzBNE7UQsuNcENIOksGcJED08k3ZGRRn2X5jnStICU,53
35
- pikoai-0.1.18.dist-info/RECORD,,
29
+ llm_interface/llm.py,sha256=tI_KDOW14QLWowA7bB3GPe2qjlk0sjS5fBavs9XD1fo,5185
30
+ pikoai-0.1.19.dist-info/licenses/LICENSE,sha256=cELUVOboOAderKFp8bdtcM5VyJi61YH1oDbRhOuoQZw,1067
31
+ pikoai-0.1.19.dist-info/METADATA,sha256=4N9c6Htp6lsrimD8ukdfxTZG59quiJodw6pIECoLVPg,2962
32
+ pikoai-0.1.19.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
33
+ pikoai-0.1.19.dist-info/entry_points.txt,sha256=xjZnheDymNDnQ0o84R0jZKEITrhNbzQWN-AhqfA_d6s,50
34
+ pikoai-0.1.19.dist-info/top_level.txt,sha256=hWzBNE7UQsuNcENIOksGcJED08k3ZGRRn2X5jnStICU,53
35
+ pikoai-0.1.19.dist-info/RECORD,,