Skip to content

Commit

Permalink
Merge pull request #283 from MervinPraison/develop
Browse files Browse the repository at this point in the history
Update PraisonAI to version 2.0.40 and enhance logging
  • Loading branch information
MervinPraison authored Jan 11, 2025
2 parents f1a532c + a424f84 commit 7de3634
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 22 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,5 @@ outputs
agents/praisonaiagents/build
agents/praisonaiagents/dist
agents/praisonaiagents/praisonaiagents.egg-info
.codegpt
.codegpt
.praison
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM python:3.11-slim
WORKDIR /app
COPY . .
RUN pip install flask praisonai==2.0.39 gunicorn markdown
RUN pip install flask praisonai==2.0.40 gunicorn markdown
EXPOSE 8080
CMD ["gunicorn", "-b", "0.0.0.0:8080", "api:app"]
1 change: 1 addition & 0 deletions agents.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
framework: praisonai
process: sequential
topic: create movie script about cat in mars
memory: false
roles:
researcher:
backstory: Skilled in research, with a focus on gathering accurate and relevant
Expand Down
2 changes: 1 addition & 1 deletion docs/api/praisonai/deploy.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ <h2 id="raises">Raises</h2>
file.write(&#34;FROM python:3.11-slim\n&#34;)
file.write(&#34;WORKDIR /app\n&#34;)
file.write(&#34;COPY . .\n&#34;)
file.write(&#34;RUN pip install flask praisonai==2.0.39 gunicorn markdown\n&#34;)
file.write(&#34;RUN pip install flask praisonai==2.0.40 gunicorn markdown\n&#34;)
file.write(&#34;EXPOSE 8080\n&#34;)
file.write(&#39;CMD [&#34;gunicorn&#34;, &#34;-b&#34;, &#34;0.0.0.0:8080&#34;, &#34;api:app&#34;]\n&#39;)

Expand Down
5 changes: 3 additions & 2 deletions docs/features/langchain.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,10 @@ icon: "link-simple"
<Tab title="No Code">
<Steps>
<Step title="Install Package">
Install the PraisonAI package with LangChain support:
(Upcoming Feature)
Install the PraisonAI package:
```bash
pip install "praisonai[langchain]"
pip install "praisonai"
```
</Step>
<Step title="Set API Key">
Expand Down
2 changes: 1 addition & 1 deletion praisonai.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class Praisonai < Formula

desc "AI tools for various AI applications"
homepage "https://github.com/MervinPraison/PraisonAI"
url "https://github.com/MervinPraison/PraisonAI/archive/refs/tags/2.0.39.tar.gz"
url "https://github.com/MervinPraison/PraisonAI/archive/refs/tags/2.0.40.tar.gz"
sha256 "1828fb9227d10f991522c3f24f061943a254b667196b40b1a3e4a54a8d30ce32" # Replace with actual SHA256 checksum
license "MIT"

Expand Down
22 changes: 13 additions & 9 deletions praisonai/agents_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,9 @@ def load_tools_from_tools_py(self):
try:
# Try to import tools.py from current directory
spec = importlib.util.spec_from_file_location("tools", "tools.py")
self.logger.info(f"Spec: {spec}")
self.logger.debug(f"Spec: {spec}")
if spec is None:
self.logger.info("tools.py not found in current directory")
self.logger.debug("tools.py not found in current directory")
return tools_list

module = importlib.util.module_from_spec(spec)
Expand All @@ -229,10 +229,10 @@ def load_tools_from_tools_py(self):
globals()[name] = obj
# Add to tools list
tools_list.append(obj)
self.logger.info(f"Loaded and globalized tool function: {name}")
self.logger.debug(f"Loaded and globalized tool function: {name}")

self.logger.info(f"Loaded {len(tools_list)} tool functions from tools.py")
self.logger.info(f"Tools list: {tools_list}")
self.logger.debug(f"Loaded {len(tools_list)} tool functions from tools.py")
self.logger.debug(f"Tools list: {tools_list}")

except Exception as e:
self.logger.warning(f"Error loading tools from tools.py: {e}")
Expand Down Expand Up @@ -539,7 +539,7 @@ def _run_praisonai(self, config, topic, tools_dict):

# Load tools once at the beginning
tools_list = self.load_tools_from_tools_py()
self.logger.info(f"Loaded tools: {tools_list}")
self.logger.debug(f"Loaded tools: {tools_list}")

# Create agents from config
for role, details in config['roles'].items():
Expand Down Expand Up @@ -574,7 +574,7 @@ def _run_praisonai(self, config, topic, tools_dict):
agent.step_callback = self.agent_callback

agents[role] = agent
self.logger.info(f"Created agent {role_filled} with tools: {agent.tools}")
self.logger.debug(f"Created agent {role_filled} with tools: {agent.tools}")

# Create tasks for the agent
for task_name, task_details in details.get('tasks', {}).items():
Expand All @@ -596,7 +596,7 @@ def _run_praisonai(self, config, topic, tools_dict):
create_directory=task_details.get('create_directory', False)
)

self.logger.info(f"Created task {task_name} with tools: {task.tools}")
self.logger.debug(f"Created task {task_name} with tools: {task.tools}")

if self.task_callback:
task.callback = self.task_callback
Expand All @@ -613,19 +613,23 @@ def _run_praisonai(self, config, topic, tools_dict):
task.context = context_tasks

# Create and run the PraisonAI agents
memory = config.get('memory', False)
self.logger.debug(f"Memory: {memory}")
if config.get('process') == 'hierarchical':
agents = PraisonAIAgents(
agents=list(agents.values()),
tasks=tasks,
verbose=True,
process="hierarchical",
manager_llm=config.get('manager_llm', 'gpt-4o'),
memory=memory
)
else:
agents = PraisonAIAgents(
agents=list(agents.values()),
tasks=tasks,
verbose=2
verbose=2,
memory=memory
)

self.logger.debug("Final Configuration:")
Expand Down
6 changes: 3 additions & 3 deletions praisonai/api/call.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
# Try to import tools from the root directory
tools = []
tools_path = os.path.join(os.getcwd(), 'tools.py')
logger.info(f"Tools path: {tools_path}")
logger.debug(f"Tools path: {tools_path}")

def import_tools_from_file(file_path):
spec = importlib.util.spec_from_file_location("custom_tools", file_path)
Expand All @@ -63,9 +63,9 @@ def import_tools_from_file(file_path):
if os.path.exists(tools_path):
# tools.py exists in the root directory, import from file
custom_tools_module = import_tools_from_file(tools_path)
logger.info("Successfully imported custom tools from root tools.py")
logger.debug("Successfully imported custom tools from root tools.py")
else:
logger.info("No custom tools.py file found in the root directory")
logger.debug("No custom tools.py file found in the root directory")
custom_tools_module = None

if custom_tools_module:
Expand Down
6 changes: 6 additions & 0 deletions praisonai/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@
pass

logging.basicConfig(level=os.environ.get('LOGLEVEL', 'INFO'), format='%(asctime)s - %(levelname)s - %(message)s')
logging.getLogger('alembic').setLevel(logging.ERROR)
logging.getLogger('gradio').setLevel(logging.ERROR)
logging.getLogger('gradio').setLevel(os.environ.get('GRADIO_LOGLEVEL', 'WARNING'))
logging.getLogger('rust_logger').setLevel(logging.WARNING)
logging.getLogger('duckduckgo').setLevel(logging.ERROR)
logging.getLogger('_client').setLevel(logging.ERROR)

def stream_subprocess(command, env=None):
"""
Expand Down
2 changes: 1 addition & 1 deletion praisonai/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def create_dockerfile(self):
file.write("FROM python:3.11-slim\n")
file.write("WORKDIR /app\n")
file.write("COPY . .\n")
file.write("RUN pip install flask praisonai==2.0.39 gunicorn markdown\n")
file.write("RUN pip install flask praisonai==2.0.40 gunicorn markdown\n")
file.write("EXPOSE 8080\n")
file.write('CMD ["gunicorn", "-b", "0.0.0.0:8080", "api:app"]\n')

Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "PraisonAI"
version = "2.0.39"
version = "2.0.40"
description = "PraisonAI is an AI Agents Framework with Self Reflection. PraisonAI application combines PraisonAI Agents, AutoGen, and CrewAI into a low-code solution for building and managing multi-agent LLM systems, focusing on simplicity, customisation, and efficient human–agent collaboration."
readme = "README.md"
license = ""
Expand Down Expand Up @@ -84,7 +84,7 @@ autogen = ["pyautogen>=0.2.19", "praisonai-tools>=0.0.7", "crewai"]

[tool.poetry]
name = "PraisonAI"
version = "2.0.39"
version = "2.0.40"
description = "PraisonAI is an AI Agents Framework with Self Reflection. PraisonAI application combines PraisonAI Agents, AutoGen, and CrewAI into a low-code solution for building and managing multi-agent LLM systems, focusing on simplicity, customisation, and efficient human–agent collaboration."
authors = ["Mervin Praison"]
license = ""
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7de3634

Please sign in to comment.