PraisonAI 2.2.96__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.96 → praisonai-2.2.97}/PKG-INFO +2 -2
  2. {praisonai-2.2.96 → praisonai-2.2.97}/PraisonAI.egg-info/PKG-INFO +2 -2
  3. {praisonai-2.2.96 → praisonai-2.2.97}/PraisonAI.egg-info/requires.txt +1 -1
  4. {praisonai-2.2.96 → praisonai-2.2.97}/praisonai/cli.py +99 -57
  5. {praisonai-2.2.96 → praisonai-2.2.97}/praisonai/deploy.py +1 -1
  6. praisonai-2.2.97/praisonai/version.py +1 -0
  7. {praisonai-2.2.96 → praisonai-2.2.97}/pyproject.toml +1 -1
  8. praisonai-2.2.96/praisonai/version.py +0 -1
  9. {praisonai-2.2.96 → praisonai-2.2.97}/PraisonAI.egg-info/SOURCES.txt +0 -0
  10. {praisonai-2.2.96 → praisonai-2.2.97}/PraisonAI.egg-info/dependency_links.txt +0 -0
  11. {praisonai-2.2.96 → praisonai-2.2.97}/PraisonAI.egg-info/entry_points.txt +0 -0
  12. {praisonai-2.2.96 → praisonai-2.2.97}/PraisonAI.egg-info/top_level.txt +0 -0
  13. {praisonai-2.2.96 → praisonai-2.2.97}/README.md +0 -0
  14. {praisonai-2.2.96 → praisonai-2.2.97}/praisonai/__init__.py +0 -0
  15. {praisonai-2.2.96 → praisonai-2.2.97}/praisonai/__main__.py +0 -0
  16. {praisonai-2.2.96 → praisonai-2.2.97}/praisonai/agents_generator.py +0 -0
  17. {praisonai-2.2.96 → praisonai-2.2.97}/praisonai/api/call.py +0 -0
  18. {praisonai-2.2.96 → praisonai-2.2.97}/praisonai/auto.py +0 -0
  19. {praisonai-2.2.96 → praisonai-2.2.97}/praisonai/chainlit_ui.py +0 -0
  20. {praisonai-2.2.96 → praisonai-2.2.97}/praisonai/inbuilt_tools/__init__.py +0 -0
  21. {praisonai-2.2.96 → praisonai-2.2.97}/praisonai/inbuilt_tools/autogen_tools.py +0 -0
  22. {praisonai-2.2.96 → praisonai-2.2.97}/praisonai/inc/__init__.py +0 -0
  23. {praisonai-2.2.96 → praisonai-2.2.97}/praisonai/inc/config.py +0 -0
  24. {praisonai-2.2.96 → praisonai-2.2.97}/praisonai/inc/models.py +0 -0
  25. {praisonai-2.2.96 → praisonai-2.2.97}/praisonai/scheduler.py +0 -0
  26. {praisonai-2.2.96 → praisonai-2.2.97}/praisonai/setup/__init__.py +0 -0
  27. {praisonai-2.2.96 → praisonai-2.2.97}/praisonai/setup/build.py +0 -0
  28. {praisonai-2.2.96 → praisonai-2.2.97}/praisonai/setup/post_install.py +0 -0
  29. {praisonai-2.2.96 → praisonai-2.2.97}/praisonai/setup/setup_conda_env.py +0 -0
  30. {praisonai-2.2.96 → praisonai-2.2.97}/praisonai/setup.py +0 -0
  31. {praisonai-2.2.96 → praisonai-2.2.97}/praisonai/test.py +0 -0
  32. {praisonai-2.2.96 → praisonai-2.2.97}/praisonai/train.py +0 -0
  33. {praisonai-2.2.96 → praisonai-2.2.97}/praisonai/train_vision.py +0 -0
  34. {praisonai-2.2.96 → praisonai-2.2.97}/praisonai/ui/agents.py +0 -0
  35. {praisonai-2.2.96 → praisonai-2.2.97}/praisonai/ui/callbacks.py +0 -0
  36. {praisonai-2.2.96 → praisonai-2.2.97}/praisonai/ui/chat.py +0 -0
  37. {praisonai-2.2.96 → praisonai-2.2.97}/praisonai/ui/code.py +0 -0
  38. {praisonai-2.2.96 → praisonai-2.2.97}/praisonai/ui/colab.py +0 -0
  39. {praisonai-2.2.96 → praisonai-2.2.97}/praisonai/ui/colab_chainlit.py +0 -0
  40. {praisonai-2.2.96 → praisonai-2.2.97}/praisonai/ui/components/aicoder.py +0 -0
  41. {praisonai-2.2.96 → praisonai-2.2.97}/praisonai/ui/context.py +0 -0
  42. {praisonai-2.2.96 → praisonai-2.2.97}/praisonai/ui/database_config.py +0 -0
  43. {praisonai-2.2.96 → praisonai-2.2.97}/praisonai/ui/db.py +0 -0
  44. {praisonai-2.2.96 → praisonai-2.2.97}/praisonai/ui/realtime.py +0 -0
  45. {praisonai-2.2.96 → praisonai-2.2.97}/praisonai/ui/realtimeclient/__init__.py +0 -0
  46. {praisonai-2.2.96 → praisonai-2.2.97}/praisonai/ui/realtimeclient/tools.py +0 -0
  47. {praisonai-2.2.96 → praisonai-2.2.97}/praisonai/ui/sql_alchemy.py +0 -0
  48. {praisonai-2.2.96 → praisonai-2.2.97}/praisonai/upload_vision.py +0 -0
  49. {praisonai-2.2.96 → praisonai-2.2.97}/setup.cfg +0 -0
  50. {praisonai-2.2.96 → praisonai-2.2.97}/tests/test.py +0 -0
  51. {praisonai-2.2.96 → praisonai-2.2.97}/tests/test_agents_playbook.py +0 -0
  52. {praisonai-2.2.96 → praisonai-2.2.97}/tests/test_basic.py +0 -0
  53. {praisonai-2.2.96 → praisonai-2.2.97}/tests/test_custom_tools_fix.py +0 -0
  54. {praisonai-2.2.96 → praisonai-2.2.97}/tests/test_double_api_fix.py +0 -0
  55. {praisonai-2.2.96 → praisonai-2.2.97}/tests/test_phase2_refactor.py +0 -0
  56. {praisonai-2.2.96 → 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.96
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.167
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PraisonAI
3
- Version: 2.2.96
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.167
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
@@ -1,7 +1,7 @@
1
1
  rich>=13.7
2
2
  markdown>=3.5
3
3
  pyparsing>=3.0.0
4
- praisonaiagents>=0.0.167
4
+ praisonaiagents>=0.0.168
5
5
  python-dotenv>=0.19.0
6
6
  instructor>=1.3.3
7
7
  PyYAML>=6.0
@@ -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,7 @@ 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)")
582
581
  parser.add_argument("--rewrite-tools", type=str, help="Tools for query rewriter (e.g., 'internet_search' or path to tools.py)")
