{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "You can download the `requirements.txt` for this course from the workspace of this lab. `File --> Open...`" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# L2: Create Agents to Research and Write an Article\n", "\n", "In this lesson, you will be introduced to the foundational concepts of multi-agent systems and get an overview of the crewAI framework." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The libraries are already installed in the classroom. If you're running this notebook on your own machine, you can install the following:\n", "```Python\n", "!pip install crewai==0.28.8 crewai_tools==0.1.6 langchain_community==0.0.29\n", "```" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "height": 64 }, "outputs": [], "source": [ "# Warning control\n", "import warnings\n", "warnings.filterwarnings('ignore')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- Import from the crewAI libray." ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "height": 166 }, "outputs": [], "source": [ "from crewai import Agent, Task, Crew\n", "from crewai_tools import (\n", " #DirectoryReadTool,\n", " #FileReadTool,\n", " #SerperDevTool,\n", " #WebsiteSearchTool,\n", " #DOCXSearchTool,\n", " #RagTool,\n", " TXTSearchTool\n", ")\n", "from datetime import datetime" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- As a LLM for your agents, you'll be using OpenAI's `gpt-3.5-turbo`.\n", "\n", "**Optional Note:** crewAI also allow other popular models to be used as a LLM for your Agents. You can see some of the examples at the [bottom of the notebook](#1)." ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "height": 149 }, "outputs": [], "source": [ "import os\n", "from utils import get_openai_api_key\n", "\n", "# Set up API keys\n", "\n", "openai_api_key = get_openai_api_key()\n", "\n", "os.environ[\"OPENAI_MODEL_NAME\"] = 'gpt-3.5-turbo'\n", "os.environ[\"OPENAI_API_KEY\"] = \"sk-proj-8nKBOgxInYCIqidcdSu7T3BlbkFJWac8qZbpFOE2TSn0OpId\"\n" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "height": 132 }, "outputs": [], "source": [ "def call_crew_kickoff(str_current_datetime):\n", " # Instantiate tools\n", " #meeting_trans_docs_tool = DirectoryReadTool(directory='./meeting-transcription')\n", " #brd_temp_docs_tool = DirectoryReadTool(directory='./brd-template')\n", " #file_tool = FileReadTool()\n", " #web_rag_tool = WebsiteSearchTool()\n", " #docx_search_tool = DOCXSearchTool()\n", " #rag_tool = RagTool()\n", " mt_tool = TXTSearchTool(txt='./meeting-transcription/meeting-transcript_' + str_current_datetime + '.txt')\n", " brd_tool = TXTSearchTool(txt='./brd-template/brd-template.txt')\n", "\n", " text_parsing_agent = Agent(\n", " role=\"Text Interpreter\",\n", " goal=\"Parse and interpret the raw text input, structuring it into manageable sections\"\n", " \"or data points that are relevant for analysis and processing.\",\n", " backstory=\"You excel at deciphering complex textual data. You act as the first line of analysis,\"\n", " \"turning unstructured text into organized segments. You should enhance efficiency in data\"\n", " \"handling and support subsequent stages of data processing.\",\n", " tools=[mt_tool],\n", " allow_delegation=True,\n", " verbose=True\n", " )\n", "\n", " data_extraction_agent = Agent(\n", " role=\"Data Extraction Agent\",\n", " goal=\"Identify and extract essential data points, statistics,\"\n", " \"and specific information from the parsed text that are crucial\"\n", " \"for drafting a Business Requirements Document.\",\n", " backstory=\"You should tackle the challenge of sifting through detailed textual data to\"\n", " \"find relevant information. You should be doing it with precision and speed, equipped\"\n", " \"with capabilities to recognize and categorize data efficiently, making it invaluable\"\n", " \"for projects requiring quick turnaround and accurate data handling.\",\n", " tools=[mt_tool, brd_tool],\n", " allow_delegation=True,\n", " verbose=True\n", " )\n", "\n", " brd_compiler_agent = Agent(\n", " role=\"BRD Compiler\",\n", " goal=\"Assemble the extracted data into a well-structured Business Requirements Document,\"\n", " \"ensuring that it is clear, coherent, and formatted according to standards.\",\n", " backstory=\"You are a meticulous Business Requirement Document compiler, You should alleviate\"\n", " \"the burdens of manual document assembly. Ensure that all documents are crafted with\"\n", " \"precision, adhering to organizational standards, and ready for stakeholder review. You\"\n", " \"should be automating routine documentation tasks, thus allowing human team members to focus\"\n", " \"on more strategic activities.\",\n", " tools=[brd_tool],\n", " allow_delegation=True,\n", " verbose=True\n", " )\n", "\n", " text_parsing = Task(\n", " description=(\n", " \"1. Open and read the contents of the input text file.\\n\"\n", " \"2. Analyze the document structure to identify headings, subheadings, and key paragraphs.\\n\"\n", " \"3. Extract text under each identified section, ensuring context is preserved.\\n\"\n", " \"4. Format the extracted text into a JSON structure with labels indicating the type\"\n", " \"of content (e.g., heading, detail).\"\n", " ),\n", " expected_output=\"Structured JSON object containing separated sections of\"\n", " \"text with labels based on their content type.\",\n", " agent=text_parsing_agent,\n", " )\n", "\n", " data_extraction = Task(\n", " description=(\n", " \"1. Take the JSON structured data from the Text Parsing Agent.\\n\"\n", " \"2. Identify and extract specific data points like project goals, technical requirements,\"\n", " \"and stakeholder information.\\n\"\n", " \"3. Organize the extracted data into relevant categories for easy access and use.\\n\"\n", " \"4. Format all extracted data into a structured form suitable for document generation,\"\n", " \"ensuring it's ready for template insertion.\\n\"\n", " ),\n", " expected_output=\"A comprehensive list of key data points organized by category, ready for use in document generation.\",\n", " agent=data_extraction_agent,\n", " )\n", "\n", " compile_brd = Task(\n", " description=(\n", " \"1. Accept the structured and categorized data from the Data Extraction Agent.\\n\"\n", " \"2. Open and read the BRD template for data insertion.\\n\"\n", " \"3. Insert the received data into the respective sections of the BRD template.\\n\"\n", " \"4. Apply formatting rules to ensure the document is professional and adheres to standards.\\n\"\n", " \"5. Save the populated and formatted document as a new markdown file, marking the task as complete.\\n\"\n", " ),\n", " expected_output=\"A complete Business Requirements Document in markdown format, ready for review and distribution.\",\n", " agent=brd_compiler_agent,\n", " output_file='generated-brd/brd_' + str_current_datetime + '.md', # The final blog post will be saved here\n", " )\n", "\n", " crew = Crew(\n", " agents=[text_parsing_agent, data_extraction_agent, brd_compiler_agent],\n", " tasks=[text_parsing, data_extraction, compile_brd],\n", " verbose=2\n", " )\n", "\n", " result = crew.kickoff(inputs={'datetime': str_current_datetime})\n", "\n", " from IPython.display import Markdown\n", " Markdown(result)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Creating Agents\n", "\n", "- Define your Agents, and provide them a `role`, `goal` and `backstory`.\n", "- It has been seen that LLMs perform better when they are role playing." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Agent: Planner\n", "\n", "**Note**: The benefit of using _multiple strings_ :\n", "```Python\n", "varname = \"line 1 of text\"\n", " \"line 2 of text\"\n", "```\n", "\n", "versus the _triple quote docstring_:\n", "```Python\n", "varname = \"\"\"line 1 of text\n", " line 2 of text\n", " \"\"\"\n", "```\n", "is that it can avoid adding those whitespaces and newline characters, making it better formatted to be passed to the LLM." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Agent: Writer" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "height": 217 }, "outputs": [], "source": [ " " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Agent: Editor" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "height": 251 }, "outputs": [], "source": [ " " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Creating Tasks\n", "\n", "- Define your Tasks, and provide them a `description`, `expected_output` and `agent`." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Task: Plan" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "height": 217 }, "outputs": [], "source": [ " " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Task: Write" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "height": 234 }, "outputs": [ { "data": { "text/plain": [ "' data_extraction = Task(\\n description=(\\n \"1. Take the JSON structured data from the Text Parsing Agent.\\n\"\\n \"2. Identify and extract specific data points like project goals, technical requirements,\"\\n \"and stakeholder information.\\n\"\\n \"3. Organize the extracted data into relevant categories for easy access and use.\\n\"\\n \"4. Format all extracted data into a structured form suitable for document generation,\"\\n \"ensuring it\\'s ready for template insertion.\\n\"\\n ),\\n expected_output=\"A comprehensive list of key data points organized by category, ready for use in document generation.\",\\n agent=data_extraction_agent,\\n )\\n'" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "''' data_extraction = Task(\n", " description=(\n", " \"1. Take the JSON structured data from the Text Parsing Agent.\\n\"\n", " \"2. Identify and extract specific data points like project goals, technical requirements,\"\n", " \"and stakeholder information.\\n\"\n", " \"3. Organize the extracted data into relevant categories for easy access and use.\\n\"\n", " \"4. Format all extracted data into a structured form suitable for document generation,\"\n", " \"ensuring it's ready for template insertion.\\n\"\n", " ),\n", " expected_output=\"A comprehensive list of key data points organized by category, ready for use in document generation.\",\n", " agent=data_extraction_agent,\n", " )\n", "'''" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Task: Edit" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "height": 200 }, "outputs": [ { "data": { "text/plain": [ "' compile_brd = Task(\\n description=(\\n \"1. Accept the structured and categorized data from the Data Extraction Agent.\\n\"\\n \"2. Open and read the BRD template for data insertion.\\n\"\\n \"3. Insert the received data into the respective sections of the BRD template.\\n\"\\n \"4. Apply formatting rules to ensure the document is professional and adheres to standards.\\n\"\\n \"5. Save the populated and formatted document as a new markdown file, marking the task as complete.\\n\"\\n ),\\n expected_output=\"A complete Business Requirements Document in markdown format, ready for review and distribution.\",\\n agent=brd_compiler_agent,\\n output_file=\\'generated-brd/brd_{datetime}.md\\', # The final blog post will be saved here\\n )\\n'" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "''' compile_brd = Task(\n", " description=(\n", " \"1. Accept the structured and categorized data from the Data Extraction Agent.\\n\"\n", " \"2. Open and read the BRD template for data insertion.\\n\"\n", " \"3. Insert the received data into the respective sections of the BRD template.\\n\"\n", " \"4. Apply formatting rules to ensure the document is professional and adheres to standards.\\n\"\n", " \"5. Save the populated and formatted document as a new markdown file, marking the task as complete.\\n\"\n", " ),\n", " expected_output=\"A complete Business Requirements Document in markdown format, ready for review and distribution.\",\n", " agent=brd_compiler_agent,\n", " output_file='generated-brd/brd_{datetime}.md', # The final blog post will be saved here\n", " )\n", "'''" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Creating the Crew\n", "\n", "- Create your crew of Agents\n", "- Pass the tasks to be performed by those agents.\n", " - **Note**: *For this simple example*, the tasks will be performed sequentially (i.e they are dependent on each other), so the _order_ of the task in the list _matters_.\n", "- `verbose=2` allows you to see all the logs of the execution. " ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "height": 98 }, "outputs": [ { "data": { "text/plain": [ "' crew = Crew(\\n agents=[text_parsing_agent, data_extraction_agent, brd_compiler_agent],\\n tasks=[text_parsing, data_extraction, compile_brd],\\n verbose=2\\n )\\n'" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "''' crew = Crew(\n", " agents=[text_parsing_agent, data_extraction_agent, brd_compiler_agent],\n", " tasks=[text_parsing, data_extraction, compile_brd],\n", " verbose=2\n", " )\n", "'''" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Running the Crew" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Note**: LLMs can provide different outputs for they same input, so what you get might be different than what you see in the video." ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "height": 30 }, "outputs": [ { "data": { "text/plain": [ "\"\\n result = crew.kickoff(inputs={'datetime': str_current_datetime})\\n\\n from IPython.display import Markdown\\n Markdown(result)\\n\"" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "'''\n", " result = crew.kickoff(inputs={'datetime': str_current_datetime})\n", "\n", " from IPython.display import Markdown\n", " Markdown(result)\n", "'''" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- Display the results of your execution as markdown in the notebook." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "height": 47 }, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 9, "metadata": { "height": 30 }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Python 3.11.9\n" ] } ], "source": [ "!python --version" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [], "source": [ "import gradio as gr" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [], "source": [ "def process_file(input_file):\n", " current_datetime = datetime.now().strftime(\"%Y-%m-%d %H-%M-%S\")\n", " print(\"Current date & time : \", current_datetime)\n", " \n", " # convert datetime obj to string\n", " str_current_datetime = str(current_datetime)\n", "\n", " fh = open(input_file, 'rb')\n", " #data = fh.read()\n", "\n", " # Ensure the target directory exists\n", " output_dir = \"meeting-transcription\"\n", " if not os.path.exists(output_dir):\n", " os.makedirs(output_dir)\n", " \n", " # Save the uploaded file to the specified folder with the specified name\n", " input_filepath = os.path.join(output_dir, \"meeting-transcript_\" + str_current_datetime + \".txt\")\n", " with open(input_filepath, \"wb\") as file:\n", " file.write(fh.read())\n", " fh.close()\n", "\n", " call_crew_kickoff(str_current_datetime)\n", "\n", " # Example of processing: adding Markdown formatting. Replace this with your actual processing.\n", " #processed_text = \"# Processed Output\\n\\n\" + \"\\n\".join(f\"- {line}\" for line in text.splitlines())\n", " \n", " output_filename = \"generated-brd/brd_\" + str_current_datetime + \".md\"\n", " #with open(output_filename, \"w\") as file:\n", " # file.write(processed_text)\n", "\n", " # Read the contents of the generated Markdown file\n", " with open(output_filename, \"r\") as md_file:\n", " markdown_content = md_file.read()\n", "\n", " # Return both the filename for download and the Markdown content for display\n", " return output_filename, markdown_content" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Running on local URL: http://127.0.0.1:7860\n", "Running on public URL: https://555181993525c76e6c.gradio.live\n", "\n", "This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from Terminal to deploy to Spaces (https://huggingface.co/spaces)\n" ] }, { "data": { "text/html": [ "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" }, { "name": "stdout", "output_type": "stream", "text": [ "Current date & time : 2024-06-09 17-53-45\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "Inserting batches in chromadb: 100%|██████████| 1/1 [00:00<00:00, 1.40it/s]\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1m\u001b[95m [DEBUG]: == Working Agent: Text Interpreter\u001b[00m\n", "\u001b[1m\u001b[95m [INFO]: == Starting Task: 1. Open and read the contents of the input text file.\n", "2. Analyze the document structure to identify headings, subheadings, and key paragraphs.\n", "3. Extract text under each identified section, ensuring context is preserved.\n", "4. Format the extracted text into a JSON structure with labels indicating the typeof content (e.g., heading, detail).\u001b[00m\n", "\n", "\n", "\u001b[1m> Entering new CrewAgentExecutor chain...\u001b[0m\n", "\u001b[32;1m\u001b[1;3mI need to start by searching the content of the input text file to understand its structure and identify headings, subheadings, and key paragraphs.\n", "\n", "Action:\n", "Search a txt's content\n", "\n", "Action Input:\n", "{\n", "\"search_query\": \"meeting-transcription/meeting-transcript_2024-06-09 17-53-45.txt\"\n", "}\n", "\u001b[0m\u001b[95m \n", "\n", "Relevant Content:\n", "Meeting Transcript: Extensive IT Project Requirements Discussion\n", " \n", "Date: June 7, 2024\n", "Time: 9:00 AM to 12:00 PM\n", "Location: Conference Room B\n", "Attendees:\n", " \n", "Alex Johnson (Project Manager)\n", "Sam Lee (Business Analyst)\n", "Jessica Davis (Technical Lead) \n", "Chris Smith (Quality Assurance Manager)\n", "Taylor Brown (Stakeholder Representative)\n", "\n", "Meeting Transcript: Extensive IT Project Requirements Discussion\n", " \n", "Date: June 7, 2024\n", "Time: 9:00 AM to 12:00 PM\n", "Location: Conference Room B\n", "Attendees:\n", " \n", "Alex Johnson (Project Manager)\n", "Sam Lee (Business Analyst)\n", "Jessica Davis (Technical Lead) \n", "Chris Smith (Quality Assurance Manager)\n", "Taylor Brown (Stakeholder Representative)\n", "\n", "Meeting Transcript: Extensive IT Project Requirements Discussion\n", " \n", "Date: June 7, 2024\n", "Time: 9:00 AM to 12:00 PM\n", "Location: Conference Room B\n", "Attendees:\n", " \n", "Alex Johnson (Project Manager)\n", "Sam Lee (Business Analyst)\n", "Jessica Davis (Technical Lead) \n", "Chris Smith (Quality Assurance Manager)\n", "Taylor Brown (Stakeholder Representative)\n", "\u001b[00m\n", "\u001b[32;1m\u001b[1;3mFinal Answer: \n", "{\n", " \"Meeting Transcript\": [\n", " {\n", " \"Date\": \"June 7, 2024\",\n", " \"Time\": \"9:00 AM to 12:00 PM\",\n", " \"Location\": \"Conference Room B\",\n", " \"Attendees\": [\n", " \"Alex Johnson (Project Manager)\",\n", " \"Sam Lee (Business Analyst)\",\n", " \"Jessica Davis (Technical Lead)\",\n", " \"Chris Smith (Quality Assurance Manager)\",\n", " \"Taylor Brown (Stakeholder Representative)\"\n", " ]\n", " }\n", " ]\n", "}\u001b[0m\n", "\n", "\u001b[1m> Finished chain.\u001b[0m\n", "\u001b[1m\u001b[92m [DEBUG]: == [Text Interpreter] Task output: {\n", " \"Meeting Transcript\": [\n", " {\n", " \"Date\": \"June 7, 2024\",\n", " \"Time\": \"9:00 AM to 12:00 PM\",\n", " \"Location\": \"Conference Room B\",\n", " \"Attendees\": [\n", " \"Alex Johnson (Project Manager)\",\n", " \"Sam Lee (Business Analyst)\",\n", " \"Jessica Davis (Technical Lead)\",\n", " \"Chris Smith (Quality Assurance Manager)\",\n", " \"Taylor Brown (Stakeholder Representative)\"\n", " ]\n", " }\n", " ]\n", "}\n", "\n", "\u001b[00m\n", "\u001b[1m\u001b[95m [DEBUG]: == Working Agent: Data Extraction Agent\u001b[00m\n", "\u001b[1m\u001b[95m [INFO]: == Starting Task: 1. Take the JSON structured data from the Text Parsing Agent.\n", "2. Identify and extract specific data points like project goals, technical requirements,and stakeholder information.\n", "3. Organize the extracted data into relevant categories for easy access and use.\n", "4. Format all extracted data into a structured form suitable for document generation,ensuring it's ready for template insertion.\n", "\u001b[00m\n", "\n", "\n", "\u001b[1m> Entering new CrewAgentExecutor chain...\u001b[0m\n", "\u001b[32;1m\u001b[1;3mI need to extract specific data points related to project goals, technical requirements, and stakeholder information from the meeting transcript provided.\n", "\n", "Action: Search a txt's content\n", "Action Input: {'search_query': 'project goals'}\u001b[0m\u001b[95m \n", "\n", "Relevant Content:\n", "Meeting Summary:\n", "Alex Johnson (Project Manager): Good morning, everyone. Let's start today’s extensive session by clearly defining our project goals. The primary goal is to integrate advanced analytics into our platform, enhancing user experience and providing robust data insights.\n", " \n", "Taylor Brown (Stakeholder Representative): In alignment with Alex’s point, our business needs are clear. We need to boost customer engagement and satisfaction. This can be quantified by a target increase in daily active users and a reduction in customer complaints.\n", " \n", "Jessica Davis (Technical Lead): From a technical perspective, integrating these analytics will involve substantial updates to our data processing infrastructure and possibly migrating some services to a more scalable cloud solution.\n", " \n", "Sam Lee (Business Analyst): Given the complexity, we need to define the scope meticulously. This includes not only the technical implementation but also compliance with data protection regulations and ensuring our system is future-proofed for further upgrades.\n", " \n", "Chris Smith (Quality Assurance Manager): As for success criteria, we need to establish benchmarks. This means setting specific performance targets, like decreasing load times by 30% and achieving an error rate below 0.1%.\n", " \n", "Alex Johnson (Project Manager): Moving forward with our business objectives, we should aim to realize a return on investment within one year post-implementation, by increasing revenue through enhanced data-driven marketing strategies and reducing operational costs via more efficient data handling processes.\n", " \n", "Jessica Davis (Technical Lead): Identifying all stakeholders is key. We have internal stakeholders such as our IT and customer service teams, and external ones including technology partners and end-users. We must understand their interests and influence on the project.\n", "\n", "Meeting Summary:\n", "Alex Johnson (Project Manager): Good morning, everyone. Let's start today’s extensive session by clearly defining our project goals. The primary goal is to integrate advanced analytics into our platform, enhancing user experience and providing robust data insights.\n", " \n", "Taylor Brown (Stakeholder Representative): In alignment with Alex’s point, our business needs are clear. We need to boost customer engagement and satisfaction. This can be quantified by a target increase in daily active users and a reduction in customer complaints.\n", " \n", "Jessica Davis (Technical Lead): From a technical perspective, integrating these analytics will involve substantial updates to our data processing infrastructure and possibly migrating some services to a more scalable cloud solution.\n", " \n", "Sam Lee (Business Analyst): Given the complexity, we need to define the scope meticulously. This includes not only the technical implementation but also compliance with data protection regulations and ensuring our system is future-proofed for further upgrades.\n", " \n", "Chris Smith (Quality Assurance Manager): As for success criteria, we need to establish benchmarks. This means setting specific performance targets, like decreasing load times by 30% and achieving an error rate below 0.1%.\n", " \n", "Alex Johnson (Project Manager): Moving forward with our business objectives, we should aim to realize a return on investment within one year post-implementation, by increasing revenue through enhanced data-driven marketing strategies and reducing operational costs via more efficient data handling processes.\n", " \n", "Jessica Davis (Technical Lead): Identifying all stakeholders is key. We have internal stakeholders such as our IT and customer service teams, and external ones including technology partners and end-users. We must understand their interests and influence on the project.\n", "\n", "Meeting Summary:\n", "Alex Johnson (Project Manager): Good morning, everyone. Let's start today’s extensive session by clearly defining our project goals. The primary goal is to integrate advanced analytics into our platform, enhancing user experience and providing robust data insights.\n", " \n", "Taylor Brown (Stakeholder Representative): In alignment with Alex’s point, our business needs are clear. We need to boost customer engagement and satisfaction. This can be quantified by a target increase in daily active users and a reduction in customer complaints.\n", " \n", "Jessica Davis (Technical Lead): From a technical perspective, integrating these analytics will involve substantial updates to our data processing infrastructure and possibly migrating some services to a more scalable cloud solution.\n", " \n", "Sam Lee (Business Analyst): Given the complexity, we need to define the scope meticulously. This includes not only the technical implementation but also compliance with data protection regulations and ensuring our system is future-proofed for further upgrades.\n", " \n", "Chris Smith (Quality Assurance Manager): As for success criteria, we need to establish benchmarks. This means setting specific performance targets, like decreasing load times by 30% and achieving an error rate below 0.1%.\n", " \n", "Alex Johnson (Project Manager): Moving forward with our business objectives, we should aim to realize a return on investment within one year post-implementation, by increasing revenue through enhanced data-driven marketing strategies and reducing operational costs via more efficient data handling processes.\n", " \n", "Jessica Davis (Technical Lead): Identifying all stakeholders is key. We have internal stakeholders such as our IT and customer service teams, and external ones including technology partners and end-users. We must understand their interests and influence on the project.\n", "\u001b[00m\n", "\u001b[32;1m\u001b[1;3mFinal Answer:\n", "Project Goals:\n", "1. Integrate advanced analytics into the platform to enhance user experience and provide robust data insights.\n", "2. Boost customer engagement and satisfaction by increasing daily active users and reducing customer complaints.\n", "3. Realize a return on investment within one year post-implementation by increasing revenue through data-driven marketing strategies and reducing operational costs.\n", "\n", "Technical Requirements:\n", "1. Substantial updates to data processing infrastructure.\n", "2. Possible migration of services to a more scalable cloud solution.\n", "3. Compliance with data protection regulations.\n", "4. Future-proofing the system for further upgrades.\n", "\n", "Stakeholder Information:\n", "1. Internal stakeholders: IT and customer service teams.\n", "2. External stakeholders: Technology partners and end-users.\n", "3. Understanding their interests and influence on the project is crucial.\u001b[0m\n", "\n", "\u001b[1m> Finished chain.\u001b[0m\n", "\u001b[1m\u001b[92m [DEBUG]: == [Data Extraction Agent] Task output: Project Goals:\n", "1. Integrate advanced analytics into the platform to enhance user experience and provide robust data insights.\n", "2. Boost customer engagement and satisfaction by increasing daily active users and reducing customer complaints.\n", "3. Realize a return on investment within one year post-implementation by increasing revenue through data-driven marketing strategies and reducing operational costs.\n", "\n", "Technical Requirements:\n", "1. Substantial updates to data processing infrastructure.\n", "2. Possible migration of services to a more scalable cloud solution.\n", "3. Compliance with data protection regulations.\n", "4. Future-proofing the system for further upgrades.\n", "\n", "Stakeholder Information:\n", "1. Internal stakeholders: IT and customer service teams.\n", "2. External stakeholders: Technology partners and end-users.\n", "3. Understanding their interests and influence on the project is crucial.\n", "\n", "\u001b[00m\n", "\u001b[1m\u001b[95m [DEBUG]: == Working Agent: BRD Compiler\u001b[00m\n", "\u001b[1m\u001b[95m [INFO]: == Starting Task: 1. Accept the structured and categorized data from the Data Extraction Agent.\n", "2. Open and read the BRD template for data insertion.\n", "3. Insert the received data into the respective sections of the BRD template.\n", "4. Apply formatting rules to ensure the document is professional and adheres to standards.\n", "5. Save the populated and formatted document as a new markdown file, marking the task as complete.\n", "\u001b[00m\n", "\n", "\n", "\u001b[1m> Entering new CrewAgentExecutor chain...\u001b[0m\n", "\u001b[32;1m\u001b[1;3mI need to efficiently compile the structured and categorized data from the Data Extraction Agent into a well-organized Business Requirements Document that aligns with the project goals, technical requirements, and stakeholder information.\n", "\n", "Action:\n", "Delegate work to co-worker\n", "Action Input:\n", "{\n", " \"task\": \"Extract structured and categorized data\",\n", " \"context\": \"I need the Data Extraction Agent to provide me with the structured and categorized data for the Business Requirements Document.\"\n", "}\n", "\u001b[0m\u001b[91m \n", "\n", "I encountered an error while trying to use the tool. This was the error: 'NoneType' object has no attribute 'startswith'.\n", " Tool Delegate work to co-worker accepts these inputs: Delegate work to co-worker(task: str, context: str, coworker: Optional[str] = None, **kwargs) - Delegate a specific task to one of the following co-workers: [Text Interpreter, Data Extraction Agent]\n", "The input to this tool should be the co-worker, the task you want them to do, and ALL necessary context to execute the task, they know nothing about the task, so share absolute everything you know, don't reference things but instead explain them.\n", "\u001b[00m\n", "\u001b[32;1m\u001b[1;3mThought: I need to efficiently compile the structured and categorized data from the Data Extraction Agent into a well-organized Business Requirements Document that aligns with the project goals, technical requirements, and stakeholder information.\n", "\n", "Action: Search a txt's content\n", "Action Input: {\"search_query\": \"BRD Template\"}\u001b[0m\u001b[95m \n", "\n", "Relevant Content:\n", "Business Requirements Document (BRD)\n", "1. Document Information\n", "•\tDocument Title:\n", "•\tDate:\n", "•\tAuthor:\n", "•\tVersion:\n", "2. Executive Summary\n", "2.1. Purpose\n", "Briefly describe the purpose of the POC and the document.\n", "2.2. Project Background\n", "Provide a brief context for the POC, including the business problem it aims to address.\n", "2.3. Scope\n", "Outline what the POC will cover and what it will not cover.\n", "3. Business Objectives\n", "3.1. Goals\n", "List the main goals of the POC.\n", "3.2. Success Criteria\n", "Define the criteria for determining the success of the POC.\n", "4. Stakeholders\n", "4.1. Stakeholder List\n", "List key stakeholders involved in the POC.\n", "Name\tRole\tContact Information\n", "\t\t\n", "\t\t\n", "5. Requirements\n", "5.1. Functional Requirements\n", "List the critical functional requirements.\n", "Requirement ID\tDescription\tPriority\tAcceptance Criteria\n", "\t\t\t\n", "\t\t\t\n", "5.2. Non-Functional Requirements\n", "List key non-functional requirements, if any.\n", "Requirement ID\tDescription\tPriority\tAcceptance Criteria\n", "\t\t\t\n", "\t\t\t\n", "6. Assumptions and Constraints\n", "6.1. Assumptions\n", "List assumptions made during the POC planning.\n", "6.2. Constraints\n", "Describe any constraints, such as budget, time, or technology limitations.\n", "7. Risks and Mitigation\n", "7.1. Identified Risks\n", "List potential risks and mitigation strategies.\n", "Risk ID\tDescription\tImpact\tProbability\tMitigation Strategy\n", "\t\t\t\t\n", "8. Dependencies\n", "8.1. Dependencies\n", "List any dependencies relevant to the POC.\n", "9. Glossary\n", "Define key terms and acronyms used in the document.\n", "\n", "Jessica Davis (Technical Lead): Technically, we should consider the possibility of future expansions. This means building in modular capabilities so new features can be added as customer needs evolve without major disruptions to the existing system.\n", " \n", "Taylor Brown (Stakeholder Representative): Finally, from a business perspective, we need a detailed cost-benefit analysis post-implementation to measure whether the project has met its ROI targets and how it has impacted customer metrics and overall business operations.\n", " \n", "Alex Johnson (Project Manager): With all these points in detail, our next steps are to draft a comprehensive project plan that includes timelines, budgeting, and resource allocation based on today’s discussion. Let’s aim to have that ready by next week’s meeting.\n", "\n", "Jessica Davis (Technical Lead): Technically, we should consider the possibility of future expansions. This means building in modular capabilities so new features can be added as customer needs evolve without major disruptions to the existing system.\n", " \n", "Taylor Brown (Stakeholder Representative): Finally, from a business perspective, we need a detailed cost-benefit analysis post-implementation to measure whether the project has met its ROI targets and how it has impacted customer metrics and overall business operations.\n", " \n", "Alex Johnson (Project Manager): With all these points in detail, our next steps are to draft a comprehensive project plan that includes timelines, budgeting, and resource allocation based on today’s discussion. Let’s aim to have that ready by next week’s meeting.\n", "\u001b[00m\n", "\u001b[32;1m\u001b[1;3mFinal Answer:\n", "\n", "# Business Requirements Document (BRD)\n", "\n", "## Document Information\n", "- Document Title: Business Requirements Document for Advanced Analytics Integration\n", "- Date: [Current Date]\n", "- Author: [Your Name]\n", "- Version: 1.0\n", "\n", "## Executive Summary\n", "### 2.1. Purpose\n", "The purpose of this document is to outline the business requirements for integrating advanced analytics into the platform to enhance user experience and provide robust data insights.\n", "\n", "### 2.2. Project Background\n", "The project aims to address the business problem of improving customer engagement and satisfaction by increasing daily active users and reducing customer complaints through data-driven marketing strategies.\n", "\n", "### 2.3. Scope\n", "The scope of this project includes substantial updates to data processing infrastructure, possible migration to a scalable cloud solution, compliance with data protection regulations, and future-proofing the system for further upgrades.\n", "\n", "## Business Objectives\n", "### 3.1. Goals\n", "- Integrate advanced analytics to enhance user experience.\n", "- Increase daily active users and reduce customer complaints.\n", "- Realize a return on investment within one year post-implementation.\n", "\n", "### 3.2. Success Criteria\n", "- Increased user engagement metrics.\n", "- Reduced customer complaints by x%.\n", "- Revenue increase through data-driven marketing strategies.\n", "- Operational cost reduction by x%.\n", "\n", "## Stakeholders\n", "### 4.1. Stakeholder List\n", "| Name | Role | Contact Information |\n", "|-----------------|-----------------------|---------------------|\n", "| Internal Stakeholders | IT and customer service teams | - |\n", "| External Stakeholders | Technology partners and end-users | - |\n", "\n", "## Requirements\n", "### 5.1. Functional Requirements\n", "| Requirement ID | Description | Priority | Acceptance Criteria |\n", "|----------------|-------------|----------|----------------------|\n", "\n", "### 5.2. Non-Functional Requirements\n", "| Requirement ID | Description | Priority | Acceptance Criteria |\n", "|----------------|-------------|----------|----------------------|\n", "\n", "## Assumptions and Constraints\n", "### 6.1. Assumptions\n", "- [List of assumptions made during planning]\n", "\n", "### 6.2. Constraints\n", "- [Description of any constraints such as budget, time, or technology limitations]\n", "\n", "## Risks and Mitigation\n", "### 7.1. Identified Risks\n", "| Risk ID | Description | Impact | Probability | Mitigation Strategy |\n", "|---------|-------------|--------|-------------|----------------------|\n", "\n", "## Dependencies\n", "### 8.1. Dependencies\n", "- [List of dependencies relevant to the project]\n", "\n", "## Glossary\n", "- [Define key terms and acronyms used in the document]\n", "\n", "---\n", "\n", "**Technical Lead Input (Jessica Davis):**\n", "Technically, we should consider the possibility of future expansions. This means building in modular capabilities so new features can be added as customer needs evolve without major disruptions to the existing system.\n", "\n", "**Stakeholder Representative Input (Taylor Brown):**\n", "Finally, from a business perspective, we need a detailed cost-benefit analysis post-implementation to measure whether the project has met its ROI targets and how it has impacted customer metrics and overall business operations.\n", "\n", "**Project Manager Input (Alex Johnson):**\n", "With all these points in detail, our next steps are to draft a comprehensive project plan that includes timelines, budgeting, and resource allocation based on today’s discussion. Let’s aim to have that ready by next week’s meeting.\u001b[0m\n", "\n", "\u001b[1m> Finished chain.\u001b[0m\n", "\u001b[1m\u001b[92m [DEBUG]: == [BRD Compiler] Task output: # Business Requirements Document (BRD)\n", "\n", "## Document Information\n", "- Document Title: Business Requirements Document for Advanced Analytics Integration\n", "- Date: [Current Date]\n", "- Author: [Your Name]\n", "- Version: 1.0\n", "\n", "## Executive Summary\n", "### 2.1. Purpose\n", "The purpose of this document is to outline the business requirements for integrating advanced analytics into the platform to enhance user experience and provide robust data insights.\n", "\n", "### 2.2. Project Background\n", "The project aims to address the business problem of improving customer engagement and satisfaction by increasing daily active users and reducing customer complaints through data-driven marketing strategies.\n", "\n", "### 2.3. Scope\n", "The scope of this project includes substantial updates to data processing infrastructure, possible migration to a scalable cloud solution, compliance with data protection regulations, and future-proofing the system for further upgrades.\n", "\n", "## Business Objectives\n", "### 3.1. Goals\n", "- Integrate advanced analytics to enhance user experience.\n", "- Increase daily active users and reduce customer complaints.\n", "- Realize a return on investment within one year post-implementation.\n", "\n", "### 3.2. Success Criteria\n", "- Increased user engagement metrics.\n", "- Reduced customer complaints by x%.\n", "- Revenue increase through data-driven marketing strategies.\n", "- Operational cost reduction by x%.\n", "\n", "## Stakeholders\n", "### 4.1. Stakeholder List\n", "| Name | Role | Contact Information |\n", "|-----------------|-----------------------|---------------------|\n", "| Internal Stakeholders | IT and customer service teams | - |\n", "| External Stakeholders | Technology partners and end-users | - |\n", "\n", "## Requirements\n", "### 5.1. Functional Requirements\n", "| Requirement ID | Description | Priority | Acceptance Criteria |\n", "|----------------|-------------|----------|----------------------|\n", "\n", "### 5.2. Non-Functional Requirements\n", "| Requirement ID | Description | Priority | Acceptance Criteria |\n", "|----------------|-------------|----------|----------------------|\n", "\n", "## Assumptions and Constraints\n", "### 6.1. Assumptions\n", "- [List of assumptions made during planning]\n", "\n", "### 6.2. Constraints\n", "- [Description of any constraints such as budget, time, or technology limitations]\n", "\n", "## Risks and Mitigation\n", "### 7.1. Identified Risks\n", "| Risk ID | Description | Impact | Probability | Mitigation Strategy |\n", "|---------|-------------|--------|-------------|----------------------|\n", "\n", "## Dependencies\n", "### 8.1. Dependencies\n", "- [List of dependencies relevant to the project]\n", "\n", "## Glossary\n", "- [Define key terms and acronyms used in the document]\n", "\n", "---\n", "\n", "**Technical Lead Input (Jessica Davis):**\n", "Technically, we should consider the possibility of future expansions. This means building in modular capabilities so new features can be added as customer needs evolve without major disruptions to the existing system.\n", "\n", "**Stakeholder Representative Input (Taylor Brown):**\n", "Finally, from a business perspective, we need a detailed cost-benefit analysis post-implementation to measure whether the project has met its ROI targets and how it has impacted customer metrics and overall business operations.\n", "\n", "**Project Manager Input (Alex Johnson):**\n", "With all these points in detail, our next steps are to draft a comprehensive project plan that includes timelines, budgeting, and resource allocation based on today’s discussion. Let’s aim to have that ready by next week’s meeting.\n", "\n", "\u001b[00m\n" ] } ], "source": [ "\n", "with gr.Blocks() as demo:\n", " with gr.Row():\n", " file_input = gr.File(label=\"Upload a text file\")\n", " download_btn = gr.File(label=\"Download Processed File in Markdown\", file_count=\"single\")\n", " with gr.Row():\n", " markdown_output = gr.Markdown()\n", "\n", " file_input.change(process_file, inputs=file_input, outputs=[download_btn, markdown_output])\n", "\n", "demo.launch(share=True)\n" ] } ], "metadata": { "colab": { "gpuType": "T4", "provenance": [] }, "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.9" } }, "nbformat": 4, "nbformat_minor": 4 }