phidata / app.py
genaitiwari's picture
phidata websearch and agent team usecases added
977a357
import streamlit as st
from src.agentphidata.agentphidata import Phidata
from configfile import Config
from src.streamlitui.loadui import LoadStreamlitUI
from src.LLMS.groqllm import GroqLLM
# MAIN Function START
if __name__ == "__main__":
# config
obj_config = Config()
# load ui
ui = LoadStreamlitUI()
user_input = ui.load_streamlit_ui()
# userInput
problem = st.chat_input("Start Chat ")
if problem:
st.write(f"Prompt : {problem}")
# Configure LLM
obj_llm_config = GroqLLM(user_controls_input=user_input)
model = obj_llm_config.get_llm_model()
is_add_message_to_history = st.session_state["chat_with_history"]
agent_descriptions = user_input['agent_descriptions']
num_history_responses = user_input['num_history_responses']
obj_phidata= Phidata(model=model,problem=problem,is_add_message_to_history = is_add_message_to_history,num_history_responses = num_history_responses,agent_descriptions=agent_descriptions)
if is_add_message_to_history:
#TODO
obj_phidata_agent_with_memory = obj_phidata.agent_with_memory()
st.write(obj_phidata.run_agent_with_memory(obj_phidata_agent_with_memory))
else:
if user_input['selected_usecase'] == "Basic Example":
obj_phidata_agent = obj_phidata.agent()
st.write(obj_phidata.run_agent(obj_phidata_agent))
elif user_input['selected_usecase'] == "Web Search":
obj_phidata_agent = obj_phidata.agent_for_websearch()
st.write(obj_phidata.run_agent(obj_phidata_agent))
elif user_input['selected_usecase'] == "Agent Team":
obj_phidata_agent = obj_phidata.agent_for_team()
st.write(obj_phidata.run_agent(obj_phidata_agent))
elif user_input['selected_usecase'] == "Shopping Agent":
obj_phidata_agent = obj_phidata.agent_for_shopping()
st.write(obj_phidata.run_agent(obj_phidata_agent))