Skip to content

Commit 136178f

Browse files
committed
Add debug step for PraisonAIModel API key handling in GitHub Actions workflow
- Introduced a new step in `unittest.yml` to debug the handling of the PraisonAIModel API key, providing detailed output on its status and configuration. - Ensured minimal changes to existing code while enhancing the testing process for API key integration and error visibility.
1 parent d5b02c3 commit 136178f

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

.github/workflows/unittest.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,41 @@ jobs:
6868
print(f' {key}: {value[:10] if len(value) > 10 else value}...')
6969
"
7070
71+
- name: Debug PraisonAIModel API Key Flow
72+
run: |
73+
echo "🔍 Testing PraisonAIModel API key handling..."
74+
python -c "
75+
import os
76+
import sys
77+
sys.path.insert(0, '.')
78+
79+
print('🔑 Environment API Key Check:')
80+
env_key = os.environ.get('OPENAI_API_KEY', 'NOT_FOUND')
81+
print(f' OPENAI_API_KEY: {env_key[:10] if env_key != \"NOT_FOUND\" else \"NOT_FOUND\"}...')
82+
83+
try:
84+
from praisonai.inc.models import PraisonAIModel
85+
86+
# Test PraisonAIModel with openai/gpt-4o-mini (from YAML)
87+
model = PraisonAIModel(model='openai/gpt-4o-mini')
88+
89+
print('🤖 PraisonAIModel Configuration:')
90+
print(f' model: {model.model}')
91+
print(f' model_name: {model.model_name}')
92+
print(f' api_key_var: {model.api_key_var}')
93+
print(f' api_key: {model.api_key[:10] if model.api_key != \"nokey\" else \"DEFAULT_NOKEY\"}...')
94+
print(f' base_url: {model.base_url}')
95+
96+
if model.api_key == 'nokey':
97+
print('❌ FOUND THE ISSUE: PraisonAIModel is using default \"nokey\" instead of environment variable!')
98+
else:
99+
print('✅ PraisonAIModel has valid API key from environment')
100+
101+
except Exception as e:
102+
print(f'❌ Error testing PraisonAIModel: {e}')
103+
"
104+
continue-on-error: true
105+
71106
- name: Validate API Key
72107
run: |
73108
echo "🔑 Testing API key validity with minimal OpenAI call..."

0 commit comments

Comments
 (0)