PraisonAI 2.2.95__tar.gz → 2.2.97__tar.gz

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.
Files changed (56) hide show
  1. {praisonai-2.2.95 → praisonai-2.2.97}/PKG-INFO +12 -2
  2. {praisonai-2.2.95 → praisonai-2.2.97}/PraisonAI.egg-info/PKG-INFO +12 -2
  3. {praisonai-2.2.95 → praisonai-2.2.97}/PraisonAI.egg-info/requires.txt +1 -1
  4. {praisonai-2.2.95 → praisonai-2.2.97}/README.md +10 -0
  5. {praisonai-2.2.95 → praisonai-2.2.97}/praisonai/cli.py +104 -19
  6. {praisonai-2.2.95 → praisonai-2.2.97}/praisonai/deploy.py +1 -1
  7. praisonai-2.2.97/praisonai/version.py +1 -0
  8. {praisonai-2.2.95 → praisonai-2.2.97}/pyproject.toml +1 -1
  9. praisonai-2.2.95/praisonai/version.py +0 -1
  10. {praisonai-2.2.95 → praisonai-2.2.97}/PraisonAI.egg-info/SOURCES.txt +0 -0
  11. {praisonai-2.2.95 → praisonai-2.2.97}/PraisonAI.egg-info/dependency_links.txt +0 -0
  12. {praisonai-2.2.95 → praisonai-2.2.97}/PraisonAI.egg-info/entry_points.txt +0 -0
  13. {praisonai-2.2.95 → praisonai-2.2.97}/PraisonAI.egg-info/top_level.txt +0 -0
  14. {praisonai-2.2.95 → praisonai-2.2.97}/praisonai/__init__.py +0 -0
  15. {praisonai-2.2.95 → praisonai-2.2.97}/praisonai/__main__.py +0 -0
  16. {praisonai-2.2.95 → praisonai-2.2.97}/praisonai/agents_generator.py +0 -0
  17. {praisonai-2.2.95 → praisonai-2.2.97}/praisonai/api/call.py +0 -0
  18. {praisonai-2.2.95 → praisonai-2.2.97}/praisonai/auto.py +0 -0
  19. {praisonai-2.2.95 → praisonai-2.2.97}/praisonai/chainlit_ui.py +0 -0
  20. {praisonai-2.2.95 → praisonai-2.2.97}/praisonai/inbuilt_tools/__init__.py +0 -0
  21. {praisonai-2.2.95 → praisonai-2.2.97}/praisonai/inbuilt_tools/autogen_tools.py +0 -0
  22. {praisonai-2.2.95 → praisonai-2.2.97}/praisonai/inc/__init__.py +0 -0
  23. {praisonai-2.2.95 → praisonai-2.2.97}/praisonai/inc/config.py +0 -0
  24. {praisonai-2.2.95 → praisonai-2.2.97}/praisonai/inc/models.py +0 -0
  25. {praisonai-2.2.95 → praisonai-2.2.97}/praisonai/scheduler.py +0 -0
  26. {praisonai-2.2.95 → praisonai-2.2.97}/praisonai/setup/__init__.py +0 -0
  27. {praisonai-2.2.95 → praisonai-2.2.97}/praisonai/setup/build.py +0 -0
  28. {praisonai-2.2.95 → praisonai-2.2.97}/praisonai/setup/post_install.py +0 -0
  29. {praisonai-2.2.95 → praisonai-2.2.97}/praisonai/setup/setup_conda_env.py +0 -0
  30. {praisonai-2.2.95 → praisonai-2.2.97}/praisonai/setup.py +0 -0
  31. {praisonai-2.2.95 → praisonai-2.2.97}/praisonai/test.py +0 -0
  32. {praisonai-2.2.95 → praisonai-2.2.97}/praisonai/train.py +0 -0
  33. {praisonai-2.2.95 → praisonai-2.2.97}/praisonai/train_vision.py +0 -0
  34. {praisonai-2.2.95 → praisonai-2.2.97}/praisonai/ui/agents.py +0 -0
  35. {praisonai-2.2.95 → praisonai-2.2.97}/praisonai/ui/callbacks.py +0 -0
  36. {praisonai-2.2.95 → praisonai-2.2.97}/praisonai/ui/chat.py +0 -0
  37. {praisonai-2.2.95 → praisonai-2.2.97}/praisonai/ui/code.py +0 -0
  38. {praisonai-2.2.95 → praisonai-2.2.97}/praisonai/ui/colab.py +0 -0
  39. {praisonai-2.2.95 → praisonai-2.2.97}/praisonai/ui/colab_chainlit.py +0 -0
  40. {praisonai-2.2.95 → praisonai-2.2.97}/praisonai/ui/components/aicoder.py +0 -0
  41. {praisonai-2.2.95 → praisonai-2.2.97}/praisonai/ui/context.py +0 -0
  42. {praisonai-2.2.95 → praisonai-2.2.97}/praisonai/ui/database_config.py +0 -0
  43. {praisonai-2.2.95 → praisonai-2.2.97}/praisonai/ui/db.py +0 -0
  44. {praisonai-2.2.95 → praisonai-2.2.97}/praisonai/ui/realtime.py +0 -0
  45. {praisonai-2.2.95 → praisonai-2.2.97}/praisonai/ui/realtimeclient/__init__.py +0 -0
  46. {praisonai-2.2.95 → praisonai-2.2.97}/praisonai/ui/realtimeclient/tools.py +0 -0
  47. {praisonai-2.2.95 → praisonai-2.2.97}/praisonai/ui/sql_alchemy.py +0 -0
  48. {praisonai-2.2.95 → praisonai-2.2.97}/praisonai/upload_vision.py +0 -0
  49. {praisonai-2.2.95 → praisonai-2.2.97}/setup.cfg +0 -0
  50. {praisonai-2.2.95 → praisonai-2.2.97}/tests/test.py +0 -0
  51. {praisonai-2.2.95 → praisonai-2.2.97}/tests/test_agents_playbook.py +0 -0
  52. {praisonai-2.2.95 → praisonai-2.2.97}/tests/test_basic.py +0 -0
  53. {praisonai-2.2.95 → praisonai-2.2.97}/tests/test_custom_tools_fix.py +0 -0
  54. {praisonai-2.2.95 → praisonai-2.2.97}/tests/test_double_api_fix.py +0 -0
  55. {praisonai-2.2.95 → praisonai-2.2.97}/tests/test_phase2_refactor.py +0 -0
  56. {praisonai-2.2.95 → praisonai-2.2.97}/tests/test_runner.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PraisonAI
