Skip to content

Commit ded94e3

Browse files
Merge pull request #316 from MervinPraison/develop
Develop
2 parents 23de58d + f89c6e1 commit ded94e3

File tree

14 files changed

+88
-18
lines changed

14 files changed

+88
-18
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM python:3.11-slim
22
WORKDIR /app
33
COPY . .
4-
RUN pip install flask praisonai==2.0.54 gunicorn markdown
4+
RUN pip install flask praisonai==2.0.55 gunicorn markdown
55
EXPOSE 8080
66
CMD ["gunicorn", "-b", "0.0.0.0:8080", "api:app"]

agents/deepseek-agents.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
from praisonaiagents import Agent, Task, PraisonAIAgents
2+
3+
# Define the configuration for the Knowledge instance
4+
config = {
5+
"vector_store": {
6+
"provider": "chroma",
7+
"config": {
8+
"collection_name": "praison",
9+
"path": ".praison"
10+
}
11+
}
12+
}
13+
14+
# Create an agent
15+
rag_agent = Agent(
16+
name="RAG Agent",
17+
role="Information Specialist",
18+
goal="Retrieve knowledge efficiently",
19+
llm="deepseek-r1"
20+
)
21+
22+
# Define a task for the agent
23+
rag_task = Task(
24+
name="RAG Task",
25+
description="What is KAG?",
26+
expected_output="Answer to the question",
27+
agent=rag_agent,
28+
context=[config] # Vector Database provided as context
29+
)
30+
31+
# Build Agents
32+
agents = PraisonAIAgents(
33+
agents=[rag_agent],
34+
tasks=[rag_task],
35+
user_id="user1"
36+
)
37+
38+
# Start Agents
39+
agents.start()

agents/praisonaiagents/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from .agents.autoagents import AutoAgents
1010
from .knowledge.knowledge import Knowledge
1111
from .knowledge.chunking import Chunking
12-
from .memory.memory import Memory
1312
from .main import (
1413
TaskOutput,
1514
ReflectionOutput,
@@ -38,7 +37,6 @@
3837
'TaskOutput',
3938
'ReflectionOutput',
4039
'AutoAgents',
41-
'Memory',
4240
'display_interaction',
4341
'display_self_reflection',
4442
'display_instruction',

agents/praisonaiagents/agent/agent.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,17 @@ def __init__(
192192
reflect_llm: Optional[str] = None,
193193
user_id: Optional[str] = None
194194
):
195+
# Add check at start if memory is requested
196+
if memory is not None:
197+
try:
198+
from ..memory.memory import Memory
199+
MEMORY_AVAILABLE = True
200+
except ImportError:
201+
raise ImportError(
202+
"Memory features requested in Agent but memory dependencies not installed. "
203+
"Please install with: pip install \"praisonaiagents[memory]\""
204+
)
205+
195206
# Handle backward compatibility for required fields
196207
if all(x is None for x in [name, role, goal, backstory, instructions]):
197208
raise ValueError("At least one of name, role, goal, backstory, or instructions must be provided")

agents/praisonaiagents/agents/agents.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,17 @@ def process_video(video_path: str, seconds_per_frame=2):
4646

4747
class PraisonAIAgents:
4848
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+
# Add check at the start if memory is requested
50+
if memory:
51+
try:
52+
from ..memory.memory import Memory
53+
MEMORY_AVAILABLE = True
54+
except ImportError:
55+
raise ImportError(
56+
"Memory features requested but memory dependencies not installed. "
57+
"Please install with: pip install \"praisonaiagents[memory]\""
58+
)
59+
4960
if not agents:
5061
raise ValueError("At least one agent must be provided")
5162

agents/praisonaiagents/memory/memory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
CHROMADB_AVAILABLE = True
1616
except ImportError:
1717
CHROMADB_AVAILABLE = False
18-
logger.warning("To use memory features, please run: pip install \"praisonaiagents[memory]\"")
18+
pass
1919

2020
try:
2121
import mem0

agents/praisonaiagents/task/task.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,17 @@ def __init__(
4040
quality_check=True,
4141
input_file: Optional[str] = None
4242
):
43+
# Add check if memory config is provided
44+
if memory is not None or (config and config.get('memory_config')):
45+
try:
46+
from ..memory.memory import Memory
47+
MEMORY_AVAILABLE = True
48+
except ImportError:
49+
raise ImportError(
50+
"Memory features requested in Task but memory dependencies not installed. "
51+
"Please install with: pip install \"praisonaiagents[memory]\""
52+
)
53+
4354
self.input_file = input_file
4455
self.id = str(uuid.uuid4()) if id is None else str(id)
4556
self.name = name

agents/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "praisonaiagents"
7-
version = "0.0.45"
7+
version = "0.0.46"
88
description = "Praison AI agents for completing complex tasks with Self Reflection Agents"
99
authors = [
1010
{ name="Mervin Praison" }

agents/uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/api/praisonai/deploy.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ <h2 id="raises">Raises</h2>
110110
file.write(&#34;FROM python:3.11-slim\n&#34;)
111111
file.write(&#34;WORKDIR /app\n&#34;)
112112
file.write(&#34;COPY . .\n&#34;)
113-
file.write(&#34;RUN pip install flask praisonai==2.0.54 gunicorn markdown\n&#34;)
113+
file.write(&#34;RUN pip install flask praisonai==2.0.55 gunicorn markdown\n&#34;)
114114
file.write(&#34;EXPOSE 8080\n&#34;)
115115
file.write(&#39;CMD [&#34;gunicorn&#34;, &#34;-b&#34;, &#34;0.0.0.0:8080&#34;, &#34;api:app&#34;]\n&#39;)
116116

0 commit comments

Comments
 (0)