From 3c150dc5a2e0e5440510b5e69adb6085a012cbd3 Mon Sep 17 00:00:00 2001 From: Madhu Date: Wed, 8 Jan 2025 18:28:02 +0530 Subject: [PATCH 1/7] AI Personalized Learning Agent: phidata + googledocs --- .../ai_personal_learning_agent/README.md | 59 ++++++ .../ai_personal_learning_agent.py | 193 ++++++++++++++++++ .../requirements.txt | 6 + 3 files changed, 258 insertions(+) create mode 100644 ai_agent_tutorials/ai_personal_learning_agent/README.md create mode 100644 ai_agent_tutorials/ai_personal_learning_agent/ai_personal_learning_agent.py create mode 100644 ai_agent_tutorials/ai_personal_learning_agent/requirements.txt diff --git a/ai_agent_tutorials/ai_personal_learning_agent/README.md b/ai_agent_tutorials/ai_personal_learning_agent/README.md new file mode 100644 index 0000000..dbe1b67 --- /dev/null +++ b/ai_agent_tutorials/ai_personal_learning_agent/README.md @@ -0,0 +1,59 @@ +# AI Personal Learning Agent + +A Personal learning assistant built on PraisonAI Framework that explains a particular topic, creates learning plans and roadmaps using multiple specialized AI agents which are self reflective and hierarchical. The system uses OpenAI's GPT-4o to generate comprehensive learning materials, roadmaps, and practice exercises. + +## Features + +- 🧠 Knowledge Building: Researches and creates comprehensive knowledge bases +- πŸ—ΊοΈ Learning Roadmaps: Generates structured learning paths with time estimates +- πŸ“š Resource Curation: Finds and validates high-quality learning materials +- ✍️ Practice Materials: Creates progressive exercises and projects +- πŸ” Internet Search Integration: Used a custom InternetSearchTool tool for real-time research +- πŸ“Š Live Terminal Output: Shows real-time agent interactions in terminal - also in streamlit UI + +## Agents + +1. **KnowledgeBuilder**: Research specialist that gathers and organizes information +2. **RoadmapArchitect**: Curriculum designer that creates structured learning paths +3. **ResourceCurator**: Resource specialist that finds and validates learning materials +4. **PracticeDesigner**: Exercise creator that develops practice materials + + +## How to Run + +1. Clone the repository + ```bash + # Clone the repository + git clone https://github.com/Shubhamsaboo/awesome-llm-apps.git + cd ai_agent_tutorials/ai_personal_learning_agent + + # Install dependencies + pip install -r requirements.txt + ``` + +## Configuration + +1. Get your OpenAI API Key +- Create an account on [OpenAI Platform](https://platform.openai.com/) +- Navigate to API Keys section +- Create a new API key + +2. (Optional) Set up environment variables +```bash +export OPENAI_API_KEY='your-api-key-here' +``` +This way of using the openai key is fundamental to how PraisonAI is designed - it initializes the OpenAI client at module import time, which means setting the environment variable after import won't help. We need to set the environment variable BEFORE importing PraisonAI. So, export way helps majorly - else if you want to use streamlit, keep the session state openai api key intializations before the imports of praisonAI + +## Usage + +1. Start the Streamlit app +```bash +streamlit run ai_personal_learning_agent.py +``` + +2. Use the application +- Enter your OpenAI API key in the sidebar (if not set in environment) +- Type a topic you want to learn about (e.g., "Python Programming", "Machine Learning") +- Click "Generate Learning Plan" +- Wait for the agents to generate your personalized learning plan +- View the results and terminal output in the interface \ No newline at end of file diff --git a/ai_agent_tutorials/ai_personal_learning_agent/ai_personal_learning_agent.py b/ai_agent_tutorials/ai_personal_learning_agent/ai_personal_learning_agent.py new file mode 100644 index 0000000..c822fa5 --- /dev/null +++ b/ai_agent_tutorials/ai_personal_learning_agent/ai_personal_learning_agent.py @@ -0,0 +1,193 @@ +import streamlit as st +from phi.agent import Agent, RunResponse +from phi.model.openai import OpenAIChat +from composio_phidata import Action, ComposioToolSet +import os +from phi.utils.pprint import pprint_run_response + +# Set page configuration +st.set_page_config(page_title="Learning Path Generator", layout="centered") + +# Initialize session state for API keys and topic +if 'openai_api_key' not in st.session_state: + st.session_state['openai_api_key'] = '' +if 'composio_api_key' not in st.session_state: + st.session_state['composio_api_key'] = '' +if 'topic' not in st.session_state: + st.session_state['topic'] = '' + +# Streamlit sidebar for API keys +with st.sidebar: + st.title("API Keys Configuration") + st.session_state['openai_api_key'] = st.text_input("Enter your OpenAI API Key", type="password").strip() + st.session_state['composio_api_key'] = st.text_input("Enter your Composio API Key", type="password").strip() + +# Validate API keys +if not st.session_state['openai_api_key'] or not st.session_state['composio_api_key']: + st.error("Please enter both OpenAI and Composio API keys in the sidebar.") + st.stop() + +# Set the OpenAI API key and Composio API key from session state +os.environ["OPENAI_API_KEY"] = st.session_state['openai_api_key'] + +try: + composio_toolset = ComposioToolSet(api_key=st.session_state['composio_api_key']) + google_docs_tool = composio_toolset.get_tools(actions=[Action.GOOGLEDOCS_CREATE_DOCUMENT])[0] +except Exception as e: + st.error(f"Error initializing ComposioToolSet: {e}") + st.stop() + +# Create the KnowledgeBuilder agent +knowledge_agent = Agent( + name="KnowledgeBuilder", + role="Research and Knowledge Specialist", + model=OpenAIChat(id="gpt-4o"), + tools=[google_docs_tool], + instructions=[ + "Research the given topic thoroughly using internet sources.", + "Create a comprehensive knowledge base that covers fundamental concepts, advanced topics, and current developments.", + "Include key terminology, core principles, and practical applications and make it as a detailed report that anyone who's starting out can read and get maximum value out of it.", + "Always include sources and citations for your findings.", + "Open a new Google Doc and write down the response of the agent neatly with great formatting and structure in it. **Include the Google Doc link in your response.**", + ], + show_tool_calls=True, + markdown=True, +) + +# Create the RoadmapArchitect agent +roadmap_agent = Agent( + name="RoadmapArchitect", + role="Learning Path Designer", + model=OpenAIChat(id="gpt-4o"), + tools=[google_docs_tool], + instructions=[ + "Using the knowledge base for the given topic, create a detailed learning roadmap.", + "Break down the topic into logical subtopics and arrange them in order of progression, a detailed report of roadmap that includes all the subtopics in order to be an expert in this topic.", + "Include estimated time commitments for each section.", + "Present the roadmap in a clear, structured format.", + "Open a new Google Doc and write down the response of the agent neatly with great formatting and structure in it. **Include the Google Doc link in your response.**", + ], + show_tool_calls=True, + markdown=True, +) + +# Create the ResourceCurator agent +resource_agent = Agent( + name="ResourceCurator", + role="Learning Resource Specialist", + model=OpenAIChat(id="gpt-4o"), + tools=[google_docs_tool], + instructions=[ + "Find and validate high-quality learning resources for the given topic.", + "Include technical blogs, GitHub repositories, official documentation, video tutorials, and courses.", + "Verify the credibility and relevance of each resource.", + "Present the resources in a curated list with descriptions and quality assessments.", + "Open a new Google Doc and write down the response of the agent neatly with great formatting and structure in it. **Include the Google Doc link in your response.**", + ], + show_tool_calls=True, + markdown=True, +) + +# Create the PracticeDesigner agent +practice_agent = Agent( + name="PracticeDesigner", + role="Exercise Creator", + model=OpenAIChat(id="gpt-4o"), + tools=[google_docs_tool], + instructions=[ + "Create comprehensive practice materials for the given topic.", + "Include progressive exercises, quizzes, hands-on projects, and real-world application scenarios.", + "Ensure the materials align with the roadmap progression.", + "Provide detailed solutions and explanations for all practice materials.", + "Open a new Google Doc and write down the response of the agent neatly with great formatting and structure in it. **Include the Google Doc link in your response.**", + ], + show_tool_calls=True, + markdown=True, +) + +# Streamlit main UI +st.title("AI Personal Learning Agent") +st.markdown("Enter a topic to generate a detailed learning path and resources") + +# Query bar for topic input +st.session_state['topic'] = st.text_input("Enter the topic you want to learn about:", placeholder="e.g., Machine Learning, LoRA, etc.") + +# Start button +if st.button("Start"): + if not st.session_state['topic']: + st.error("Please enter a topic.") + else: + # Display loading animations while generating responses + with st.spinner("Generating Knowledge Base..."): + knowledge_response: RunResponse = knowledge_agent.run( + f"the topic is: {st.session_state['topic']},Don't forget to add the Google Doc link in your response.", + stream=False + ) + + with st.spinner("Generating Learning Roadmap..."): + roadmap_response: RunResponse = roadmap_agent.run( + f"the topic is: {st.session_state['topic']},Don't forget to add the Google Doc link in your response.", + stream=False + ) + + with st.spinner("Curating Learning Resources..."): + resource_response: RunResponse = resource_agent.run( + f"the topic is: {st.session_state['topic']},Don't forget to add the Google Doc link in your response.", + stream=False + ) + + with st.spinner("Creating Practice Materials..."): + practice_response: RunResponse = practice_agent.run( + f"the topic is: {st.session_state['topic']},Don't forget to add the Google Doc link in your response.", + stream=False + ) + + # Extract Google Doc links from the responses + def extract_google_doc_link(response_content): + # Assuming the Google Doc link is embedded in the response content + # You may need to adjust this logic based on the actual response format + if "https://docs.google.com" in response_content: + return response_content.split("https://docs.google.com")[1].split()[0] + return None + + knowledge_doc_link = extract_google_doc_link(knowledge_response.content) + roadmap_doc_link = extract_google_doc_link(roadmap_response.content) + resource_doc_link = extract_google_doc_link(resource_response.content) + practice_doc_link = extract_google_doc_link(practice_response.content) + + # Display Google Doc links at the top of the Streamlit UI + st.markdown("### Google Doc Links:") + if knowledge_doc_link: + st.markdown(f"- **KnowledgeBuilder Document:** [View Document](https://docs.google.com{knowledge_doc_link})") + if roadmap_doc_link: + st.markdown(f"- **RoadmapArchitect Document:** [View Document](https://docs.google.com{roadmap_doc_link})") + if resource_doc_link: + st.markdown(f"- **ResourceCurator Document:** [View Document](https://docs.google.com{resource_doc_link})") + if practice_doc_link: + st.markdown(f"- **PracticeDesigner Document:** [View Document](https://docs.google.com{practice_doc_link})") + + # Display responses in the Streamlit UI using pprint_run_response + st.markdown("### KnowledgeBuilder Response:") + st.markdown(knowledge_response.content) + st.markdown(pprint_run_response(knowledge_response, markdown=True)) + + st.markdown("### RoadmapArchitect Response:") + st.markdown(roadmap_response.content) + st.markdown(pprint_run_response(roadmap_response, markdown=True)) + + st.markdown("### ResourceCurator Response:") + st.markdown(resource_response.content) + st.markdown(pprint_run_response(resource_response, markdown=True)) + + st.markdown("### PracticeDesigner Response:") + st.markdown(pprint_run_response(practice_response, markdown=True)) + +# Information about the agents +st.markdown("---") +st.markdown("### About the Agents:") +st.markdown(""" +- **KnowledgeBuilder**: Researches the topic and creates a detailed knowledge base. +- **RoadmapArchitect**: Designs a structured learning roadmap for the topic. +- **ResourceCurator**: Curates high-quality learning resources. +- **PracticeDesigner**: Creates practice materials, exercises, and projects. +""") \ No newline at end of file diff --git a/ai_agent_tutorials/ai_personal_learning_agent/requirements.txt b/ai_agent_tutorials/ai_personal_learning_agent/requirements.txt new file mode 100644 index 0000000..bb326a1 --- /dev/null +++ b/ai_agent_tutorials/ai_personal_learning_agent/requirements.txt @@ -0,0 +1,6 @@ +streamlit==1.41.1 +openai==1.58.1 +duckduckgo-search==6.4.1 +typing-extensions>=4.5.0 +phidata +composio-phidata \ No newline at end of file From 1e941468dba05855d5c3252dea62bc468103b003 Mon Sep 17 00:00:00 2001 From: Madhu Date: Wed, 8 Jan 2025 18:34:04 +0530 Subject: [PATCH 2/7] AI Personalized Learning Agent: phidata + googledocs1 --- .../ai_personal_learning_agent.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ai_agent_tutorials/ai_personal_learning_agent/ai_personal_learning_agent.py b/ai_agent_tutorials/ai_personal_learning_agent/ai_personal_learning_agent.py index c822fa5..bbd596c 100644 --- a/ai_agent_tutorials/ai_personal_learning_agent/ai_personal_learning_agent.py +++ b/ai_agent_tutorials/ai_personal_learning_agent/ai_personal_learning_agent.py @@ -169,18 +169,19 @@ if st.button("Start"): # Display responses in the Streamlit UI using pprint_run_response st.markdown("### KnowledgeBuilder Response:") st.markdown(knowledge_response.content) - st.markdown(pprint_run_response(knowledge_response, markdown=True)) + pprint_run_response(knowledge_response, markdown=True) st.markdown("### RoadmapArchitect Response:") st.markdown(roadmap_response.content) - st.markdown(pprint_run_response(roadmap_response, markdown=True)) + pprint_run_response(roadmap_response, markdown=True) st.markdown("### ResourceCurator Response:") st.markdown(resource_response.content) - st.markdown(pprint_run_response(resource_response, markdown=True)) + pprint_run_response(resource_response, markdown=True) st.markdown("### PracticeDesigner Response:") - st.markdown(pprint_run_response(practice_response, markdown=True)) + st.markdown(practice_response.content) + pprint_run_response(practice_response, markdown=True) # Information about the agents st.markdown("---") From 19fbdd18f2acb6ba8c3a192861098234814dddc5 Mon Sep 17 00:00:00 2001 From: Madhu Date: Wed, 8 Jan 2025 20:55:40 +0530 Subject: [PATCH 3/7] AI Personalized Learning Agent: phidata + googledocs2 --- .../ai_personal_learning_agent.py | 37 +++++++++++++------ 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/ai_agent_tutorials/ai_personal_learning_agent/ai_personal_learning_agent.py b/ai_agent_tutorials/ai_personal_learning_agent/ai_personal_learning_agent.py index bbd596c..1f0a5ab 100644 --- a/ai_agent_tutorials/ai_personal_learning_agent/ai_personal_learning_agent.py +++ b/ai_agent_tutorials/ai_personal_learning_agent/ai_personal_learning_agent.py @@ -3,7 +3,9 @@ from phi.agent import Agent, RunResponse from phi.model.openai import OpenAIChat from composio_phidata import Action, ComposioToolSet import os +from phi.tools.arxiv_toolkit import ArxivToolkit from phi.utils.pprint import pprint_run_response +from phi.tools.duckduckgo import DuckDuckGo # Set page configuration st.set_page_config(page_title="Learning Path Generator", layout="centered") @@ -21,6 +23,9 @@ with st.sidebar: st.title("API Keys Configuration") st.session_state['openai_api_key'] = st.text_input("Enter your OpenAI API Key", type="password").strip() st.session_state['composio_api_key'] = st.text_input("Enter your Composio API Key", type="password").strip() + + # Add info about terminal responses + st.info("Note: You can also view detailed agent responses\nin your terminal after execution.") # Validate API keys if not st.session_state['openai_api_key'] or not st.session_state['composio_api_key']: @@ -33,6 +38,7 @@ os.environ["OPENAI_API_KEY"] = st.session_state['openai_api_key'] try: composio_toolset = ComposioToolSet(api_key=st.session_state['composio_api_key']) google_docs_tool = composio_toolset.get_tools(actions=[Action.GOOGLEDOCS_CREATE_DOCUMENT])[0] + google_docs_tool_update = composio_toolset.get_tools(actions=[Action.GOOGLEDOCS_UPDATE_EXISTING_DOCUMENT])[0] except Exception as e: st.error(f"Error initializing ComposioToolSet: {e}") st.stop() @@ -40,14 +46,15 @@ except Exception as e: # Create the KnowledgeBuilder agent knowledge_agent = Agent( name="KnowledgeBuilder", - role="Research and Knowledge Specialist", + role="Research and Knowledge Specialist", model=OpenAIChat(id="gpt-4o"), - tools=[google_docs_tool], + tools=[google_docs_tool, DuckDuckGo()], instructions=[ "Research the given topic thoroughly using internet sources.", + "Use the DuckDuckGo search tool to find up-to-date information and resources.", "Create a comprehensive knowledge base that covers fundamental concepts, advanced topics, and current developments.", "Include key terminology, core principles, and practical applications and make it as a detailed report that anyone who's starting out can read and get maximum value out of it.", - "Always include sources and citations for your findings.", + "Always include sources and citations for your findings. DONT FORGET TO CREATE THE GOOGLE DOCUMENT.", "Open a new Google Doc and write down the response of the agent neatly with great formatting and structure in it. **Include the Google Doc link in your response.**", ], show_tool_calls=True, @@ -64,8 +71,9 @@ roadmap_agent = Agent( "Using the knowledge base for the given topic, create a detailed learning roadmap.", "Break down the topic into logical subtopics and arrange them in order of progression, a detailed report of roadmap that includes all the subtopics in order to be an expert in this topic.", "Include estimated time commitments for each section.", - "Present the roadmap in a clear, structured format.", + "Present the roadmap in a clear, structured format. DONT FORGET TO CREATE THE GOOGLE DOCUMENT.", "Open a new Google Doc and write down the response of the agent neatly with great formatting and structure in it. **Include the Google Doc link in your response.**", + ], show_tool_calls=True, markdown=True, @@ -76,12 +84,13 @@ resource_agent = Agent( name="ResourceCurator", role="Learning Resource Specialist", model=OpenAIChat(id="gpt-4o"), - tools=[google_docs_tool], + tools=[google_docs_tool, ArxivToolkit(), DuckDuckGo()], instructions=[ "Find and validate high-quality learning resources for the given topic.", + "Use the DuckDuckGo search tool to find current and relevant learning materials.", "Include technical blogs, GitHub repositories, official documentation, video tutorials, and courses.", "Verify the credibility and relevance of each resource.", - "Present the resources in a curated list with descriptions and quality assessments.", + "Present the resources in a curated list with descriptions and quality assessments. DONT FORGET TO CREATE THE GOOGLE DOCUMENT.", "Open a new Google Doc and write down the response of the agent neatly with great formatting and structure in it. **Include the Google Doc link in your response.**", ], show_tool_calls=True, @@ -93,12 +102,13 @@ practice_agent = Agent( name="PracticeDesigner", role="Exercise Creator", model=OpenAIChat(id="gpt-4o"), - tools=[google_docs_tool], + tools=[google_docs_tool, DuckDuckGo()], instructions=[ "Create comprehensive practice materials for the given topic.", + "Use the DuckDuckGo search tool to find example problems and real-world applications.", "Include progressive exercises, quizzes, hands-on projects, and real-world application scenarios.", "Ensure the materials align with the roadmap progression.", - "Provide detailed solutions and explanations for all practice materials.", + "Provide detailed solutions and explanations for all practice materials.DONT FORGET TO CREATE THE GOOGLE DOCUMENT.", "Open a new Google Doc and write down the response of the agent neatly with great formatting and structure in it. **Include the Google Doc link in your response.**", ], show_tool_calls=True, @@ -106,9 +116,12 @@ practice_agent = Agent( ) # Streamlit main UI -st.title("AI Personal Learning Agent") +st.title("AI Learning Roadmap Agent") st.markdown("Enter a topic to generate a detailed learning path and resources") +# Add info message about Google Docs +st.info("πŸ“ The agents will create detailed Google Docs for each section (Knowledge Base, Learning Roadmap, Resources, and Practice Materials). The links to these documents will be displayed below after processing.") + # Query bar for topic input st.session_state['topic'] = st.text_input("Enter the topic you want to learn about:", placeholder="e.g., Machine Learning, LoRA, etc.") @@ -170,19 +183,21 @@ if st.button("Start"): st.markdown("### KnowledgeBuilder Response:") st.markdown(knowledge_response.content) pprint_run_response(knowledge_response, markdown=True) - + st.divider() st.markdown("### RoadmapArchitect Response:") st.markdown(roadmap_response.content) pprint_run_response(roadmap_response, markdown=True) + st.divider() st.markdown("### ResourceCurator Response:") st.markdown(resource_response.content) pprint_run_response(resource_response, markdown=True) + st.divider() st.markdown("### PracticeDesigner Response:") st.markdown(practice_response.content) pprint_run_response(practice_response, markdown=True) - + st.divider() # Information about the agents st.markdown("---") st.markdown("### About the Agents:") From 0d2f04f390dd15af5eeb8837e821d5e567a7a4c5 Mon Sep 17 00:00:00 2001 From: Madhu Date: Wed, 8 Jan 2025 21:29:15 +0530 Subject: [PATCH 4/7] AI Personalized Learning Agent: phidata + googledocs3 --- .../ai_personal_learning_agent.py | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/ai_agent_tutorials/ai_personal_learning_agent/ai_personal_learning_agent.py b/ai_agent_tutorials/ai_personal_learning_agent/ai_personal_learning_agent.py index 1f0a5ab..3460515 100644 --- a/ai_agent_tutorials/ai_personal_learning_agent/ai_personal_learning_agent.py +++ b/ai_agent_tutorials/ai_personal_learning_agent/ai_personal_learning_agent.py @@ -47,14 +47,12 @@ except Exception as e: knowledge_agent = Agent( name="KnowledgeBuilder", role="Research and Knowledge Specialist", - model=OpenAIChat(id="gpt-4o"), - tools=[google_docs_tool, DuckDuckGo()], + model=OpenAIChat(id="gpt-4o", api_key=st.session_state['openai_api_key']), + tools=[google_docs_tool], instructions=[ - "Research the given topic thoroughly using internet sources.", - "Use the DuckDuckGo search tool to find up-to-date information and resources.", - "Create a comprehensive knowledge base that covers fundamental concepts, advanced topics, and current developments.", + "Create a comprehensive knowledge base that covers fundamental concepts, advanced topics, and current developments of the given topic.", "Include key terminology, core principles, and practical applications and make it as a detailed report that anyone who's starting out can read and get maximum value out of it.", - "Always include sources and citations for your findings. DONT FORGET TO CREATE THE GOOGLE DOCUMENT.", + "Make sure it is formatted in a way that is easy to read and understand. DONT FORGET TO CREATE THE GOOGLE DOCUMENT.", "Open a new Google Doc and write down the response of the agent neatly with great formatting and structure in it. **Include the Google Doc link in your response.**", ], show_tool_calls=True, @@ -65,7 +63,7 @@ knowledge_agent = Agent( roadmap_agent = Agent( name="RoadmapArchitect", role="Learning Path Designer", - model=OpenAIChat(id="gpt-4o"), + model=OpenAIChat(id="gpt-4o", api_key=st.session_state['openai_api_key']), tools=[google_docs_tool], instructions=[ "Using the knowledge base for the given topic, create a detailed learning roadmap.", @@ -76,15 +74,15 @@ roadmap_agent = Agent( ], show_tool_calls=True, - markdown=True, + markdown=True ) # Create the ResourceCurator agent resource_agent = Agent( name="ResourceCurator", role="Learning Resource Specialist", - model=OpenAIChat(id="gpt-4o"), - tools=[google_docs_tool, ArxivToolkit(), DuckDuckGo()], + model=OpenAIChat(id="gpt-4o", api_key=st.session_state['openai_api_key']), + tools=[google_docs_tool, ArxivToolkit(), DuckDuckGo(fixed_max_results=10)], instructions=[ "Find and validate high-quality learning resources for the given topic.", "Use the DuckDuckGo search tool to find current and relevant learning materials.", @@ -101,8 +99,8 @@ resource_agent = Agent( practice_agent = Agent( name="PracticeDesigner", role="Exercise Creator", - model=OpenAIChat(id="gpt-4o"), - tools=[google_docs_tool, DuckDuckGo()], + model=OpenAIChat(id="gpt-4o", api_key=st.session_state['openai_api_key']), + tools=[google_docs_tool, DuckDuckGo(fixed_max_results=10)], instructions=[ "Create comprehensive practice materials for the given topic.", "Use the DuckDuckGo search tool to find example problems and real-world applications.", From f7b1c8f4eb8e3cd6f5de4d0d1c439febd28336fa Mon Sep 17 00:00:00 2001 From: Madhu Date: Wed, 8 Jan 2025 22:14:13 +0530 Subject: [PATCH 5/7] AI Personalized Learning Agent: phidata + googledocs4 --- .../ai_personal_learning_agent/README.md | 17 +++++++++-------- .../ai_personal_learning_agent/requirements.txt | 5 +++-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/ai_agent_tutorials/ai_personal_learning_agent/README.md b/ai_agent_tutorials/ai_personal_learning_agent/README.md index dbe1b67..eaedb7c 100644 --- a/ai_agent_tutorials/ai_personal_learning_agent/README.md +++ b/ai_agent_tutorials/ai_personal_learning_agent/README.md @@ -1,6 +1,6 @@ # AI Personal Learning Agent -A Personal learning assistant built on PraisonAI Framework that explains a particular topic, creates learning plans and roadmaps using multiple specialized AI agents which are self reflective and hierarchical. The system uses OpenAI's GPT-4o to generate comprehensive learning materials, roadmaps, and practice exercises. +A Personal learning Roadmap Architect assistant built on Phidata Framework that explains a particular topic, creates learning plans and roadmaps using multiple specialized AI agents which are hierarchical. The system uses OpenAI's GPT-4o to generate comprehensive learning materials, roadmaps, and practice exercises. This uses streamlit for UI. ## Features @@ -8,7 +8,7 @@ A Personal learning assistant built on PraisonAI Framework that explains a parti - πŸ—ΊοΈ Learning Roadmaps: Generates structured learning paths with time estimates - πŸ“š Resource Curation: Finds and validates high-quality learning materials - ✍️ Practice Materials: Creates progressive exercises and projects -- πŸ” Internet Search Integration: Used a custom InternetSearchTool tool for real-time research +- πŸ” Internet Search Integration: Used a DuckDuckGo tool for real-time research - πŸ“Š Live Terminal Output: Shows real-time agent interactions in terminal - also in streamlit UI ## Agents @@ -31,18 +31,18 @@ A Personal learning assistant built on PraisonAI Framework that explains a parti pip install -r requirements.txt ``` -## Configuration +## Configuration - IMPORTANT STEP 1. Get your OpenAI API Key - Create an account on [OpenAI Platform](https://platform.openai.com/) - Navigate to API Keys section - Create a new API key -2. (Optional) Set up environment variables -```bash -export OPENAI_API_KEY='your-api-key-here' -``` -This way of using the openai key is fundamental to how PraisonAI is designed - it initializes the OpenAI client at module import time, which means setting the environment variable after import won't help. We need to set the environment variable BEFORE importing PraisonAI. So, export way helps majorly - else if you want to use streamlit, keep the session state openai api key intializations before the imports of praisonAI +2. Get your Composio API Key +- Create an account on [Composio Platform](https://composio.ai/) +- [IMPORTANT] - For you to use the app, you need to make new connection ID with google docs and composio.Follow the below two steps to do so: +- composio add googledocs (IN THE TERMINAL) -> Create a new connection -> Select OAUTH2 -> Select Google Account and Done. +- In the composio account website, go to apps, select google docs tool, and click create integration (violet button) and click Try connecting default’s googldocs button and we are done. (https://app.composio.dev/app/googledocs ) ## Usage @@ -53,6 +53,7 @@ streamlit run ai_personal_learning_agent.py 2. Use the application - Enter your OpenAI API key in the sidebar (if not set in environment) +- Enter your Composio API key in the sidebar - Type a topic you want to learn about (e.g., "Python Programming", "Machine Learning") - Click "Generate Learning Plan" - Wait for the agents to generate your personalized learning plan diff --git a/ai_agent_tutorials/ai_personal_learning_agent/requirements.txt b/ai_agent_tutorials/ai_personal_learning_agent/requirements.txt index bb326a1..d9db440 100644 --- a/ai_agent_tutorials/ai_personal_learning_agent/requirements.txt +++ b/ai_agent_tutorials/ai_personal_learning_agent/requirements.txt @@ -2,5 +2,6 @@ streamlit==1.41.1 openai==1.58.1 duckduckgo-search==6.4.1 typing-extensions>=4.5.0 -phidata -composio-phidata \ No newline at end of file +phidata==2.7.3 +composio-phidata==0.6.9 +composio_core \ No newline at end of file From f0df9532d7bba649687324dbbac2ef0aa1a2e326 Mon Sep 17 00:00:00 2001 From: Madhu Date: Wed, 8 Jan 2025 22:15:24 +0530 Subject: [PATCH 6/7] AI Personalized Learning Agent: phidata + googledocs5 --- ai_agent_tutorials/ai_personal_learning_agent/requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ai_agent_tutorials/ai_personal_learning_agent/requirements.txt b/ai_agent_tutorials/ai_personal_learning_agent/requirements.txt index d9db440..ef78290 100644 --- a/ai_agent_tutorials/ai_personal_learning_agent/requirements.txt +++ b/ai_agent_tutorials/ai_personal_learning_agent/requirements.txt @@ -4,4 +4,5 @@ duckduckgo-search==6.4.1 typing-extensions>=4.5.0 phidata==2.7.3 composio-phidata==0.6.9 -composio_core \ No newline at end of file +composio_core +composio==0.1.1 From b6d2da726837020af6efdffac42525246c390432 Mon Sep 17 00:00:00 2001 From: Madhu Shantan Date: Wed, 8 Jan 2025 22:44:05 +0530 Subject: [PATCH 7/7] Update README.md --- ai_agent_tutorials/ai_personal_learning_agent/README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ai_agent_tutorials/ai_personal_learning_agent/README.md b/ai_agent_tutorials/ai_personal_learning_agent/README.md index eaedb7c..2adbbc5 100644 --- a/ai_agent_tutorials/ai_personal_learning_agent/README.md +++ b/ai_agent_tutorials/ai_personal_learning_agent/README.md @@ -2,6 +2,13 @@ A Personal learning Roadmap Architect assistant built on Phidata Framework that explains a particular topic, creates learning plans and roadmaps using multiple specialized AI agents which are hierarchical. The system uses OpenAI's GPT-4o to generate comprehensive learning materials, roadmaps, and practice exercises. This uses streamlit for UI. +## Demo + + +https://github.com/user-attachments/assets/67e81377-d80e-4221-b1f2-e25cffb71c93 + + + ## Features - 🧠 Knowledge Building: Researches and creates comprehensive knowledge bases @@ -57,4 +64,4 @@ streamlit run ai_personal_learning_agent.py - Type a topic you want to learn about (e.g., "Python Programming", "Machine Learning") - Click "Generate Learning Plan" - Wait for the agents to generate your personalized learning plan -- View the results and terminal output in the interface \ No newline at end of file +- View the results and terminal output in the interface