3
- Version: 2.2.95
3
+ Version: 2.2.97
4
4
  Summary: 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.
5
5
  Author: Mervin Praison
6
6
  License: MIT
@@ -11,7 +11,7 @@ Description-Content-Type: text/markdown
11
11
  Requires-Dist: rich>=13.7
12
12
  Requires-Dist: markdown>=3.5
13
13
  Requires-Dist: pyparsing>=3.0.0
14
- Requires-Dist: praisonaiagents>=0.0.166
14
+ Requires-Dist: praisonaiagents>=0.0.168
15
15
  Requires-Dist: python-dotenv>=0.19.0
16
16
  Requires-Dist: instructor>=1.3.3
17
17
  Requires-Dist: PyYAML>=6.0
@@ -119,3 +119,13 @@ python src/praisonai/scripts/bump_version.py 2.2.96
119
119
  # With praisonaiagents dependency
120
120
  python src/praisonai/scripts/bump_version.py 2.2.96 --agents 0.0.167
121
121
  ```
122
+
123
+ ## Release
124
+
125
+ ```bash
126
+ # From project root (runs uv lock, build, git tag, gh release)
127
+ python src/praisonai/scripts/release.py
128
+
129
+ # Then publish
130
+ cd src/praisonai && uv publish
131
+ ```
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PraisonAI
3
- Version: 2.2.95
3
+ Version: 2.2.97
4
4
  Summary: 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.
5
5
  Author: Mervin Praison
6
6
  License: MIT
@@ -11,7 +11,7 @@ Description-Content-Type: text/markdown
11
11
  Requires-Dist: rich>=13.7
12
12
  Requires-Dist: markdown>=3.5
13
13
  Requires-Dist: pyparsing>=3.0.0
14
- Requires-Dist: praisonaiagents>=0.0.166
14
+ Requires-Dist: praisonaiagents>=0.0.168
15
15
  Requires-Dist: python-dotenv>=0.19.0
16
16
  Requires-Dist: instructor>=1.3.3
17
17
  Requires-Dist: PyYAML>=6.0
@@ -119,3 +119,13 @@ python src/praisonai/scripts/bump_version.py 2.2.96
119
119
  # With praisonaiagents dependency
120
120
  python src/praisonai/scripts/bump_version.py 2.2.96 --agents 0.0.167
121
121
  ```
