Skip to content

Commit dfb62e8

Browse files
Merge pull request #509 from MervinPraison/develop
Develop
2 parents bab18e6 + 7d79285 commit dfb62e8

13 files changed

Lines changed: 222 additions & 28 deletions

File tree

.github/workflows/unittest.yml

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM python:3.11-slim
22
WORKDIR /app
33
COPY . .
4-
RUN pip install flask praisonai==2.2.9 gunicorn markdown
4+
RUN pip install flask praisonai==2.2.10 gunicorn markdown
55
EXPOSE 8080
66
CMD ["gunicorn", "-b", "0.0.0.0:8080", "api:app"]

docker/Dockerfile.chat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1313
RUN pip install --no-cache-dir \
1414
praisonaiagents>=0.0.4 \
1515
praisonai_tools \
16-
"praisonai==2.2.9" \
16+
"praisonai==2.2.10" \
1717
"praisonai[chat]" \
1818
"embedchain[github,youtube]"
1919

docker/Dockerfile.dev

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1515
RUN pip install --no-cache-dir \
1616
praisonaiagents>=0.0.4 \
1717
praisonai_tools \
18-
"praisonai==2.2.9" \
18+
"praisonai==2.2.10" \
1919
"praisonai[ui]" \
2020
"praisonai[chat]" \
2121
"praisonai[realtime]" \

docker/Dockerfile.ui

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1313
RUN pip install --no-cache-dir \
1414
praisonaiagents>=0.0.4 \
1515
praisonai_tools \
16-
"praisonai==2.2.9" \
16+
"praisonai==2.2.10" \
1717
"praisonai[ui]" \
1818
"praisonai[crewai]"
1919

docs/api/praisonai/deploy.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ <h2 id="raises">Raises</h2>
110110
file.write(&#34;FROM python:3.11-slim\n&#34;)
111111
file.write(&#34;WORKDIR /app\n&#34;)
112112
file.write(&#34;COPY . .\n&#34;)
113-
file.write(&#34;RUN pip install flask praisonai==2.2.9 gunicorn markdown\n&#34;)
113+
file.write(&#34;RUN pip install flask praisonai==2.2.10 gunicorn markdown\n&#34;)
114114
file.write(&#34;EXPOSE 8080\n&#34;)
115115
file.write(&#39;CMD [&#34;gunicorn&#34;, &#34;-b&#34;, &#34;0.0.0.0:8080&#34;, &#34;api:app&#34;]\n&#39;)
116116

docs/developers/local-development.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ WORKDIR /app
2727

2828
COPY . .
2929

30-
RUN pip install flask praisonai==2.2.9 watchdog
30+
RUN pip install flask praisonai==2.2.10 watchdog
3131

3232
EXPOSE 5555
3333

docs/ui/chat.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ To facilitate local development with live reload, you can use Docker. Follow the
155155

156156
COPY . .
157157

158-
RUN pip install flask praisonai==2.2.9 watchdog
158+
RUN pip install flask praisonai==2.2.10 watchdog
159159

160160
EXPOSE 5555
161161

docs/ui/code.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ To facilitate local development with live reload, you can use Docker. Follow the
208208

209209
COPY . .
210210

211-
RUN pip install flask praisonai==2.2.9 watchdog
211+
RUN pip install flask praisonai==2.2.10 watchdog
212212

213213
EXPOSE 5555
214214

praisonai/deploy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def create_dockerfile(self):
5656
file.write("FROM python:3.11-slim\n")
5757
file.write("WORKDIR /app\n")
5858
file.write("COPY . .\n")
59-
file.write("RUN pip install flask praisonai==2.2.9 gunicorn markdown\n")
59+
file.write("RUN pip install flask praisonai==2.2.10 gunicorn markdown\n")
6060
file.write("EXPOSE 8080\n")
6161
file.write('CMD ["gunicorn", "-b", "0.0.0.0:8080", "api:app"]\n')
6262

0 commit comments

Comments
 (0)