agent2/streamlit_app.py
2024-12-12 15:34:36 +08:00

28 lines
841 B
Python

import streamlit as st
from agent_util import config_agent, configure_llm
# Streamlit Application Interface
st.sidebar.header("Configure LLM")
st.title("CEC Seller Assistant")
# Model Selection
model_options = ["llama3.2"]
selected_model = st.sidebar.selectbox("Choose the LLM Model", options=model_options, index=0)
# Temperature Setting
temperature = st.sidebar.slider("Set the Temperature", min_value=0.0, max_value=1.0, value=0.5, step=0.1)
llama3, llama3_json=configure_llm(selected_model, temperature)
local_agent = config_agent(llama3, llama3_json)
def run_agent(query):
output = local_agent.invoke({"question": query})
print("=======")
return output["generation"]
user_query = st.text_input("Enter your research question:", "")
if st.button("Run Query"):
if user_query:
st.write(run_agent(user_query))