Skip to content

Commit 7d79285

Browse files
committed
Add debug steps for YAML loading and framework detection in GitHub Actions workflow
- Introduced new steps in `unittest.yml` to debug YAML file loading and framework detection, providing detailed output on available YAML files and their content. - Enhanced error handling to ensure visibility of issues during framework detection. - Ensured minimal changes to existing code while improving the debugging process for configuration and role management.
1 parent 05dd1ce commit 7d79285

1 file changed

Lines changed: 88 additions & 0 deletions

File tree

.github/workflows/unittest.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,94 @@ jobs:
6868
print(f' {key}: {value[:10] if len(value) > 10 else value}...')
6969
"
7070
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+
71159
- name: Debug PraisonAIModel API Key Flow
72160
run: |
73161
echo "🔍 Testing PraisonAIModel API key handling..."

0 commit comments

Comments
 (0)