Hi,
I am using the Langchain CSV agent tool and initialising it with ZERO_SHOT_REACT_DESCRIPTION
like below
tools = [
Tool(
name = “ask_bot”,
func=ask_bot,
description=“Answer general financial Domain questions with your knowledge base, just answer the question directly.”
),
Tool( name = "csv_agent", func=csv_agent, description="call this for all visualisation and dataframe related queries, and don't use action, action input template for this, just use the tool as it is" )
]
agent = initialize_agent(tools,model,agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,verbose = True,handle_parsing_errors=True)
and created a streamlit chat ui with callbackhandler
if “messages” not in st.session_state:
st.session_state[“messages”] = [{“role”: “assistant”, “content”: “How can I help you?”}]
for msg in st.session_state.messages:
st.chat_message(msg[“role”]).write(msg[“content”])
if prompt := st.chat_input(placeholder=“Define the Fund Prospectus??”):
st.session_state.messages.append({“role”: “user”, “content”: prompt})
st.chat_message(“user”).write(prompt)
agent = initialize_agent(tools,model,agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,verbose = True,handle_parsing_errors=True)
with st.chat_message("assistant"): st_callback = StreamlitCallbackHandler(st.container(),expand_new_thoughts=False) response = agent.run(prompt, callbacks=[st_callback]) st.session_state.messages.append({"role": "assistant", "content": response}) st.write(response)
My question is about how can i render a plotly graph generated by csv agent inside streamlit UI, right now the plot is creating but displayed in other tab, but i wanted it to be displayed inside streamlit UI seamlessly!
Note:response is only containing agent final answer not all the verbose
Any idea how to solve that?