praisonaiagents 0.0.38__py3-none-any.whl → 0.0.40__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/agent/agent.py +19 -6
- praisonaiagents/knowledge/knowledge.py +20 -7
- {praisonaiagents-0.0.38.dist-info → praisonaiagents-0.0.40.dist-info}/METADATA +1 -1
- {praisonaiagents-0.0.38.dist-info → praisonaiagents-0.0.40.dist-info}/RECORD +6 -6
- {praisonaiagents-0.0.38.dist-info → praisonaiagents-0.0.40.dist-info}/WHEEL +0 -0
- {praisonaiagents-0.0.38.dist-info → praisonaiagents-0.0.40.dist-info}/top_level.txt +0 -0
praisonaiagents/agent/agent.py
CHANGED
@@ -71,10 +71,15 @@ class Agent:
|
|
71
71
|
|
72
72
|
import inspect
|
73
73
|
# Langchain tools
|
74
|
-
if inspect.isclass(func) and hasattr(func, 'run'):
|
74
|
+
if inspect.isclass(func) and hasattr(func, 'run') and not hasattr(func, '_run'):
|
75
75
|
original_func = func
|
76
76
|
func = func.run
|
77
77
|
function_name = original_func.__name__
|
78
|
+
# CrewAI tools
|
79
|
+
elif inspect.isclass(func) and hasattr(func, '_run'):
|
80
|
+
original_func = func
|
81
|
+
func = func._run
|
82
|
+
function_name = original_func.__name__
|
78
83
|
|
79
84
|
sig = inspect.signature(func)
|
80
85
|
logging.debug(f"Function signature: {sig}")
|
@@ -313,14 +318,22 @@ Your Goal: {self.goal}
|
|
313
318
|
|
314
319
|
if func:
|
315
320
|
try:
|
316
|
-
# If it's a class with run
|
317
|
-
if inspect.isclass(func) and hasattr(func, 'run'):
|
321
|
+
# Langchain: If it's a class with run but not _run, instantiate and call run
|
322
|
+
if inspect.isclass(func) and hasattr(func, 'run') and not hasattr(func, '_run'):
|
318
323
|
instance = func()
|
319
|
-
# Extract only the parameters that run() expects
|
320
324
|
run_params = {k: v for k, v in arguments.items()
|
321
|
-
|
322
|
-
|
325
|
+
if k in inspect.signature(instance.run).parameters
|
326
|
+
and k != 'self'}
|
323
327
|
return instance.run(**run_params)
|
328
|
+
|
329
|
+
# CrewAI: If it's a class with an _run method, instantiate and call _run
|
330
|
+
elif inspect.isclass(func) and hasattr(func, '_run'):
|
331
|
+
instance = func()
|
332
|
+
run_params = {k: v for k, v in arguments.items()
|
333
|
+
if k in inspect.signature(instance._run).parameters
|
334
|
+
and k != 'self'}
|
335
|
+
return instance._run(**run_params)
|
336
|
+
|
324
337
|
# Otherwise treat as regular function
|
325
338
|
elif callable(func):
|
326
339
|
return func(**arguments)
|
@@ -4,6 +4,7 @@ import uuid
|
|
4
4
|
import time
|
5
5
|
from .chunking import Chunking
|
6
6
|
from functools import cached_property
|
7
|
+
from rich.progress import Progress, SpinnerColumn, TextColumn, BarColumn, TaskProgressColumn
|
7
8
|
|
8
9
|
logger = logging.getLogger(__name__)
|
9
10
|
|
@@ -274,14 +275,26 @@ class Knowledge:
|
|
274
275
|
# Treat as raw text content only if no file extension
|
275
276
|
memories = [self.normalize_content(input_path)]
|
276
277
|
|
277
|
-
#
|
278
|
+
# Create progress display
|
279
|
+
progress = Progress(
|
280
|
+
SpinnerColumn(),
|
281
|
+
TextColumn("[progress.description]{task.description}"),
|
282
|
+
BarColumn(),
|
283
|
+
TaskProgressColumn(),
|
284
|
+
transient=True
|
285
|
+
)
|
286
|
+
|
287
|
+
# Store memories with progress bar
|
278
288
|
all_results = []
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
289
|
+
with progress:
|
290
|
+
store_task = progress.add_task(f"Adding to Knowledge from {os.path.basename(input_path)}", total=len(memories))
|
291
|
+
for memory in memories:
|
292
|
+
if memory:
|
293
|
+
memory_result = self.store(memory, user_id=user_id, agent_id=agent_id,
|
294
|
+
run_id=run_id, metadata=metadata)
|
295
|
+
if memory_result:
|
296
|
+
all_results.extend(memory_result.get('results', []))
|
297
|
+
progress.advance(store_task)
|
285
298
|
|
286
299
|
return {'results': all_results, 'relations': []}
|
287
300
|
|
@@ -1,13 +1,13 @@
|
|
1
1
|
praisonaiagents/__init__.py,sha256=MCgAj12hVJ0YZmVmdmZgYAAMfPdWSoNSiDlRJCvrJqA,1276
|
2
2
|
praisonaiagents/main.py,sha256=uMBdwxjnJKHLPUzr_5vXlkuhCUO6EW5O8XC0M-h47sE,13915
|
3
3
|
praisonaiagents/agent/__init__.py,sha256=sKO8wGEXvtCrvV1e834r1Okv0XAqAxqZCqz6hKLiTvA,79
|
4
|
-
praisonaiagents/agent/agent.py,sha256=
|
4
|
+
praisonaiagents/agent/agent.py,sha256=4yRT-bl4Tg6jXO_P3gXXhh2xiQ2TT-wKnCyZrCNyQ4w,37596
|
5
5
|
praisonaiagents/agents/__init__.py,sha256=_1d6Pqyk9EoBSo7E68sKyd1jDRlN1vxvVIRpoMc0Jcw,168
|
6
6
|
praisonaiagents/agents/agents.py,sha256=M-nR53A7Qcz_pJ-gyNc4xgM13Nhof7oM-5hXWzr85ho,31250
|
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=dJd8WuFV3w-zWaSAcT21PcXGRIZZc6YxBsJZDfmZNrk,12358
|
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.40.dist-info/METADATA,sha256=EzWmqwSIwOhOfnxHix9_P4VY10kLgzhVoun1N_SvJhQ,664
|
37
|
+
praisonaiagents-0.0.40.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
38
|
+
praisonaiagents-0.0.40.dist-info/top_level.txt,sha256=_HsRddrJ23iDx5TTqVUVvXG2HeHBL5voshncAMDGjtA,16
|
39
|
+
praisonaiagents-0.0.40.dist-info/RECORD,,
|
File without changes
|
File without changes
|