Updated agent names and related variables
This commit is contained in:
parent
06f06e1d12
commit
513fb7bee2
1 changed files with 52 additions and 51 deletions
|
|
@ -8,7 +8,7 @@ from phi.utils.pprint import pprint_run_response
|
||||||
from phi.tools.serpapi_tools import SerpApiTools
|
from phi.tools.serpapi_tools import SerpApiTools
|
||||||
|
|
||||||
# Set page configuration
|
# Set page configuration
|
||||||
st.set_page_config(page_title="Learning Path Generator", layout="centered")
|
st.set_page_config(page_title="👨🏫 AI Teaching Agent Team", layout="centered")
|
||||||
|
|
||||||
# Initialize session state for API keys and topic
|
# Initialize session state for API keys and topic
|
||||||
if 'openai_api_key' not in st.session_state:
|
if 'openai_api_key' not in st.session_state:
|
||||||
|
|
@ -46,11 +46,11 @@ except Exception as e:
|
||||||
st.error(f"Error initializing ComposioToolSet: {e}")
|
st.error(f"Error initializing ComposioToolSet: {e}")
|
||||||
st.stop()
|
st.stop()
|
||||||
|
|
||||||
# Create the KnowledgeBuilder agent
|
# Create the Professor agent (formerly KnowledgeBuilder)
|
||||||
knowledge_agent = Agent(
|
professor_agent = Agent(
|
||||||
name="KnowledgeBuilder",
|
name="Professor",
|
||||||
role="Research and Knowledge Specialist",
|
role="Research and Knowledge Specialist",
|
||||||
model=OpenAIChat(id="gpt-4o", api_key=st.session_state['openai_api_key']),
|
model=OpenAIChat(id="gpt-4o-mini", api_key=st.session_state['openai_api_key']),
|
||||||
tools=[google_docs_tool],
|
tools=[google_docs_tool],
|
||||||
instructions=[
|
instructions=[
|
||||||
"Create a comprehensive knowledge base that covers fundamental concepts, advanced topics, and current developments of the given topic.",
|
"Create a comprehensive knowledge base that covers fundamental concepts, advanced topics, and current developments of the given topic.",
|
||||||
|
|
@ -62,11 +62,11 @@ knowledge_agent = Agent(
|
||||||
markdown=True,
|
markdown=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Create the RoadmapArchitect agent
|
# Create the Academic Advisor agent (formerly RoadmapArchitect)
|
||||||
roadmap_agent = Agent(
|
academic_advisor_agent = Agent(
|
||||||
name="RoadmapArchitect",
|
name="Academic Advisor",
|
||||||
role="Learning Path Designer",
|
role="Learning Path Designer",
|
||||||
model=OpenAIChat(id="gpt-4o", api_key=st.session_state['openai_api_key']),
|
model=OpenAIChat(id="gpt-4o-mini", api_key=st.session_state['openai_api_key']),
|
||||||
tools=[google_docs_tool],
|
tools=[google_docs_tool],
|
||||||
instructions=[
|
instructions=[
|
||||||
"Using the knowledge base for the given topic, create a detailed learning roadmap.",
|
"Using the knowledge base for the given topic, create a detailed learning roadmap.",
|
||||||
|
|
@ -80,11 +80,11 @@ roadmap_agent = Agent(
|
||||||
markdown=True
|
markdown=True
|
||||||
)
|
)
|
||||||
|
|
||||||
# Create the ResourceCurator agent
|
# Create the Research Librarian agent (formerly ResourceCurator)
|
||||||
resource_agent = Agent(
|
research_librarian_agent = Agent(
|
||||||
name="ResourceCurator",
|
name="Research Librarian",
|
||||||
role="Learning Resource Specialist",
|
role="Learning Resource Specialist",
|
||||||
model=OpenAIChat(id="gpt-4o", api_key=st.session_state['openai_api_key']),
|
model=OpenAIChat(id="gpt-4o-mini", api_key=st.session_state['openai_api_key']),
|
||||||
tools=[google_docs_tool, SerpApiTools(api_key=st.session_state['serpapi_api_key']) ],
|
tools=[google_docs_tool, SerpApiTools(api_key=st.session_state['serpapi_api_key']) ],
|
||||||
instructions=[
|
instructions=[
|
||||||
"Make a list of high-quality learning resources for the given topic.",
|
"Make a list of high-quality learning resources for the given topic.",
|
||||||
|
|
@ -97,11 +97,11 @@ resource_agent = Agent(
|
||||||
markdown=True,
|
markdown=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Create the PracticeDesigner agent
|
# Create the Teaching Assistant agent (formerly PracticeDesigner)
|
||||||
practice_agent = Agent(
|
teaching_assistant_agent = Agent(
|
||||||
name="PracticeDesigner",
|
name="Teaching Assistant",
|
||||||
role="Exercise Creator",
|
role="Exercise Creator",
|
||||||
model=OpenAIChat(id="gpt-4o", api_key=st.session_state['openai_api_key']),
|
model=OpenAIChat(id="gpt-4o-mini", api_key=st.session_state['openai_api_key']),
|
||||||
tools=[google_docs_tool, SerpApiTools(api_key=st.session_state['serpapi_api_key'])],
|
tools=[google_docs_tool, SerpApiTools(api_key=st.session_state['serpapi_api_key'])],
|
||||||
instructions=[
|
instructions=[
|
||||||
"Create comprehensive practice materials for the given topic.",
|
"Create comprehensive practice materials for the given topic.",
|
||||||
|
|
@ -116,11 +116,11 @@ practice_agent = Agent(
|
||||||
)
|
)
|
||||||
|
|
||||||
# Streamlit main UI
|
# Streamlit main UI
|
||||||
st.title("AI Learning Roadmap Agent")
|
st.title("👨🏫 AI Teaching Agent Team")
|
||||||
st.markdown("Enter a topic to generate a detailed learning path and resources")
|
st.markdown("Enter a topic to generate a detailed learning path and resources")
|
||||||
|
|
||||||
# Add info message about Google Docs
|
# 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.")
|
st.info("📝 The agents will create detailed Google Docs for each section (Professor, Academic Advisor, Research Librarian, and Teaching Assistant). The links to these documents will be displayed below after processing.")
|
||||||
|
|
||||||
# Query bar for topic input
|
# 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.")
|
st.session_state['topic'] = st.text_input("Enter the topic you want to learn about:", placeholder="e.g., Machine Learning, LoRA, etc.")
|
||||||
|
|
@ -132,25 +132,25 @@ if st.button("Start"):
|
||||||
else:
|
else:
|
||||||
# Display loading animations while generating responses
|
# Display loading animations while generating responses
|
||||||
with st.spinner("Generating Knowledge Base..."):
|
with st.spinner("Generating Knowledge Base..."):
|
||||||
knowledge_response: RunResponse = knowledge_agent.run(
|
professor_response: RunResponse = professor_agent.run(
|
||||||
f"the topic is: {st.session_state['topic']},Don't forget to add the Google Doc link in your response.",
|
f"the topic is: {st.session_state['topic']},Don't forget to add the Google Doc link in your response.",
|
||||||
stream=False
|
stream=False
|
||||||
)
|
)
|
||||||
|
|
||||||
with st.spinner("Generating Learning Roadmap..."):
|
with st.spinner("Generating Learning Roadmap..."):
|
||||||
roadmap_response: RunResponse = roadmap_agent.run(
|
academic_advisor_response: RunResponse = academic_advisor_agent.run(
|
||||||
f"the topic is: {st.session_state['topic']},Don't forget to add the Google Doc link in your response.",
|
f"the topic is: {st.session_state['topic']},Don't forget to add the Google Doc link in your response.",
|
||||||
stream=False
|
stream=False
|
||||||
)
|
)
|
||||||
|
|
||||||
with st.spinner("Curating Learning Resources..."):
|
with st.spinner("Curating Learning Resources..."):
|
||||||
resource_response: RunResponse = resource_agent.run(
|
research_librarian_response: RunResponse = research_librarian_agent.run(
|
||||||
f"the topic is: {st.session_state['topic']},Don't forget to add the Google Doc link in your response.",
|
f"the topic is: {st.session_state['topic']},Don't forget to add the Google Doc link in your response.",
|
||||||
stream=False
|
stream=False
|
||||||
)
|
)
|
||||||
|
|
||||||
with st.spinner("Creating Practice Materials..."):
|
with st.spinner("Creating Practice Materials..."):
|
||||||
practice_response: RunResponse = practice_agent.run(
|
teaching_assistant_response: RunResponse = teaching_assistant_agent.run(
|
||||||
f"the topic is: {st.session_state['topic']},Don't forget to add the Google Doc link in your response.",
|
f"the topic is: {st.session_state['topic']},Don't forget to add the Google Doc link in your response.",
|
||||||
stream=False
|
stream=False
|
||||||
)
|
)
|
||||||
|
|
@ -163,47 +163,48 @@ if st.button("Start"):
|
||||||
return response_content.split("https://docs.google.com")[1].split()[0]
|
return response_content.split("https://docs.google.com")[1].split()[0]
|
||||||
return None
|
return None
|
||||||
|
|
||||||
knowledge_doc_link = extract_google_doc_link(knowledge_response.content)
|
professor_doc_link = extract_google_doc_link(professor_response.content)
|
||||||
roadmap_doc_link = extract_google_doc_link(roadmap_response.content)
|
academic_advisor_doc_link = extract_google_doc_link(academic_advisor_response.content)
|
||||||
resource_doc_link = extract_google_doc_link(resource_response.content)
|
research_librarian_doc_link = extract_google_doc_link(research_librarian_response.content)
|
||||||
practice_doc_link = extract_google_doc_link(practice_response.content)
|
teaching_assistant_doc_link = extract_google_doc_link(teaching_assistant_response.content)
|
||||||
|
|
||||||
# Display Google Doc links at the top of the Streamlit UI
|
# Display Google Doc links at the top of the Streamlit UI
|
||||||
st.markdown("### Google Doc Links:")
|
st.markdown("### Google Doc Links:")
|
||||||
if knowledge_doc_link:
|
if professor_doc_link:
|
||||||
st.markdown(f"- **KnowledgeBuilder Document:** [View Document](https://docs.google.com{knowledge_doc_link})")
|
st.markdown(f"- **Professor Document:** [View Document](https://docs.google.com{professor_doc_link})")
|
||||||
if roadmap_doc_link:
|
if academic_advisor_doc_link:
|
||||||
st.markdown(f"- **RoadmapArchitect Document:** [View Document](https://docs.google.com{roadmap_doc_link})")
|
st.markdown(f"- **Academic Advisor Document:** [View Document](https://docs.google.com{academic_advisor_doc_link})")
|
||||||
if resource_doc_link:
|
if research_librarian_doc_link:
|
||||||
st.markdown(f"- **ResourceCurator Document:** [View Document](https://docs.google.com{resource_doc_link})")
|
st.markdown(f"- **Research Librarian Document:** [View Document](https://docs.google.com{research_librarian_doc_link})")
|
||||||
if practice_doc_link:
|
if teaching_assistant_doc_link:
|
||||||
st.markdown(f"- **PracticeDesigner Document:** [View Document](https://docs.google.com{practice_doc_link})")
|
st.markdown(f"- **Teaching Assistant Document:** [View Document](https://docs.google.com{teaching_assistant_doc_link})")
|
||||||
|
|
||||||
# Display responses in the Streamlit UI using pprint_run_response
|
# Display responses in the Streamlit UI using pprint_run_response
|
||||||
st.markdown("### KnowledgeBuilder Response:")
|
st.markdown("### Professor Response:")
|
||||||
st.markdown(knowledge_response.content)
|
st.markdown(professor_response.content)
|
||||||
pprint_run_response(knowledge_response, markdown=True)
|
pprint_run_response(professor_response, markdown=True)
|
||||||
st.divider()
|
|
||||||
st.markdown("### RoadmapArchitect Response:")
|
|
||||||
st.markdown(roadmap_response.content)
|
|
||||||
pprint_run_response(roadmap_response, markdown=True)
|
|
||||||
st.divider()
|
st.divider()
|
||||||
|
|
||||||
st.markdown("### ResourceCurator Response:")
|
st.markdown("### Academic Advisor Response:")
|
||||||
st.markdown(resource_response.content)
|
st.markdown(academic_advisor_response.content)
|
||||||
pprint_run_response(resource_response, markdown=True)
|
pprint_run_response(academic_advisor_response, markdown=True)
|
||||||
st.divider()
|
st.divider()
|
||||||
|
|
||||||
st.markdown("### PracticeDesigner Response:")
|
st.markdown("### Research Librarian Response:")
|
||||||
st.markdown(practice_response.content)
|
st.markdown(research_librarian_response.content)
|
||||||
pprint_run_response(practice_response, markdown=True)
|
pprint_run_response(research_librarian_response, markdown=True)
|
||||||
|
st.divider()
|
||||||
|
|
||||||
|
st.markdown("### Teaching Assistant Response:")
|
||||||
|
st.markdown(teaching_assistant_response.content)
|
||||||
|
pprint_run_response(teaching_assistant_response, markdown=True)
|
||||||
st.divider()
|
st.divider()
|
||||||
# Information about the agents
|
# Information about the agents
|
||||||
st.markdown("---")
|
st.markdown("---")
|
||||||
st.markdown("### About the Agents:")
|
st.markdown("### About the Agents:")
|
||||||
st.markdown("""
|
st.markdown("""
|
||||||
- **KnowledgeBuilder**: Researches the topic and creates a detailed knowledge base.
|
- **Professor**: Researches the topic and creates a detailed knowledge base.
|
||||||
- **RoadmapArchitect**: Designs a structured learning roadmap for the topic.
|
- **Academic Advisor**: Designs a structured learning roadmap for the topic.
|
||||||
- **ResourceCurator**: Curates high-quality learning resources.
|
- **Research Librarian**: Curates high-quality learning resources.
|
||||||
- **PracticeDesigner**: Creates practice materials, exercises, and projects.
|
- **Teaching Assistant**: Creates practice materials, exercises, and projects.
|
||||||
""")
|
""")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue