mirror of
https://github.com/MervinPraison/PraisonAI.git
synced 2026-11-08 17:31:00 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2220114809 | ||
|
|
9fe4dbc172 | ||
|
|
180503fcd5 | ||
|
|
0d8f936b19 |
No files matched your search
@@ -152,6 +152,10 @@ praisonai research "What are the latest AI trends in 2025?"
|
||||
# Use Gemini
|
||||
praisonai research --model deep-research-pro "Your research query"
|
||||
|
||||
# Save output to file (output/research/{query}.md)
|
||||
praisonai research --save "Your research query"
|
||||
praisonai research -s "Your research query"
|
||||
|
||||
# Verbose mode (show debug logs)
|
||||
praisonai research -v "Your research query"
|
||||
```
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ RUN mkdir -p /root/.praison
|
||||
# Install Python packages (using latest versions)
|
||||
RUN pip install --no-cache-dir \
|
||||
flask \
|
||||
"praisonai>=2.2.90" \
|
||||
"praisonai>=2.2.93" \
|
||||
"praisonai[api]" \
|
||||
gunicorn \
|
||||
markdown
|
||||
|
||||
@@ -16,7 +16,7 @@ RUN mkdir -p /root/.praison
|
||||
# Install Python packages (using latest versions)
|
||||
RUN pip install --no-cache-dir \
|
||||
praisonai_tools \
|
||||
"praisonai>=2.2.90" \
|
||||
"praisonai>=2.2.93" \
|
||||
"praisonai[chat]" \
|
||||
"embedchain[github,youtube]"
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ RUN mkdir -p /root/.praison
|
||||
# Install Python packages (using latest versions)
|
||||
RUN pip install --no-cache-dir \
|
||||
praisonai_tools \
|
||||
"praisonai>=2.2.90" \
|
||||
"praisonai>=2.2.93" \
|
||||
"praisonai[ui]" \
|
||||
"praisonai[chat]" \
|
||||
"praisonai[realtime]" \
|
||||
|
||||
@@ -16,7 +16,7 @@ RUN mkdir -p /root/.praison
|
||||
# Install Python packages (using latest versions)
|
||||
RUN pip install --no-cache-dir \
|
||||
praisonai_tools \
|
||||
"praisonai>=2.2.90" \
|
||||
"praisonai>=2.2.93" \
|
||||
"praisonai[ui]" \
|
||||
"praisonai[crewai]"
|
||||
|
||||
|
||||
+2
-2
@@ -121,7 +121,7 @@ healthcheck:
|
||||
## 📦 Package Versions
|
||||
|
||||
All Docker images use consistent, up-to-date versions:
|
||||
- PraisonAI: `>=2.2.90`
|
||||
- PraisonAI: `>=2.2.93`
|
||||
- PraisonAI Agents: `>=0.0.92`
|
||||
- Python: `3.11-slim`
|
||||
|
||||
@@ -218,7 +218,7 @@ docker-compose up -d
|
||||
### Version Pinning
|
||||
To use specific versions, update the Dockerfile:
|
||||
```dockerfile
|
||||
RUN pip install "praisonai==2.2.90" "praisonaiagents==0.0.92"
|
||||
RUN pip install "praisonai==2.2.93" "praisonaiagents==0.0.92"
|
||||
```
|
||||
|
||||
## 🌐 Production Deployment
|
||||
|
||||
@@ -254,7 +254,17 @@ class DeepResearchAgent:
|
||||
max_wait_time: Maximum seconds to wait for research completion
|
||||
"""
|
||||
self.name = name or "DeepResearchAgent"
|
||||
self.instructions = instructions
|
||||
# Default instructions for comprehensive research
|
||||
default_instructions = """
|
||||
You are a professional research analyst. When conducting research:
|
||||
- Include specific figures, trends, statistics, and measurable outcomes
|
||||
- Prioritize reliable, up-to-date sources: peer-reviewed research, official organizations, regulatory agencies
|
||||
- Include inline citations and return all source metadata
|
||||
- Be analytical, avoid generalities, and ensure data-backed reasoning
|
||||
- Structure your response with clear headers and formatting
|
||||
- If creating comparisons, use tables for clarity
|
||||
"""
|
||||
self.instructions = instructions or default_instructions
|
||||
self.verbose = verbose
|
||||
self.summary_mode = summary_mode
|
||||
self.enable_web_search = enable_web_search
|
||||
@@ -288,7 +298,7 @@ class DeepResearchAgent:
|
||||
self.logger = logging.getLogger(__name__)
|
||||
|
||||
if self.verbose:
|
||||
self.logger.info(f"DeepResearchAgent initialized: provider={self.provider.value}, model={self.model}")
|
||||
self.logger.debug(f"DeepResearchAgent initialized: provider={self.provider.value}, model={self.model}")
|
||||
|
||||
def _detect_provider(
|
||||
self,
|
||||
@@ -766,7 +776,7 @@ class DeepResearchAgent:
|
||||
interaction = self.gemini_client.interactions.create(**create_params)
|
||||
|
||||
if self.verbose:
|
||||
self.logger.info(f"Gemini research started: {interaction.id}")
|
||||
self.logger.debug(f"Gemini research started: {interaction.id}")
|
||||
|
||||
start_time = time.time()
|
||||
while True:
|
||||
@@ -774,7 +784,7 @@ class DeepResearchAgent:
|
||||
|
||||
if interaction.status == "completed":
|
||||
if self.verbose:
|
||||
self.logger.info("Gemini research completed")
|
||||
self.logger.debug("Gemini research completed")
|
||||
break
|
||||
elif interaction.status == "failed":
|
||||
error = getattr(interaction, 'error', 'Unknown error')
|
||||
@@ -789,7 +799,7 @@ class DeepResearchAgent:
|
||||
)
|
||||
|
||||
if self.verbose:
|
||||
self.logger.info(f"Research in progress... ({elapsed:.0f}s)")
|
||||
self.logger.debug(f"Research in progress... ({elapsed:.0f}s)")
|
||||
|
||||
time.sleep(self.poll_interval)
|
||||
|
||||
@@ -1008,7 +1018,7 @@ class DeepResearchAgent:
|
||||
start_time = time.time()
|
||||
|
||||
if self.verbose and not stream:
|
||||
self.logger.info(f"Starting {self.provider.value} deep research: {query[:100]}...")
|
||||
self.logger.debug(f"Starting {self.provider.value} deep research: {query[:100]}...")
|
||||
|
||||
try:
|
||||
if self.provider == Provider.GEMINI:
|
||||
@@ -1049,8 +1059,8 @@ class DeepResearchAgent:
|
||||
|
||||
elapsed = time.time() - start_time
|
||||
if self.verbose:
|
||||
self.logger.info(f"Deep research completed in {elapsed:.1f}s")
|
||||
self.logger.info(f"Report length: {len(result.report)} chars, Citations: {len(result.citations)}")
|
||||
self.logger.debug(f"Deep research completed in {elapsed:.1f}s")
|
||||
self.logger.debug(f"Report length: {len(result.report)} chars, Citations: {len(result.citations)}")
|
||||
|
||||
return result
|
||||
|
||||
@@ -1076,7 +1086,7 @@ class DeepResearchAgent:
|
||||
start_time = time.time()
|
||||
|
||||
if self.verbose:
|
||||
self.logger.info(f"Starting async {self.provider.value} deep research: {query[:100]}...")
|
||||
self.logger.debug(f"Starting async {self.provider.value} deep research: {query[:100]}...")
|
||||
|
||||
try:
|
||||
if self.provider == Provider.GEMINI:
|
||||
@@ -1151,7 +1161,7 @@ class DeepResearchAgent:
|
||||
|
||||
elapsed = time.time() - start_time
|
||||
if self.verbose:
|
||||
self.logger.info(f"Async deep research completed in {elapsed:.1f}s")
|
||||
self.logger.debug(f"Async deep research completed in {elapsed:.1f}s")
|
||||
|
||||
return result
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "praisonaiagents"
|
||||
version = "0.0.163"
|
||||
version = "0.0.165"
|
||||
description = "Praison AI agents for completing complex tasks with Self Reflection Agents"
|
||||
requires-python = ">=3.10"
|
||||
authors = [
|
||||
|
||||
Generated
+1
-1
@@ -2422,7 +2422,7 @@ wheels = [
|
||||
|
||||
[[package]]
|
||||
name = "praisonaiagents"
|
||||
version = "0.0.163"
|
||||
version = "0.0.165"
|
||||
source = { editable = "." }
|
||||
dependencies = [
|
||||
{ name = "aiohttp" },
|
||||
|
||||
@@ -3,8 +3,8 @@ 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/v2.2.90.tar.gz"
|
||||
sha256 `curl -sL https://github.com/MervinPraison/PraisonAI/archive/refs/tags/v2.2.90.tar.gz | shasum -a 256`.split.first
|
||||
url "https://github.com/MervinPraison/PraisonAI/archive/refs/tags/v2.2.93.tar.gz"
|
||||
sha256 `curl -sL https://github.com/MervinPraison/PraisonAI/archive/refs/tags/v2.2.93.tar.gz | shasum -a 256`.split.first
|
||||
license "MIT"
|
||||
|
||||
depends_on "[email protected]"
|
||||
|
||||
@@ -28,6 +28,13 @@ AUTOGEN_AVAILABLE = False
|
||||
PRAISONAI_AVAILABLE = False
|
||||
TRAIN_AVAILABLE = False
|
||||
try:
|
||||
import importlib.util
|
||||
CHAINLIT_AVAILABLE = importlib.util.find_spec("chainlit") is not None
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
def _get_chainlit_run():
|
||||
"""Lazy import chainlit to avoid loading .env at startup"""
|
||||
# Create necessary directories and set CHAINLIT_APP_ROOT
|
||||
if "CHAINLIT_APP_ROOT" not in os.environ:
|
||||
chainlit_root = os.path.join(os.path.expanduser("~"), ".praison")
|
||||
@@ -39,9 +46,7 @@ try:
|
||||
os.makedirs(os.path.join(chainlit_root, ".files"), exist_ok=True)
|
||||
|
||||
from chainlit.cli import chainlit_run
|
||||
CHAINLIT_AVAILABLE = True
|
||||
except ImportError:
|
||||
pass
|
||||
return chainlit_run
|
||||
|
||||
try:
|
||||
import gradio as gr
|
||||
@@ -573,6 +578,7 @@ class PraisonAI:
|
||||
parser.add_argument("--goal", type=str, help="Goal for context engineering")
|
||||
parser.add_argument("--auto-analyze", action="store_true", help="Enable automatic analysis in context engineering")
|
||||
parser.add_argument("--research", action="store_true", help="Run deep research on a topic")
|
||||
parser.add_argument("--save", "-s", action="store_true", help="Save research output to file (output/research/)")
|
||||
parser.add_argument("--verbose", "-v", action="store_true", help="Enable verbose output for research")
|
||||
|
||||
# If we're in a test environment, parse with empty args to avoid pytest interference
|
||||
@@ -714,7 +720,8 @@ class PraisonAI:
|
||||
|
||||
research_model = getattr(args, 'model', None)
|
||||
verbose = getattr(args, 'verbose', False)
|
||||
self.handle_research_command(research_query, research_model, verbose)
|
||||
save = getattr(args, 'save', False)
|
||||
self.handle_research_command(research_query, research_model, verbose, save)
|
||||
sys.exit(0)
|
||||
|
||||
# Only check framework availability for agent-related operations
|
||||
@@ -812,7 +819,7 @@ class PraisonAI:
|
||||
if "CHAINLIT_APP_ROOT" not in os.environ:
|
||||
os.environ["CHAINLIT_APP_ROOT"] = root_path
|
||||
chat_ui_path = os.path.join(os.path.dirname(praisonai.__file__), 'ui', 'chat.py')
|
||||
chainlit_run([chat_ui_path])
|
||||
_get_chainlit_run()([chat_ui_path])
|
||||
else:
|
||||
print("ERROR: Chat UI is not installed. Please install it with 'pip install \"praisonai[chat]\"' to use the chat UI.")
|
||||
|
||||
@@ -836,7 +843,7 @@ class PraisonAI:
|
||||
else:
|
||||
logging.info("Public folder already exists.")
|
||||
code_ui_path = os.path.join(os.path.dirname(praisonai.__file__), 'ui', 'code.py')
|
||||
chainlit_run([code_ui_path])
|
||||
_get_chainlit_run()([code_ui_path])
|
||||
else:
|
||||
print("ERROR: Code UI is not installed. Please install it with 'pip install \"praisonai[code]\"' to use the code UI.")
|
||||
|
||||
@@ -882,7 +889,7 @@ class PraisonAI:
|
||||
else:
|
||||
logging.info("Public folder already exists.")
|
||||
chainlit_ui_path = os.path.join(os.path.dirname(praisonai.__file__), 'ui', 'agents.py')
|
||||
chainlit_run([chainlit_ui_path])
|
||||
_get_chainlit_run()([chainlit_ui_path])
|
||||
else:
|
||||
print("ERROR: Chainlit is not installed. Please install it with 'pip install \"praisonai[ui]\"' to use the UI.")
|
||||
|
||||
@@ -906,7 +913,7 @@ class PraisonAI:
|
||||
else:
|
||||
logging.info("Public folder already exists.")
|
||||
realtime_ui_path = os.path.join(os.path.dirname(praisonai.__file__), 'ui', 'realtime.py')
|
||||
chainlit_run([realtime_ui_path])
|
||||
_get_chainlit_run()([realtime_ui_path])
|
||||
else:
|
||||
print("ERROR: Realtime UI is not installed. Please install it with 'pip install \"praisonai[realtime]\"' to use the realtime UI.")
|
||||
|
||||
@@ -954,7 +961,7 @@ class PraisonAI:
|
||||
print(f"[red]ERROR: Context engineering failed: {e}[/red]")
|
||||
sys.exit(1)
|
||||
|
||||
def handle_research_command(self, query: str, model: str = None, verbose: bool = False) -> str:
|
||||
def handle_research_command(self, query: str, model: str = None, verbose: bool = False, save: bool = False) -> str:
|
||||
"""
|
||||
Handle the research command by creating a DeepResearchAgent and running it.
|
||||
|
||||
@@ -962,6 +969,7 @@ class PraisonAI:
|
||||
query: Research query/topic
|
||||
model: Model for deep research (optional, defaults to o4-mini-deep-research)
|
||||
verbose: Enable verbose output (default: False)
|
||||
save: Save output to file (default: False)
|
||||
|
||||
Returns:
|
||||
str: Research report
|
||||
@@ -985,13 +993,10 @@ class PraisonAI:
|
||||
|
||||
print(f"Model: {model}")
|
||||
|
||||
# Create DeepResearchAgent
|
||||
agent = DeepResearchAgent(
|
||||
model=model,
|
||||
verbose=verbose
|
||||
)
|
||||
# Create DeepResearchAgent (verbose=True is default for streaming output)
|
||||
agent = DeepResearchAgent(model=model)
|
||||
|
||||
# Execute the research (streaming is enabled by default)
|
||||
# Execute the research
|
||||
result = agent.research(query)
|
||||
|
||||
print("\n[bold green]Research Complete![/bold green]")
|
||||
@@ -1009,6 +1014,42 @@ class PraisonAI:
|
||||
if url:
|
||||
print(f" {url}")
|
||||
|
||||
# Save output to file if --save flag is set
|
||||
if save:
|
||||
import re
|
||||
# Get first 10 words from query for filename
|
||||
words = query.split()[:10]
|
||||
filename_base = ' '.join(words)
|
||||
# Sanitize filename: remove invalid characters
|
||||
filename_base = re.sub(r'[<>:"/\\|?*\x00-\x1f]', '', filename_base)
|
||||
filename_base = filename_base.strip()[:100] # Limit length
|
||||
if not filename_base:
|
||||
filename_base = "research_output"
|
||||
|
||||
# Create output directory
|
||||
output_dir = os.path.join(os.getcwd(), "output", "research")
|
||||
os.makedirs(output_dir, exist_ok=True)
|
||||
|
||||
# Build markdown content
|
||||
md_content = f"# {query}\n\n"
|
||||
md_content += result.report
|
||||
if result.citations:
|
||||
md_content += "\n\n## Citations\n\n"
|
||||
for i, citation in enumerate(result.citations, 1):
|
||||
title = getattr(citation, 'title', 'Untitled')
|
||||
url = getattr(citation, 'url', '')
|
||||
if url:
|
||||
md_content += f"{i}. [{title}]({url})\n"
|
||||
else:
|
||||
md_content += f"{i}. {title}\n"
|
||||
|
||||
# Save to file
|
||||
output_path = os.path.join(output_dir, f"{filename_base}.md")
|
||||
with open(output_path, 'w', encoding='utf-8') as f:
|
||||
f.write(md_content)
|
||||
|
||||
print(f"\n[bold green]Saved to:[/bold green] {output_path}")
|
||||
|
||||
return result.report
|
||||
|
||||
except ImportError as e:
|
||||
|
||||
@@ -57,7 +57,7 @@ class CloudDeployer:
|
||||
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.2.90 gunicorn markdown\n")
|
||||
file.write("RUN pip install flask praisonai==2.2.93 gunicorn markdown\n")
|
||||
file.write("EXPOSE 8080\n")
|
||||
file.write('CMD ["gunicorn", "-b", "0.0.0.0:8080", "api:app"]\n')
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "PraisonAI"
|
||||
version = "2.2.90"
|
||||
version = "2.2.93"
|
||||
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 = ""
|
||||
@@ -12,7 +12,7 @@ dependencies = [
|
||||
"rich>=13.7",
|
||||
"markdown>=3.5",
|
||||
"pyparsing>=3.0.0",
|
||||
"praisonaiagents>=0.0.163",
|
||||
"praisonaiagents>=0.0.165",
|
||||
"python-dotenv>=0.19.0",
|
||||
"instructor>=1.3.3",
|
||||
"PyYAML>=6.0",
|
||||
@@ -102,7 +102,7 @@ autogen-v4 = [
|
||||
|
||||
[tool.poetry]
|
||||
name = "PraisonAI"
|
||||
version = "2.2.90"
|
||||
version = "2.2.93"
|
||||
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 = ""
|
||||
@@ -120,7 +120,7 @@ python = ">=3.10,<3.13"
|
||||
rich = ">=13.7"
|
||||
markdown = ">=3.5"
|
||||
pyparsing = ">=3.0.0"
|
||||
praisonaiagents = ">=0.0.163"
|
||||
praisonaiagents = ">=0.0.165"
|
||||
python-dotenv = ">=0.19.0"
|
||||
instructor = ">=1.3.3"
|
||||
PyYAML = ">=6.0"
|
||||
|
||||
Generated
+5
-5
@@ -4044,7 +4044,7 @@ wheels = [
|
||||
|
||||
[[package]]
|
||||
name = "praisonai"
|
||||
version = "2.2.90"
|
||||
version = "2.2.93"
|
||||
source = { editable = "." }
|
||||
dependencies = [
|
||||
{ name = "instructor" },
|
||||
@@ -4198,7 +4198,7 @@ requires-dist = [
|
||||
{ name = "praisonai-tools", marker = "extra == 'autogen'", specifier = ">=0.0.22" },
|
||||
{ name = "praisonai-tools", marker = "extra == 'autogen-v4'", specifier = ">=0.0.22" },
|
||||
{ name = "praisonai-tools", marker = "extra == 'crewai'", specifier = ">=0.0.22" },
|
||||
{ name = "praisonaiagents", specifier = ">=0.0.163" },
|
||||
{ name = "praisonaiagents", specifier = ">=0.0.165" },
|
||||
{ name = "pyautogen", marker = "extra == 'autogen'", specifier = "==0.2.29" },
|
||||
{ name = "pydantic", marker = "extra == 'chat'", specifier = "<=2.10.1" },
|
||||
{ name = "pydantic", marker = "extra == 'code'", specifier = "<=2.10.1" },
|
||||
@@ -4253,7 +4253,7 @@ wheels = [
|
||||
|
||||
[[package]]
|
||||
name = "praisonaiagents"
|
||||
version = "0.0.163"
|
||||
version = "0.0.165"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "aiohttp" },
|
||||
@@ -4262,9 +4262,9 @@ dependencies = [
|
||||
{ name = "pydantic" },
|
||||
{ name = "rich" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/33/6d/68553b1c16f82ab9d0f4466227df65990103d89428aa49963253b85ed877/praisonaiagents-0.0.163.tar.gz", hash = "sha256:f1dded526613e353d10ea0ee7158d2e544efa06aae289d3b84efe7f03275883b", size = 298039, upload-time = "2025-12-13T01:13:18.845Z" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/c3/49/37f8518b2205760cec66ac44482c1cb9e33c0cb568c4c6cb07f9908dceb3/praisonaiagents-0.0.165.tar.gz", hash = "sha256:b2a43a44d51454f9917a2345407bf86fdc46046bafac96601c98d1d21fb2601a", size = 298269, upload-time = "2025-12-13T02:18:34.883Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/d8/21/2e2f9719dcf31c99474c1b61a62be78c79cdfde0abd40b5d100419515279/praisonaiagents-0.0.163-py3-none-any.whl", hash = "sha256:518c46a618b609af4718c2c77779c75494bc4751f97ebb52864c490483cc2240", size = 315110, upload-time = "2025-12-13T01:13:17.363Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/26/e7/c3b21f4c68629612ab4e4d128fca5fdabe141df16b0861679e2736adebe7/praisonaiagents-0.0.165-py3-none-any.whl", hash = "sha256:65b880f6d4c5d05fadf86153338306e12004316da9dc9f83942b9e16f2133851", size = 315370, upload-time = "2025-12-13T02:18:33.197Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
Reference in new issue
Block a user