praisonaiagents 0.0.37__py3-none-any.whl → 0.0.38__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.
- praisonaiagents/knowledge/knowledge.py +29 -8
- {praisonaiagents-0.0.37.dist-info → praisonaiagents-0.0.38.dist-info}/METADATA +1 -1
- {praisonaiagents-0.0.37.dist-info → praisonaiagents-0.0.38.dist-info}/RECORD +5 -5
- {praisonaiagents-0.0.37.dist-info → praisonaiagents-0.0.38.dist-info}/WHEEL +0 -0
- {praisonaiagents-0.0.37.dist-info → praisonaiagents-0.0.38.dist-info}/top_level.txt +0 -0
@@ -43,9 +43,28 @@ class CustomMemory:
|
|
43
43
|
}]
|
44
44
|
|
45
45
|
class Knowledge:
|
46
|
-
def __init__(self, config=None):
|
46
|
+
def __init__(self, config=None, verbose=None):
|
47
47
|
self._config = config
|
48
|
+
self._verbose = verbose or 0
|
48
49
|
os.environ['ANONYMIZED_TELEMETRY'] = 'False' # Chromadb
|
50
|
+
|
51
|
+
# Configure logging levels based on verbose setting
|
52
|
+
if not self._verbose:
|
53
|
+
# Suppress logs from all relevant dependencies
|
54
|
+
for logger_name in [
|
55
|
+
'mem0',
|
56
|
+
'chromadb',
|
57
|
+
'local_persistent_hnsw',
|
58
|
+
'_client',
|
59
|
+
'main'
|
60
|
+
]:
|
61
|
+
logging.getLogger(logger_name).setLevel(logging.WARNING)
|
62
|
+
|
63
|
+
# Disable OpenAI API request logging
|
64
|
+
logging.getLogger('openai').setLevel(logging.WARNING)
|
65
|
+
|
66
|
+
# Set root logger to warning to catch any uncategorized logs
|
67
|
+
logging.getLogger().setLevel(logging.WARNING)
|
49
68
|
|
50
69
|
@cached_property
|
51
70
|
def _deps(self):
|
@@ -121,14 +140,17 @@ class Knowledge:
|
|
121
140
|
chunk_overlap=50
|
122
141
|
)
|
123
142
|
|
143
|
+
def _log(self, message, level=2):
|
144
|
+
"""Internal logging helper"""
|
145
|
+
if self._verbose and self._verbose >= level:
|
146
|
+
logger.info(message)
|
147
|
+
|
124
148
|
def store(self, content, user_id=None, agent_id=None, run_id=None, metadata=None):
|
125
149
|
"""Store a memory."""
|
126
150
|
try:
|
127
|
-
# Process content to match expected format
|
128
151
|
if isinstance(content, str):
|
129
|
-
# Check if content is actually a file path
|
130
152
|
if any(content.lower().endswith(ext) for ext in ['.pdf', '.doc', '.docx', '.txt']):
|
131
|
-
|
153
|
+
self._log(f"Content appears to be a file path, processing file: {content}")
|
132
154
|
return self.add(content, user_id=user_id, agent_id=agent_id, run_id=run_id, metadata=metadata)
|
133
155
|
|
134
156
|
content = content.strip()
|
@@ -136,7 +158,7 @@ class Knowledge:
|
|
136
158
|
return []
|
137
159
|
|
138
160
|
result = self.memory.add(content, user_id=user_id, agent_id=agent_id, run_id=run_id, metadata=metadata)
|
139
|
-
|
161
|
+
self._log(f"Store operation result: {result}")
|
140
162
|
return result
|
141
163
|
except Exception as e:
|
142
164
|
logger.error(f"Error storing content: {str(e)}")
|
@@ -210,8 +232,7 @@ class Knowledge:
|
|
210
232
|
|
211
233
|
# Check if input is URL
|
212
234
|
if isinstance(input_path, str) and (input_path.startswith('http://') or input_path.startswith('https://')):
|
213
|
-
|
214
|
-
# TODO: Implement URL handling
|
235
|
+
self._log(f"Processing URL: {input_path}")
|
215
236
|
raise NotImplementedError("URL processing not yet implemented")
|
216
237
|
|
217
238
|
# Check if input ends with any supported extension
|
@@ -220,7 +241,7 @@ class Knowledge:
|
|
220
241
|
for ext in (exts if isinstance(exts, tuple) else (exts,)))
|
221
242
|
|
222
243
|
if is_supported_file:
|
223
|
-
|
244
|
+
self._log(f"Processing as file path: {input_path}")
|
224
245
|
if not os.path.exists(input_path):
|
225
246
|
logger.error(f"File not found: {input_path}")
|
226
247
|
raise FileNotFoundError(f"File not found: {input_path}")
|
@@ -7,7 +7,7 @@ praisonaiagents/agents/agents.py,sha256=M-nR53A7Qcz_pJ-gyNc4xgM13Nhof7oM-5hXWzr8
|
|
7
7
|
praisonaiagents/agents/autoagents.py,sha256=bjC2O5oZmoJItJXIMPTWc2lsp_AJC9tMiTQOal2hwPA,13532
|
8
8
|
praisonaiagents/knowledge/__init__.py,sha256=xL1Eh-a3xsHyIcU4foOWF-JdWYIYBALJH9bge0Ujuto,246
|
9
9
|
praisonaiagents/knowledge/chunking.py,sha256=FzoNY0q8MkvG4gADqk4JcRhmH3lcEHbRdonDgitQa30,6624
|
10
|
-
praisonaiagents/knowledge/knowledge.py,sha256=
|
10
|
+
praisonaiagents/knowledge/knowledge.py,sha256=fkeV6smNhqpGOKd-X2KQihZm7WxJXVAIOAOFMXHBjpk,11726
|
11
11
|
praisonaiagents/memory/memory.py,sha256=ZxqSpOUxk9jeTKGW0ZiTifC0uZtym-EZILP3kuOOKkU,35626
|
12
12
|
praisonaiagents/process/__init__.py,sha256=lkYbL7Hn5a0ldvJtkdH23vfIIZLIcanK-65C0MwaorY,52
|
13
13
|
praisonaiagents/process/process.py,sha256=uSudOFI1ZlGM_nbT8qHD4iIP3y5Ygu8V-izLot2te70,26316
|
@@ -33,7 +33,7 @@ praisonaiagents/tools/wikipedia_tools.py,sha256=pGko-f33wqXgxJTv8db7TbizY5XnzBQR
|
|
33
33
|
praisonaiagents/tools/xml_tools.py,sha256=iYTMBEk5l3L3ryQ1fkUnNVYK-Nnua2Kx2S0dxNMMs1A,17122
|
34
34
|
praisonaiagents/tools/yaml_tools.py,sha256=uogAZrhXV9O7xvspAtcTfpKSQYL2nlOTvCQXN94-G9A,14215
|
35
35
|
praisonaiagents/tools/yfinance_tools.py,sha256=s2PBj_1v7oQnOobo2fDbQBACEHl61ftG4beG6Z979ZE,8529
|
36
|
-
praisonaiagents-0.0.
|
37
|
-
praisonaiagents-0.0.
|
38
|
-
praisonaiagents-0.0.
|
39
|
-
praisonaiagents-0.0.
|
36
|
+
praisonaiagents-0.0.38.dist-info/METADATA,sha256=T8Gw8LG53SbB6jwLsWqsGi9NVSso-umFQbSgmQCtG10,664
|
37
|
+
praisonaiagents-0.0.38.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
38
|
+
praisonaiagents-0.0.38.dist-info/top_level.txt,sha256=_HsRddrJ23iDx5TTqVUVvXG2HeHBL5voshncAMDGjtA,16
|
39
|
+
praisonaiagents-0.0.38.dist-info/RECORD,,
|
File without changes
|
File without changes
|