Skip to content

Commit

Permalink
Merge pull request #344 from MervinPraison/develop
Browse files Browse the repository at this point in the history
adding cookbooks
  • Loading branch information
MervinPraison authored Jan 30, 2025
2 parents 97c53c9 + 2e65b6b commit 27eaad8
Show file tree
Hide file tree
Showing 36 changed files with 34,637 additions and 0 deletions.
612 changes: 612 additions & 0 deletions cookbooks/notebooks/yaml/article_generation_agents.ipynb

Large diffs are not rendered by default.

1,117 changes: 1,117 additions & 0 deletions cookbooks/notebooks/yaml/auto_email_responder_agents.ipynb

Large diffs are not rendered by default.

2,113 changes: 2,113 additions & 0 deletions cookbooks/notebooks/yaml/book_writing_agents.ipynb

Large diffs are not rendered by default.

174 changes: 174 additions & 0 deletions cookbooks/notebooks/yaml/business_product_launch_agents.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "SlnIaHbhLf8c"
},
"source": [
"# Business Product Launch Agents\n",
"\n",
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/MervinPraison/PraisonAI/blob/main/cookbooks/notebooks/business_product_launch_agents.ipynb)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "xI6-ZpboLf8e"
},
"source": [
"## Dependencies"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "DpKINtGDLf8f"
},
"outputs": [],
"source": [
"# Install dependencies without output\n",
"%pip install langchain_community > /dev/null\n",
"%pip install praisonai[crewai] > /dev/null\n",
"%pip install duckduckgo_search > /dev/null"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "roYose3jLf8f"
},
"source": [
"## Tools"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "sm9-wxkgLf8g"
},
"outputs": [],
"source": [
"from praisonai_tools import BaseTool, FileReadTool, SerperDevTool, ScrapeWebsiteTool\n",
"from langchain_community.tools.file_management.write import WriteFileTool\n",
"from duckduckgo_search import DDGS\n",
"from langchain.tools import tool\n",
"\n",
"class InternetSearchTool(BaseTool):\n",
" name: str = \"InternetSearchTool\"\n",
" description: str = \"Search Internet for relevant information based on a query or latest news\"\n",
"\n",
" def _run(self, query: str):\n",
" ddgs = DDGS()\n",
" results = ddgs.text(keywords=query, region='wt-wt', safesearch='moderate', max_results=5)\n",
" return results"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "L787_IIVLf8g"
},
"source": [
"## YAML Prompt"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "FWBstR2uLf8g"
},
"outputs": [],
"source": [
"agent_yaml = \"\"\"\n",
"framework: crewai\n",
"topic: Artificial Intelligence\n",
"roles:\n",
" movie_concept_creator:\n",
" backstory: 'Creative thinker with a deep understanding of cinematic storytelling,\n",
" capable of using AI-generated storylines to create unique and compelling movie\n",
" ideas.'\n",
" goal: Generate engaging movie concepts using AI storylines\n",
" role: Movie Concept Creator\n",
" tasks:\n",
" movie_concept_development:\n",
" description: 'Develop movie concepts from AI-generated storylines, ensuring\n",
" they are engaging and have strong narrative arcs.'\n",
" expected_output: 'Well-structured movie concept document with character\n",
" bios, settings, and plot outlines.'\n",
" screenwriter:\n",
" backstory: 'Expert in writing engaging dialogue and script structure, able to\n",
" turn movie concepts into production-ready scripts.'\n",
" goal: Write compelling scripts based on movie concepts\n",
" role: Screenwriter\n",
" tasks:\n",
" scriptwriting_task:\n",
" description: 'Turn movie concepts into polished scripts with well-developed\n",
" characters, strong dialogue, and effective scene transitions.'\n",
" expected_output: 'Production-ready script with a beginning, middle, and\n",
" end, along with character development and engaging dialogues.'\n",
" editor:\n",
" backstory: 'Adept at identifying inconsistencies, improving language usage,\n",
" and maintaining the overall flow of the script.'\n",
" goal: Refine the scripts and ensure continuity of the movie storyline\n",
" role: Editor\n",
" tasks:\n",
" editing_task:\n",
" description: 'Review, edit, and refine the scripts to ensure they are cohesive\n",
" and follow a well-structured narrative.'\n",
" expected_output: 'A polished final draft of the script with no inconsistencies,\n",
" strong character development, and effective dialogue.'\n",
"dependencies: []\n",
"\"\"\""
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "McG-g_YDLf8h"
},
"source": [
"## Main"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "Ren-3KybLf8h"
},
"outputs": [],
"source": [
"import os\n",
"from praisonai import PraisonAI\n",
"from google.colab import userdata\n",
"\n",
"# Create a PraisonAI instance with the agent_yaml content\n",
"praisonai = PraisonAI(agent_yaml=agent_yaml, tools=[InternetSearchTool, ScrapeWebsiteTool]) # Add InstagramSearchTool once scripted\n",
"\n",
"# Add OPENAI_API_KEY Secrets to Google Colab on the Left Hand Side 🔑 or Enter Manually Below\n",
"os.environ[\"OPENAI_API_KEY\"] = userdata.get('OPENAI_API_KEY') or \"ENTER OPENAI_API_KEY HERE\"\n",
"os.environ[\"OPENAI_MODEL_NAME\"] = \"gpt-4o-mini\"\n",
"\n",
"# Run PraisonAI\n",
"result = praisonai.run()\n",
"\n",
"# Print the result\n",
"print(result)\n"
]
}
],
"metadata": {
"language_info": {
"name": "python"
},
"colab": {
"provenance": []
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Loading

0 comments on commit 27eaad8

Please sign in to comment.