MervinPraison / PraisonAI
- среда, 17 июля 2024 г. в 00:00:02
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, customisation, and efficient human-agent collaboration.
Praison AI, leveraging both AutoGen and CrewAI or any other agent framework, represents a low-code, centralised framework designed to simplify the creation and orchestration of multi-agent systems for various LLM applications, emphasizing ease of use, customization, and human-agent interaction.
Cookbook | Open in Colab | |
---|---|---|
Basic | PraisonAI | |
Include Tools | PraisonAI Tools |
pip install praisonai
export OPENAI_API_KEY="Enter your API key"
praisonai --init create a movie script about dog in moon
praisonai
pip install praisonai
export OPENAI_API_KEY="Enter your API key"
Generate your OPENAI API KEY from here: https://platform.openai.com/api-keys
Note: You can use other providers such as Ollama, Mistral ... etc. Details are provided at the bottom.
praisonai --init create a movie script about dog in moon
This will automatically create agents.yaml file in the current directory.
praisonai --framework autogen --init create movie script about cat in mars
praisonai
or
python -m praisonai
praisonai --framework autogen
praisonai --auto create a movie script about Dog in Moon
Interface | Description | URL |
---|---|---|
UI | Multi Agents such as CrewAI or AutoGen | https://docs.praisonai.com/ui/ui |
Chat | Chat with 100+ LLMs, single AI Agent | https://docs.praisonai.com/ui/chat |
Code | Chat with entire Codebase, single AI Agent | https://docs.praisonai.com/ui/code |
pip install -U "praisonai[ui]"
export OPENAI_API_KEY="Enter your API key"
chainlit create-secret
export CHAINLIT_AUTH_SECRET=xxxxxxxx
praisonai ui
or
python -m praisonai ui
pip install "praisonai[chat]"
export OPENAI_API_KEY="Enter your API key"
praisonai chat
agents.yaml
file should be present in the current directory.
If it doesn't exist, create it by running the command praisonai --init research about the latest AI News and prepare a detailed report
.
Create a file called tools.py in the same directory as the agents.yaml file.
# example tools.py
from duckduckgo_search import DDGS
from praisonai_tools import BaseTool
class InternetSearchTool(BaseTool):
name: str = "InternetSearchTool"
description: str = "Search Internet for relevant information based on a query or latest news"
def _run(self, query: str):
ddgs = DDGS()
results = ddgs.text(keywords=query, region='wt-wt', safesearch='moderate', max_results=5)
return results
Add the tool to the agents.yaml file as show below under the tools section - InternetSearchTool
.
framework: crewai
topic: research about the latest AI News and prepare a detailed report
roles:
research_analyst:
backstory: Experienced in gathering and analyzing data related to AI news trends.
goal: Analyze AI News trends
role: Research Analyst
tasks:
gather_data:
description: Conduct in-depth research on the latest AI News trends from reputable
sources.
expected_output: Comprehensive report on current AI News trends.
tools:
- InternetSearchTool
framework: crewai
topic: Artificial Intelligence
roles:
screenwriter:
backstory: 'Skilled in crafting scripts with engaging dialogue about {topic}.'
goal: Create scripts from concepts.
role: Screenwriter
tasks:
scriptwriting_task:
description: 'Develop scripts with compelling characters and dialogue about {topic}.'
expected_output: 'Complete script ready for production.'
from praisonai import PraisonAI
# Example agent_yaml content
agent_yaml = """
framework: "crewai"
topic: "Space Exploration"
roles:
astronomer:
role: "Space Researcher"
goal: "Discover new insights about {topic}"
backstory: "You are a curious and dedicated astronomer with a passion for unraveling the mysteries of the cosmos."
tasks:
investigate_exoplanets:
description: "Research and compile information about exoplanets discovered in the last decade."
expected_output: "A summarized report on exoplanet discoveries, including their size, potential habitability, and distance from Earth."
"""
# Create a PraisonAI instance with the agent_yaml content
praisonai = PraisonAI(agent_yaml=agent_yaml)
# Run PraisonAI
result = praisonai.run()
# Print the result
print(result)
Note: Please create agents.yaml file before hand.
from praisonai import PraisonAI
def basic(): # Basic Mode
praisonai = PraisonAI(agent_file="agents.yaml")
praisonai.run()
if __name__ == "__main__":
basic()
Install all dependencies, including dev dependencies:
poetry install
Install only documentation dependencies:
poetry install --with docs
Install only test dependencies:
poetry install --with test
Install only dev dependencies:
poetry install --with dev
This configuration ensures that your development dependencies are correctly categorized and installed as needed.
git clone https://github.com/yourusername/praisonAI.git
git checkout -b new-feature
git commit -am "Add some feature"
git push origin new-feature