@@ -50,6 +50,172 @@ jobs:
5050 echo " - OPENAI_API_BASE: $OPENAI_API_BASE"
5151 echo " - OPENAI_MODEL_NAME: $OPENAI_MODEL_NAME"
5252
53+ - name : Debug Python Environment Variables
54+ run : |
55+ python -c "
56+ import os
57+ print('🐍 Python Environment Variable Check:')
58+ api_key = os.environ.get('OPENAI_API_KEY', 'NOT_SET')
59+ if api_key != 'NOT_SET':
60+ print(f' ✅ OPENAI_API_KEY: {api_key[:7]}... (length: {len(api_key)})')
61+ else:
62+ print(' ❌ OPENAI_API_KEY: NOT_SET')
63+ print(f' 🌐 OPENAI_API_BASE: {os.environ.get(\"OPENAI_API_BASE\", \"NOT_SET\")}')
64+ print(f' 🤖 OPENAI_MODEL_NAME: {os.environ.get(\"OPENAI_MODEL_NAME\", \"NOT_SET\")}')
65+ print(f' 📋 All OPENAI env vars:')
66+ for key, value in os.environ.items():
67+ if key.startswith('OPENAI'):
68+ print(f' {key}: {value[:10] if len(value) > 10 else value}...')
69+ "
70+
71+ - name : Debug YAML Loading and Roles
72+ run : |
73+ echo "🔍 Tracing YAML file loading and role creation..."
74+ python -c "
75+ import os
76+ import sys
77+ import yaml
78+ sys.path.insert(0, '.')
79+
80+ print('📁 Available YAML files in tests/:')
81+ import glob
82+ yaml_files = glob.glob('tests/*.yaml')
83+ for f in yaml_files:
84+ print(f' {f}')
85+
86+ print()
87+ print('📋 Content of autogen-agents.yaml:')
88+ with open('tests/autogen-agents.yaml', 'r') as f:
89+ config = yaml.safe_load(f)
90+ print(f' Framework: {config.get(\"framework\")}')
91+ print(f' Topic: {config.get(\"topic\")}')
92+ print(f' Roles: {list(config.get(\"roles\", {}).keys())}')
93+ for role_key, role_data in config.get('roles', {}).items():
94+ print(f' {role_key} -> {role_data.get(\"role\", \"NO_ROLE\")}')
95+
96+ print()
97+ print('🔍 Checking if execution uses a different YAML:')
98+
99+ # Check other YAML files for 'Researcher' role
100+ for yaml_file in yaml_files:
101+ try:
102+ with open(yaml_file, 'r') as f:
103+ test_config = yaml.safe_load(f)
104+ roles = test_config.get('roles', {})
105+ for role_key, role_data in roles.items():
106+ if 'researcher' in role_key.lower() or 'researcher' in role_data.get('role', '').lower():
107+ print(f' 🎯 FOUND Researcher in {yaml_file}!')
108+ print(f' Framework: {test_config.get(\"framework\")}')
109+ print(f' Role key: {role_key} -> {role_data.get(\"role\")}')
110+ except:
111+ pass
112+ "
113+ continue-on-error : true
114+
115+ - name : Debug Framework Detection
116+ run : |
117+ echo "🔍 Testing framework detection and config flow..."
118+ python -c "
119+ import os
120+ import sys
121+ import yaml
122+ sys.path.insert(0, '.')
123+
124+ print('🔧 Testing framework detection:')
125+
126+ # Load the YAML file
127+ with open('tests/autogen-agents.yaml', 'r') as f:
128+ config = yaml.safe_load(f)
129+
130+ print(f' 📋 YAML framework: {config.get(\"framework\", \"NOT_SET\")}')
131+ print(f' 📋 YAML topic: {config.get(\"topic\", \"NOT_SET\")}')
132+
133+ try:
134+ from praisonai import PraisonAI
135+ from praisonai.agents_generator import AgentsGenerator
136+
137+ # Test PraisonAI initialization
138+ praisonai = PraisonAI(agent_file='tests/autogen-agents.yaml')
139+ print(f' 🎯 PraisonAI framework: {praisonai.framework}')
140+
141+ # Test AgentsGenerator initialization
142+ agents_gen = AgentsGenerator(
143+ agent_file='tests/autogen-agents.yaml',
144+ framework=praisonai.framework,
145+ config_list=praisonai.config_list
146+ )
147+ print(f' ⚙️ AgentsGenerator framework: {agents_gen.framework}')
148+ print(f' ⚙️ Final framework decision: {agents_gen.framework or config.get(\"framework\")}')
149+
150+ # Check config_list
151+ print(f' 🔑 Config list model: {praisonai.config_list[0].get(\"model\")}')
152+ print(f' 🔑 Config list API key: {praisonai.config_list[0].get(\"api_key\", \"NOT_SET\")[:10]}...')
153+
154+ except Exception as e:
155+ print(f'❌ Error in framework detection: {e}')
156+ "
157+ continue-on-error : true
158+
159+ - name : Debug PraisonAIModel API Key Flow
160+ run : |
161+ echo "🔍 Testing PraisonAIModel API key handling..."
162+ python -c "
163+ import os
164+ import sys
165+ sys.path.insert(0, '.')
166+
167+ print('🔑 Environment API Key Check:')
168+ env_key = os.environ.get('OPENAI_API_KEY', 'NOT_FOUND')
169+ print(f' OPENAI_API_KEY: {env_key[:10] if env_key != \"NOT_FOUND\" else \"NOT_FOUND\"}...')
170+
171+ try:
172+ from praisonai.inc.models import PraisonAIModel
173+
174+ # Test PraisonAIModel with openai/gpt-4o-mini (from YAML)
175+ model = PraisonAIModel(model='openai/gpt-4o-mini')
176+
177+ print('🤖 PraisonAIModel Configuration:')
178+ print(f' model: {model.model}')
179+ print(f' model_name: {model.model_name}')
180+ print(f' api_key_var: {model.api_key_var}')
181+ print(f' api_key: {model.api_key[:10] if model.api_key != \"nokey\" else \"DEFAULT_NOKEY\"}...')
182+ print(f' base_url: {model.base_url}')
183+
184+ if model.api_key == 'nokey':
185+ print('❌ FOUND THE ISSUE: PraisonAIModel is using default \"nokey\" instead of environment variable!')
186+ else:
187+ print('✅ PraisonAIModel has valid API key from environment')
188+
189+ except Exception as e:
190+ print(f'❌ Error testing PraisonAIModel: {e}')
191+ "
192+ continue-on-error : true
193+
194+ - name : Validate API Key
195+ run : |
196+ echo "🔑 Testing API key validity with minimal OpenAI call..."
197+ python -c "
198+ import os
199+ try:
200+ from openai import OpenAI
201+ client = OpenAI(api_key=os.environ.get('OPENAI_API_KEY'))
202+ # Make a minimal API call to test key validity
203+ response = client.models.list()
204+ print('✅ API Key is VALID - OpenAI responded successfully')
205+ print(f'📊 Available models: {len(list(response.data))} models found')
206+ except Exception as e:
207+ print(f'❌ API Key is INVALID - Error: {e}')
208+ print('🔍 This explains why all API-dependent tests are failing')
209+ print('💡 The GitHub secret OPENAI_API_KEY needs to be updated with a valid key')
210+ "
211+ continue-on-error : true
212+
213+ - name : Test Direct PraisonAI Execution
214+ run : |
215+ echo "🧪 Testing direct PraisonAI execution (what works locally)..."
216+ python -m praisonai tests/autogen-agents.yaml
217+ continue-on-error : true
218+
53219 - name : Run Fast Tests
54220 run : |
55221 # Run the fastest, most essential tests
0 commit comments