583
582
  parser.add_argument("--tools", "-t", type=str, help="Path to tools.py file for research agent")
584
583
  parser.add_argument("--save", "-s", action="store_true", help="Save research output to file (output/research/)")
@@ -748,10 +747,105 @@ class PraisonAI:
748
747
 
749
748
  return args
750
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
+
751
842
  def handle_direct_prompt(self, prompt):
752
843
  """
753
844
  Handle direct prompt by creating a single agent and running it.
754
845
  """
846
+ # Apply query rewriting if enabled
847
+ prompt = self._rewrite_query_if_enabled(prompt)
848
+
755
849
  if PRAISONAI_AVAILABLE:
756
850
  agent_config = {
757
851
  "name": "DirectAgent",
@@ -994,60 +1088,8 @@ class PraisonAI:
994
1088
  logging.getLogger('httpcore').setLevel(logging.WARNING)
995
1089
 
996
1090
  # Rewrite query if requested
997
- original_query = query
998
1091
  if query_rewrite:
999
- try:
1000
- from praisonaiagents import QueryRewriterAgent, RewriteStrategy
1001
- print("[bold cyan]Rewriting query for better research results...[/bold cyan]")
1002
-
1003
- # Load rewrite tools if specified
1004
- rewrite_tools_list = []
1005
- if rewrite_tools:
1006
- if os.path.isfile(rewrite_tools):
1007
- # Load from file
1008
- try:
1009
- import inspect
1010
- spec = importlib.util.spec_from_file_location("rewrite_tools_module", rewrite_tools)
1011
- if spec and spec.loader:
1012
- module = importlib.util.module_from_spec(spec)
1013
- spec.loader.exec_module(module)
1014
- for name, obj in inspect.getmembers(module):
1015
- if inspect.isfunction(obj) and not name.startswith('_'):
1016
- rewrite_tools_list.append(obj)
1017
- if rewrite_tools_list:
1018
- print(f"[cyan]Loaded {len(rewrite_tools_list)} tools for query rewriter[/cyan]")
1019
- except Exception as e:
1020
- print(f"[yellow]Warning: Failed to load rewrite tools: {e}[/yellow]")
1021
- else:
1022
- # Treat as comma-separated tool names
1023
- try:
1024
- from praisonaiagents.tools import TOOL_MAPPINGS
1025
- import praisonaiagents.tools as tools_module
1026
-
1027
- tool_names = [t.strip() for t in rewrite_tools.split(',')]
1028
- for tool_name in tool_names:
1029
- if tool_name in TOOL_MAPPINGS:
1030
- try:
1031
- tool = getattr(tools_module, tool_name)
1032
- rewrite_tools_list.append(tool)
1033
- except Exception as e:
1034
- print(f"[yellow]Warning: Failed to load rewrite tool '{tool_name}': {e}[/yellow]")
1035
- else:
1036
- print(f"[yellow]Warning: Unknown rewrite tool '{tool_name}'[/yellow]")
1037
- if rewrite_tools_list:
1038
- print(f"[cyan]Using rewrite tools: {', '.join(tool_names)}[/cyan]")
1039
- except ImportError:
1040
- print("[yellow]Warning: Could not import tools module[/yellow]")
1041
-
1042
- rewriter = QueryRewriterAgent(model="gpt-4o-mini", verbose=verbose, tools=rewrite_tools_list if rewrite_tools_list else None)
1043
- result = rewriter.rewrite(query, strategy=RewriteStrategy.AUTO)
1044
- query = result.primary_query
1045
- print(f"[cyan]Original:[/cyan] {original_query}")
1046
- print(f"[cyan]Rewritten:[/cyan] {query}")
1047
- except ImportError:
1048
- print("[yellow]Warning: QueryRewriterAgent not available, using original query[/yellow]")
1049
- except Exception as e:
1050
- print(f"[yellow]Warning: Query rewrite failed ({e}), using original query[/yellow]")
1092
+ query = self._rewrite_query(query, rewrite_tools, verbose)
1051
1093
 
1052
1094
  print("[bold green]Starting Deep Research...[/bold green]")
1053
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.96 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.167",
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.96"
File without changes
File without changes
File without changes
File without changes
File without changes