praisonaiagents 0.0.43__py3-none-any.whl → 0.0.45__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/agents/agents.py +43 -4
- praisonaiagents/knowledge/knowledge.py +29 -11
- {praisonaiagents-0.0.43.dist-info → praisonaiagents-0.0.45.dist-info}/METADATA +1 -1
- {praisonaiagents-0.0.43.dist-info → praisonaiagents-0.0.45.dist-info}/RECORD +6 -6
- {praisonaiagents-0.0.43.dist-info → praisonaiagents-0.0.45.dist-info}/WHEEL +0 -0
- {praisonaiagents-0.0.43.dist-info → praisonaiagents-0.0.45.dist-info}/top_level.txt +0 -0
praisonaiagents/agents/agents.py
CHANGED
@@ -45,12 +45,13 @@ def process_video(video_path: str, seconds_per_frame=2):
|
|
45
45
|
return base64_frames
|
46
46
|
|
47
47
|
class PraisonAIAgents:
|
48
|
-
def __init__(self, agents, tasks=None, verbose=0, completion_checker=None, max_retries=5, process="sequential", manager_llm=None, memory=False, memory_config=None, embedder=None, user_id=None):
|
48
|
+
def __init__(self, agents, tasks=None, verbose=0, completion_checker=None, max_retries=5, process="sequential", manager_llm=None, memory=False, memory_config=None, embedder=None, user_id=None, max_iter=10):
|
49
49
|
if not agents:
|
50
50
|
raise ValueError("At least one agent must be provided")
|
51
51
|
|
52
52
|
self.run_id = str(uuid.uuid4()) # Auto-generate run_id
|
53
|
-
self.user_id = user_id # Optional user_id
|
53
|
+
self.user_id = user_id or "praison" # Optional user_id
|
54
|
+
self.max_iter = max_iter # Add max_iter parameter
|
54
55
|
|
55
56
|
# Pass user_id to each agent
|
56
57
|
for agent in agents:
|
@@ -244,6 +245,24 @@ Expected Output: {task.expected_output}.
|
|
244
245
|
context_results.append(
|
245
246
|
f"Previous task {context_item.name if context_item.name else context_item.description} has no result yet."
|
246
247
|
)
|
248
|
+
elif isinstance(context_item, dict) and "vector_store" in context_item:
|
249
|
+
from ..knowledge.knowledge import Knowledge
|
250
|
+
try:
|
251
|
+
# Handle both string and dict configs
|
252
|
+
cfg = context_item["vector_store"]
|
253
|
+
if isinstance(cfg, str):
|
254
|
+
cfg = json.loads(cfg)
|
255
|
+
|
256
|
+
knowledge = Knowledge(config={"vector_store": cfg}, verbose=self.verbose)
|
257
|
+
|
258
|
+
# Only use user_id as filter
|
259
|
+
db_results = knowledge.search(
|
260
|
+
task.description,
|
261
|
+
user_id=self.user_id if self.user_id else None
|
262
|
+
)
|
263
|
+
context_results.append(f"[DB Context]: {str(db_results)}")
|
264
|
+
except Exception as e:
|
265
|
+
context_results.append(f"[Vector DB Error]: {e}")
|
247
266
|
|
248
267
|
# Join unique context results
|
249
268
|
unique_contexts = list(dict.fromkeys(context_results)) # Remove duplicates
|
@@ -402,7 +421,8 @@ Context:
|
|
402
421
|
tasks=self.tasks,
|
403
422
|
agents=self.agents,
|
404
423
|
manager_llm=self.manager_llm,
|
405
|
-
verbose=self.verbose
|
424
|
+
verbose=self.verbose,
|
425
|
+
max_iter=self.max_iter
|
406
426
|
)
|
407
427
|
|
408
428
|
if self.process == "workflow":
|
@@ -521,6 +541,24 @@ Expected Output: {task.expected_output}.
|
|
521
541
|
context_results.append(
|
522
542
|
f"Previous task {context_item.name if context_item.name else context_item.description} has no result yet."
|
523
543
|
)
|
544
|
+
elif isinstance(context_item, dict) and "vector_store" in context_item:
|
545
|
+
from ..knowledge.knowledge import Knowledge
|
546
|
+
try:
|
547
|
+
# Handle both string and dict configs
|
548
|
+
cfg = context_item["vector_store"]
|
549
|
+
if isinstance(cfg, str):
|
550
|
+
cfg = json.loads(cfg)
|
551
|
+
|
552
|
+
knowledge = Knowledge(config={"vector_store": cfg}, verbose=self.verbose)
|
553
|
+
|
554
|
+
# Only use user_id as filter
|
555
|
+
db_results = knowledge.search(
|
556
|
+
task.description,
|
557
|
+
user_id=self.user_id if self.user_id else None
|
558
|
+
)
|
559
|
+
context_results.append(f"[DB Context]: {str(db_results)}")
|
560
|
+
except Exception as e:
|
561
|
+
context_results.append(f"[Vector DB Error]: {e}")
|
524
562
|
|
525
563
|
# Join unique context results
|
526
564
|
unique_contexts = list(dict.fromkeys(context_results)) # Remove duplicates
|
@@ -710,7 +748,8 @@ Context:
|
|
710
748
|
tasks=self.tasks,
|
711
749
|
agents=self.agents,
|
712
750
|
manager_llm=self.manager_llm,
|
713
|
-
verbose=self.verbose
|
751
|
+
verbose=self.verbose,
|
752
|
+
max_iter=self.max_iter
|
714
753
|
)
|
715
754
|
|
716
755
|
if self.process == "workflow":
|
@@ -84,8 +84,8 @@ class Knowledge:
|
|
84
84
|
|
85
85
|
@cached_property
|
86
86
|
def config(self):
|
87
|
-
# Generate unique collection name for each instance
|
88
|
-
|
87
|
+
# Generate unique collection name for each instance (only if not provided in config)
|
88
|
+
default_collection = f"test_{int(time.time())}_{str(uuid.uuid4())[:8]}"
|
89
89
|
persist_dir = ".praison"
|
90
90
|
|
91
91
|
# Create persistent client config
|
@@ -93,9 +93,11 @@ class Knowledge:
|
|
93
93
|
"vector_store": {
|
94
94
|
"provider": "chroma",
|
95
95
|
"config": {
|
96
|
-
"collection_name":
|
96
|
+
"collection_name": default_collection,
|
97
97
|
"path": persist_dir,
|
98
|
-
"client": self._deps['chromadb'].PersistentClient(path=persist_dir)
|
98
|
+
"client": self._deps['chromadb'].PersistentClient(path=persist_dir),
|
99
|
+
"host": None,
|
100
|
+
"port": None
|
99
101
|
}
|
100
102
|
},
|
101
103
|
"version": "v1.1",
|
@@ -104,13 +106,29 @@ class Knowledge:
|
|
104
106
|
|
105
107
|
# If config is provided, merge it with base config
|
106
108
|
if self._config:
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
109
|
+
# Merge version if provided
|
110
|
+
if "version" in self._config:
|
111
|
+
base_config["version"] = self._config["version"]
|
112
|
+
|
113
|
+
# Merge vector_store config
|
114
|
+
if "vector_store" in self._config:
|
115
|
+
if "provider" in self._config["vector_store"]:
|
116
|
+
base_config["vector_store"]["provider"] = self._config["vector_store"]["provider"]
|
117
|
+
|
118
|
+
if "config" in self._config["vector_store"]:
|
119
|
+
config_copy = self._config["vector_store"]["config"].copy()
|
120
|
+
# Only exclude client as it's managed internally
|
121
|
+
if "client" in config_copy:
|
122
|
+
del config_copy["client"]
|
123
|
+
base_config["vector_store"]["config"].update(config_copy)
|
124
|
+
|
125
|
+
# Merge embedder config if provided
|
126
|
+
if "embedder" in self._config:
|
127
|
+
base_config["embedder"] = self._config["embedder"]
|
128
|
+
|
129
|
+
# Merge llm config if provided
|
130
|
+
if "llm" in self._config:
|
131
|
+
base_config["llm"] = self._config["llm"]
|
114
132
|
return base_config
|
115
133
|
|
116
134
|
@cached_property
|
@@ -3,11 +3,11 @@ praisonaiagents/main.py,sha256=wcFooRmCY38wtkSNFt6-nhZafgrHotCZE0S6U8IWgUY,14093
|
|
3
3
|
praisonaiagents/agent/__init__.py,sha256=sKO8wGEXvtCrvV1e834r1Okv0XAqAxqZCqz6hKLiTvA,79
|
4
4
|
praisonaiagents/agent/agent.py,sha256=rWvuZKP1fMF-BBe7I554FVk56Wse_iHyjoRRNEuyC5o,37836
|
5
5
|
praisonaiagents/agents/__init__.py,sha256=_1d6Pqyk9EoBSo7E68sKyd1jDRlN1vxvVIRpoMc0Jcw,168
|
6
|
-
praisonaiagents/agents/agents.py,sha256=
|
6
|
+
praisonaiagents/agents/agents.py,sha256=312eM5eqnXp8kZ2-7HDGn20rsQ4LWk4rpe5ll8L-XBg,35516
|
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=fQNREDiwdoisfIxJBLVkteXgq_8Gbypfc3UaZbxf5QY,13210
|
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=_1Nk37kOYakPaUWAJff86rP0ENyykXqMnhTp8E0efuE,30802
|
@@ -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.45.dist-info/METADATA,sha256=FiAB88UQV3pT9NZsHG8O5EgRnW1lfXgoOop_mXwB8Ng,664
|
37
|
+
praisonaiagents-0.0.45.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
38
|
+
praisonaiagents-0.0.45.dist-info/top_level.txt,sha256=_HsRddrJ23iDx5TTqVUVvXG2HeHBL5voshncAMDGjtA,16
|
39
|
+
praisonaiagents-0.0.45.dist-info/RECORD,,
|
File without changes
|
File without changes
|