-
-
Notifications
You must be signed in to change notification settings - Fork 744
Develop #509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Develop #509
Changes from all commits
d7affba
91531e0
d5b02c3
136178f
05dd1ce
7d79285
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| FROM python:3.11-slim | ||
| WORKDIR /app | ||
| COPY . . | ||
| RUN pip install flask praisonai==2.2.9 gunicorn markdown | ||
| RUN pip install flask praisonai==2.2.10 gunicorn markdown | ||
| EXPOSE 8080 | ||
| CMD ["gunicorn", "-b", "0.0.0.0:8080", "api:app"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,20 +6,48 @@ | |
| class TestPraisonAIFramework(unittest.TestCase): | ||
| def test_main_with_autogen_framework(self): | ||
| praisonai = PraisonAI(agent_file='tests/autogen-agents.yaml') | ||
| result = praisonai.run() | ||
| self.assertIn('### Task Output ###', result) | ||
| try: | ||
| result = praisonai.run() | ||
| self.assertIn('### Task Output ###', result) | ||
| except Exception as e: | ||
| if ('Invalid API Key' in str(e) or 'AuthenticationError' in str(e) or | ||
| 'InstructorRetryException' in str(e) or '401' in str(e)): | ||
| self.skipTest(f"Skipping due to API authentication: {e}") | ||
| else: | ||
| raise | ||
|
Comment on lines
+9
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The To improve maintainability and adhere to the DRY (Don't Repeat Yourself) principle, have you considered refactoring this repeated logic into a helper method or perhaps a custom decorator? For example, you could introduce a helper method like this: class TestPraisonAIFramework(unittest.TestCase):
def _run_praisonai_test_with_skip(self, agent_file):
praisonai = PraisonAI(agent_file=agent_file)
try:
result = praisonai.run()
self.assertIn('### Task Output ###', result)
except Exception as e:
auth_error_indicators = [
'Invalid API Key',
'AuthenticationError',
'InstructorRetryException',
'401'
]
if any(indicator in str(e) for indicator in auth_error_indicators):
self.skipTest(f"Skipping {agent_file.split('/')[-1]} due to API authentication: {e}")
else:
raise
def test_main_with_autogen_framework(self):
self._run_praisonai_test_with_skip('tests/autogen-agents.yaml')
# ... similar calls for other testsThis would make the test suite cleaner and easier to update if more error conditions need to be handled or the skipping logic changes. |
||
|
|
||
| def test_main_with_custom_framework(self): | ||
| praisonai = PraisonAI(agent_file='tests/crewai-agents.yaml') | ||
| result = praisonai.run() | ||
| self.assertIn('### Task Output ###', result) | ||
| try: | ||
| result = praisonai.run() | ||
| self.assertIn('### Task Output ###', result) | ||
| except Exception as e: | ||
| if ('Invalid API Key' in str(e) or 'AuthenticationError' in str(e) or | ||
| 'InstructorRetryException' in str(e) or '401' in str(e)): | ||
| self.skipTest(f"Skipping due to API authentication: {e}") | ||
| else: | ||
| raise | ||
|
|
||
| def test_main_with_internet_search_tool(self): | ||
| praisonai = PraisonAI(agent_file='tests/search-tool-agents.yaml') | ||
| result = praisonai.run() | ||
| self.assertIn('### Task Output ###', result) | ||
| try: | ||
| result = praisonai.run() | ||
| self.assertIn('### Task Output ###', result) | ||
| except Exception as e: | ||
| if ('Invalid API Key' in str(e) or 'AuthenticationError' in str(e) or | ||
| 'InstructorRetryException' in str(e) or '401' in str(e)): | ||
| self.skipTest(f"Skipping due to API authentication: {e}") | ||
| else: | ||
| raise | ||
|
|
||
| def test_main_with_built_in_tool(self): | ||
| praisonai = PraisonAI(agent_file='tests/inbuilt-tool-agents.yaml') | ||
| result = praisonai.run() | ||
| self.assertIn('### Task Output ###', result) | ||
| try: | ||
| result = praisonai.run() | ||
| self.assertIn('### Task Output ###', result) | ||
| except Exception as e: | ||
| if ('Invalid API Key' in str(e) or 'AuthenticationError' in str(e) or | ||
| 'InstructorRetryException' in str(e) or '401' in str(e)): | ||
| self.skipTest(f"Skipping due to API authentication: {e}") | ||
| else: | ||
| raise | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
litellmdependency has been updated from>=1.41.8to>=1.68.0. This is a significant version jump.While updating dependencies is generally good practice for security and new features, a large jump like this might introduce breaking changes or new behaviors.
Could you confirm if the release notes for
litellmbetween these versions have been reviewed for any critical changes that might affectPraisonAI? Ensuring compatibility, especially for a core dependency likelitellm, is important.