|
6 | 6 | from .version import __version__ |
7 | 7 |
|
8 | 8 | # Re-export all classes from praisonaiagents to enable: |
9 | | -# from PraisonAI import Agent, Task, PraisonAIAgents |
10 | | -# List of symbols that should be available from praisonaiagents |
11 | | -_praisonaiagents_exports = [ |
12 | | - 'Agent', |
13 | | - 'ImageAgent', |
14 | | - 'PraisonAIAgents', |
15 | | - 'Agents', |
16 | | - 'Task', |
17 | | - 'Tools', |
18 | | - 'TaskOutput', |
19 | | - 'ReflectionOutput', |
20 | | - 'AutoAgents', |
21 | | - 'Session', |
22 | | - 'Memory', |
23 | | - 'Knowledge', |
24 | | - 'Chunking', |
25 | | - 'MCP', |
26 | | - 'GuardrailResult', |
27 | | - 'LLMGuardrail', |
28 | | - 'Handoff', |
29 | | - 'handoff', |
30 | | - 'handoff_filters', |
31 | | - 'RECOMMENDED_PROMPT_PREFIX', |
32 | | - 'prompt_with_handoff_instructions', |
33 | | - 'get_telemetry', |
34 | | - 'enable_telemetry', |
35 | | - 'disable_telemetry', |
36 | | - 'MinimalTelemetry', |
37 | | - 'TelemetryCollector', |
38 | | - 'display_interaction', |
39 | | - 'display_self_reflection', |
40 | | - 'display_instruction', |
41 | | - 'display_tool_call', |
42 | | - 'display_error', |
43 | | - 'display_generating', |
44 | | - 'clean_triple_backticks', |
45 | | - 'error_logs', |
46 | | - 'register_display_callback', |
47 | | - 'sync_display_callbacks', |
48 | | - 'async_display_callbacks', |
49 | | -] |
50 | | - |
51 | | -# Track which symbols were successfully imported |
52 | | -_imported_symbols = [] |
53 | | - |
| 9 | +# from praisonai import Agent, Task, PraisonAIAgents |
54 | 10 | try: |
55 | 11 | import praisonaiagents |
56 | | - # Import all symbols from praisonaiagents |
57 | | - for symbol in _praisonaiagents_exports: |
58 | | - if hasattr(praisonaiagents, symbol): |
59 | | - globals()[symbol] = getattr(praisonaiagents, symbol) |
60 | | - _imported_symbols.append(symbol) |
| 12 | + # Import all symbols from praisonaiagents using * import |
| 13 | + from praisonaiagents import * |
61 | 14 | except ImportError: |
62 | 15 | # If praisonaiagents is not available, these imports will fail gracefully |
63 | 16 | pass |
64 | 17 |
|
65 | | -# Define __all__ to include both PraisonAI core classes and successfully imported praisonaiagents classes |
| 18 | +# Define __all__ to include both PraisonAI core classes and praisonaiagents exports |
66 | 19 | __all__ = [ |
67 | 20 | # Core PraisonAI classes |
68 | 21 | 'PraisonAI', |
69 | 22 | '__version__', |
70 | | -] + _imported_symbols |
| 23 | +] |
| 24 | + |
| 25 | +# Dynamically extend __all__ with praisonaiagents exports |
| 26 | +try: |
| 27 | + import praisonaiagents |
| 28 | + __all__.extend(praisonaiagents.__all__) |
| 29 | +except (ImportError, AttributeError): |
| 30 | + # If praisonaiagents is not available or doesn't have __all__, fail gracefully |
| 31 | + pass |
0 commit comments