122
+
123
+ ## Release
124
+
125
+ ```bash
126
+ # From project root (runs uv lock, build, git tag, gh release)
127
+ python src/praisonai/scripts/release.py
128
+
129
+ # Then publish
130
+ cd src/praisonai && uv publish
131
+ ```
@@ -1,7 +1,7 @@
1
1
  rich>=13.7
2
2
  markdown>=3.5
3
3
  pyparsing>=3.0.0
4
- praisonaiagents>=0.0.166
4
+ praisonaiagents>=0.0.168
5
5
  python-dotenv>=0.19.0
6
6
  instructor>=1.3.3
7
7
  PyYAML>=6.0
@@ -22,3 +22,13 @@ python src/praisonai/scripts/bump_version.py 2.2.96
22
22
  # With praisonaiagents dependency
23
23
  python src/praisonai/scripts/bump_version.py 2.2.96 --agents 0.0.167
24
24
  ```
25
+
26
+ ## Release
27
+
28
+ ```bash
29
+ # From project root (runs uv lock, build, git tag, gh release)
30
+ python src/praisonai/scripts/release.py
31
+
32
+ # Then publish
33
+ cd src/praisonai && uv publish
34
+ ```
@@ -514,9 +514,8 @@ class PraisonAI:
514
514
  in_test_env = (
515
515
  'pytest' in sys.argv[0] or
516
516
  'unittest' in sys.argv[0] or
517
- any('test' in arg for arg in sys.argv[1:3]) or # Check first few args for test indicators
518
- 'pytest' in sys.modules or
519
- 'unittest' in sys.modules
517
+ any(arg.startswith('tests.') or arg.startswith('tests/') for arg in sys.argv[1:3]) or # Check for test module paths
518
+ 'PYTEST_CURRENT_TEST' in os.environ
520
519
  )
521
520
 
522
521
  # Check if we're being used as a library (not from praisonai CLI)
@@ -578,7 +577,8 @@ class PraisonAI:
578
577
  parser.add_argument("--goal", type=str, help="Goal for context engineering")
579
578
  parser.add_argument("--auto-analyze", action="store_true", help="Enable automatic analysis in context engineering")
580
579
  parser.add_argument("--research", action="store_true", help="Run deep research on a topic")
581
- parser.add_argument("--query-rewrite", action="store_true", help="Rewrite query before research for better results")
580
+ parser.add_argument("--query-rewrite", action="store_true", help="Rewrite query for better results (works with any command)")
581
+ parser.add_argument("--rewrite-tools", type=str, help="Tools for query rewriter (e.g., 'internet_search' or path to tools.py)")
582
582
  parser.add_argument("--tools", "-t", type=str, help="Path to tools.py file for research agent")
583
583
  parser.add_argument("--save", "-s", action="store_true", help="Save research output to file (output/research/)")
584
584
  parser.add_argument("--verbose", "-v", action="store_true", help="Enable verbose output for research")
@@ -724,8 +724,9 @@ class PraisonAI:
724
724
  verbose = getattr(args, 'verbose', False)
725
725
  save = getattr(args, 'save', False)
726
726
  query_rewrite = getattr(args, 'query_rewrite', False)
727
+ rewrite_tools = getattr(args, 'rewrite_tools', None)
727
728
  tools_path = getattr(args, 'tools', None)
728
- self.handle_research_command(research_query, research_model, verbose, save, query_rewrite, tools_path)
729
+ self.handle_research_command(research_query, research_model, verbose, save, query_rewrite, tools_path, rewrite_tools)
729
730
  sys.exit(0)
730
731
 
731
732
  # Only check framework availability for agent-related operations
@@ -746,10 +747,105 @@ class PraisonAI:
746
747
 
747
748
  return args
748
749
 
750
+ def _rewrite_query(self, query: str, rewrite_tools: str = None, verbose: bool = False) -> str:
751
+ """
752
+ Rewrite query using QueryRewriterAgent.
753
+
754
+ Args:
755
+ query: The query to rewrite
756
+ rewrite_tools: Tool names (comma-separated) or path to tools.py
757
+ verbose: Enable verbose output
758
+
759
+ Returns:
760
+ Rewritten query or original if rewriting fails
761
+ """
762
+ try:
763
+ from praisonaiagents import QueryRewriterAgent, RewriteStrategy
764
+ from rich import print
765
+
766
+ print("[bold cyan]Rewriting query for better results...[/bold cyan]")
767
+
768
+ # Load rewrite tools if specified
769
+ rewrite_tools_list = []
770
+ if rewrite_tools:
771
+ if os.path.isfile(rewrite_tools):
772
+ # Load from file
773
+ try:
774
+ import inspect
775
+ import importlib.util
776
+ spec = importlib.util.spec_from_file_location("rewrite_tools_module", rewrite_tools)
777
+ if spec and spec.loader:
778
+ module = importlib.util.module_from_spec(spec)
779
+ spec.loader.exec_module(module)
780
+ for name, obj in inspect.getmembers(module):
781
+ if inspect.isfunction(obj) and not name.startswith('_'):
782
+ rewrite_tools_list.append(obj)
783
+ if rewrite_tools_list:
784
+ print(f"[cyan]Loaded {len(rewrite_tools_list)} tools for query rewriter[/cyan]")
785
+ except Exception as e:
786
+ print(f"[yellow]Warning: Failed to load rewrite tools: {e}[/yellow]")
787
+ else:
788
+ # Treat as comma-separated tool names
789
+ try:
790
+ from praisonaiagents.tools import TOOL_MAPPINGS
791
+ import praisonaiagents.tools as tools_module
792
+
793
+ tool_names = [t.strip() for t in rewrite_tools.split(',')]
794
+ for tool_name in tool_names:
795
+ if tool_name in TOOL_MAPPINGS:
796
+ try:
797
+ tool = getattr(tools_module, tool_name)
798
+ rewrite_tools_list.append(tool)
799
+ except Exception as e:
800
+ print(f"[yellow]Warning: Failed to load rewrite tool '{tool_name}': {e}[/yellow]")
801
+ else:
802
+ print(f"[yellow]Warning: Unknown rewrite tool '{tool_name}'[/yellow]")
803
+ if rewrite_tools_list:
804
+ print(f"[cyan]Using rewrite tools: {', '.join(tool_names)}[/cyan]")
805
+ except ImportError:
806
+ print("[yellow]Warning: Could not import tools module[/yellow]")
807
+
808
+ rewriter = QueryRewriterAgent(
809
+ model="gpt-4o-mini",
810
+ verbose=verbose,
811
+ tools=rewrite_tools_list if rewrite_tools_list else None
812
+ )
813
+ result = rewriter.rewrite(query, strategy=RewriteStrategy.AUTO)
814
+ rewritten = result.primary_query
815
+
816
+ print(f"[cyan]Original:[/cyan] {query}")
817
+ print(f"[cyan]Rewritten:[/cyan] {rewritten}")
818
+
819
+ return rewritten
820
+
821
+ except ImportError:
822
+ from rich import print
823
+ print("[yellow]Warning: QueryRewriterAgent not available, using original query[/yellow]")
824
+ return query
825
+ except Exception as e:
826
+ from rich import print
827
+ print(f"[yellow]Warning: Query rewrite failed ({e}), using original query[/yellow]")
828
+ return query
829
+
830
+ def _rewrite_query_if_enabled(self, query: str) -> str:
831
+ """
832
+ Rewrite query using QueryRewriterAgent if --query-rewrite is enabled.
833
+ Returns the rewritten query or original if rewriting is disabled/fails.
834
+ """
835
+ if not hasattr(self, 'args') or not getattr(self.args, 'query_rewrite', False):
836
+ return query
837
+
838
+ rewrite_tools = getattr(self.args, 'rewrite_tools', None)
839
+ verbose = getattr(self.args, 'verbose', False)
840
+ return self._rewrite_query(query, rewrite_tools, verbose)
841
+
749
842
  def handle_direct_prompt(self, prompt):
750
843
  """
751
844
  Handle direct prompt by creating a single agent and running it.
752
845
  """
846
+ # Apply query rewriting if enabled
847
+ prompt = self._rewrite_query_if_enabled(prompt)
848
+
753
849
  if PRAISONAI_AVAILABLE:
754
850
  agent_config = {
755
851
  "name": "DirectAgent",
@@ -965,7 +1061,7 @@ class PraisonAI:
965
1061
  print(f"[red]ERROR: Context engineering failed: {e}[/red]")
966
1062
  sys.exit(1)
967
1063
 
968
- def handle_research_command(self, query: str, model: str = None, verbose: bool = False, save: bool = False, query_rewrite: bool = False, tools_path: str = None) -> str:
1064
+ def handle_research_command(self, query: str, model: str = None, verbose: bool = False, save: bool = False, query_rewrite: bool = False, tools_path: str = None, rewrite_tools: str = None) -> str:
969
1065
  """
970
1066
  Handle the research command by creating a DeepResearchAgent and running it.
971
1067
 
@@ -976,6 +1072,7 @@ class PraisonAI:
976
1072
  save: Save output to file (default: False)
977
1073
  query_rewrite: Rewrite query before research (default: False)
978
1074
  tools_path: Path to tools.py file with custom tools (default: None)
1075
+ rewrite_tools: Tools for query rewriter (tool names or file path)
979
1076
 
980
1077
  Returns:
981
1078
  str: Research report
@@ -991,20 +1088,8 @@ class PraisonAI:
991
1088
  logging.getLogger('httpcore').setLevel(logging.WARNING)
992
1089
 
993
1090
  # Rewrite query if requested
994
- original_query = query
995
1091
  if query_rewrite:
996
- try:
997
- from praisonaiagents import QueryRewriterAgent, RewriteStrategy
998
- print("[bold cyan]Rewriting query for better research results...[/bold cyan]")
999
- rewriter = QueryRewriterAgent(model="gpt-4o-mini", verbose=False)
1000
- result = rewriter.rewrite(query, strategy=RewriteStrategy.AUTO)
1001
- query = result.primary_query
1002
- print(f"[cyan]Original:[/cyan] {original_query}")
1003
- print(f"[cyan]Rewritten:[/cyan] {query}")
1004
- except ImportError:
1005
- print("[yellow]Warning: QueryRewriterAgent not available, using original query[/yellow]")
1006
- except Exception as e:
1007
- print(f"[yellow]Warning: Query rewrite failed ({e}), using original query[/yellow]")
1092
+ query = self._rewrite_query(query, rewrite_tools, verbose)
1008
1093
 
1009
1094
  print("[bold green]Starting Deep Research...[/bold green]")
1010
1095
  print(f"Query: {query}")
@@ -57,7 +57,7 @@ class CloudDeployer:
57
57
  file.write("FROM python:3.11-slim\n")
58
58
  file.write("WORKDIR /app\n")
59
59
  file.write("COPY . .\n")
60
- file.write("RUN pip install flask praisonai==2.2.95 gunicorn markdown\n")
60
+ file.write("RUN pip install flask praisonai==2.2.97 gunicorn markdown\n")
61
61
  file.write("EXPOSE 8080\n")
62
62
  file.write('CMD ["gunicorn", "-b", "0.0.0.0:8080", "api:app"]\n')
63
63
 
@@ -0,0 +1 @@
1
+ __version__ = "2.2.97"
@@ -12,7 +12,7 @@ dependencies = [
12
12
  "rich>=13.7",
13
13
  "markdown>=3.5",
14
14
  "pyparsing>=3.0.0",
15
- "praisonaiagents>=0.0.166",
15
+ "praisonaiagents>=0.0.168",
16
16
  "python-dotenv>=0.19.0",
17
17
  "instructor>=1.3.3",
18
18
  "PyYAML>=6.0",
@@ -1 +0,0 @@
1
- __version__ = "2.2.95"
File without changes
File without changes
File without changes
File without changes