Skip to content

Commit

Permalink
Version 0.0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
MervinPraison committed Mar 25, 2024
1 parent 4f438de commit 3cda162
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 9 deletions.
7 changes: 5 additions & 2 deletions praisonai/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

from .cli import PraisonAI

if __name__ == "__main__":
def main():
praison_ai = PraisonAI()
praison_ai.main()
praison_ai.main()

if __name__ == "__main__":
main()
8 changes: 6 additions & 2 deletions praisonai/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def generate_crew_and_kickoff(self):
tasks = []
if framework == "autogen":
# Load the LLM configuration dynamically
print(self.config_list)
# print(self.config_list)
llm_config = {"config_list": self.config_list}

for role, details in config['roles'].items():
Expand Down Expand Up @@ -114,7 +114,11 @@ def main(self):
ui = args.ui # Default UI flag

if args.agent_file:
self.agent_file = args.agent_file
if args.agent_file == "tests.test": # Argument used for testing purposes
full_path = os.path.abspath("agents.yaml")
else:
full_path = os.path.abspath(args.agent_file)
self.agent_file = full_path
else:
full_path = os.path.abspath(self.agent_file)
self.filename = full_path
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "praisonAI"
version = "0.0.7"
version = "0.0.8"
description = "praisonAI application combines AutoGen and CrewAI or similar frameworks into a low-code solution for building and managing multi-agent LLM systems, focusing on simplicity, customization, and efficient human-agent collaboration."
authors = ["Mervin Praison"]
license = ""
Expand Down
11 changes: 11 additions & 0 deletions tests/advanced_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from praisonai import PraisonAI

def advanced():
praison_ai = PraisonAI(
agent_file="agents.yaml",
framework="autogen",
)
praison_ai.main()

if __name__ == "__main__":
advanced()
41 changes: 41 additions & 0 deletions tests/agents.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
framework: "crewai"
topic: "Artificial Intelligence"

roles:
narrative_designer:
role: "Narrative Designer"
goal: "Craft engaging storylines and narratives for {topic}"
backstory: >
You're a creative visionary skilled in weaving complex narratives and
developing engaging story worlds within {topic}. Your expertise lies in
conceptualizing the overarching story and ensuring it resonates with the audience.
tasks:
story_concept_development:
description: >
Develop a compelling story concept for {topic}, focusing on originality,
thematic depth, and audience engagement. Outline the main narrative arcs,
characters, and settings.
expected_output: >
A comprehensive document outlining the story concept, including key narrative
arcs, character bios, and settings descriptions.
scriptwriter:
role: "Scriptwriter"
goal: "Transform story concepts into detailed scripts for {topic}"
backstory: >
With a flair for dialogue and a deep understanding of pacing and structure,
you excel at bringing narratives to life through scriptwriting. Your work
turns story concepts into blueprints for compelling {topic} experiences.
tasks:
scriptwriting_task:
description: >
Based on the narrative concept, write a detailed script for {topic}.
Include dialogue, stage directions, and scene descriptions that bring
the story to life.
expected_output: >
A detailed script ready for production, including dialogue, stage
directions, and scene descriptions.
dependencies:
- task: scriptwriting_task
depends_on: story_concept_development
12 changes: 12 additions & 0 deletions tests/auto_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from praisonai import PraisonAI

def auto():
praison_ai = PraisonAI(
auto="Create a movie script about car in mars",
framework="autogen"
)
print(praison_ai.framework)
praison_ai.main()

if __name__ == "__main__":
auto()
8 changes: 8 additions & 0 deletions tests/basic_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from praisonai import PraisonAI

def main():
praison_ai = PraisonAI(agent_file="agents.yaml")
praison_ai.main()

if __name__ == "__main__":
main()
31 changes: 27 additions & 4 deletions tests/test.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,41 @@
# tests/test.py
import unittest
from praisonai.cli import generate_crew_and_kickoff
# from .debug import * # Uncomment this line to import the debug.py file for debugging
import unittest
import os
from praisonai.cli import PraisonAI
from .advanced_example import advanced
from .basic_example import main
from .auto_example import auto

class TestGenerateCrewAndKickoff(unittest.TestCase):
def test_generate_crew_and_kickoff_with_autogen_framework(self):
result = generate_crew_and_kickoff('tests/autogen-agents.yaml')
praison_ai = PraisonAI(agent_file='tests/autogen-agents.yaml')
result = praison_ai.generate_crew_and_kickoff()
# Assert the result
self.assertIn('### Output ###', result)

def test_generate_crew_and_kickoff_with_custom_framework(self):
result = generate_crew_and_kickoff('tests/crewai-agents.yaml')
praison_ai = PraisonAI(agent_file='tests/crewai-agents.yaml')
result = praison_ai.generate_crew_and_kickoff()
# Assert the result
self.assertIn('### Output ###', result)
class TestPraisonAICommand(unittest.TestCase):
def test_praisonai_command(self):
command = "praisonai --framework autogen --auto create movie script about cat in mars"
result = os.popen(command).read()
self.assertIn('Task output', result)

class TestBasicExample(unittest.TestCase):
def test_basic_example(self):
main()

class TestAdvancedExample(unittest.TestCase):
def test_advanced_example(self):
advanced()

class TestAutoExample(unittest.TestCase):
def test_auto_example(self):
auto()

if __name__ == '__main__':
unittest.main()

0 comments on commit 3cda162

Please sign in to comment.