Update app.py
Browse files
app.py
CHANGED
@@ -70,7 +70,7 @@ Action Input: the input to the action
|
|
70 |
Observation: the result of the action
|
71 |
... (this Thought/Action/Action Input/Observation can repeat N times)
|
72 |
Thought: I now know the final answer
|
73 |
-
Final Answer:
|
74 |
Begin!
|
75 |
|
76 |
Question: {input}
|
@@ -79,19 +79,17 @@ Thought: Let's approach this step-by-step:
|
|
79 |
)
|
80 |
|
81 |
agent = create_react_agent(
|
82 |
-
local_llm,
|
83 |
-
tools,
|
84 |
-
prompt
|
85 |
-
output_key="final_answer" # Specify the output key here
|
86 |
)
|
87 |
|
88 |
-
# Create the agent executor
|
89 |
agent_executor = AgentExecutor.from_agent_and_tools(
|
90 |
agent=agent,
|
91 |
tools=tools,
|
92 |
verbose=True,
|
93 |
-
memory=ConversationBufferMemory()
|
94 |
-
output_keys=["final_answer"] # Explicitly define the output key(s) here
|
95 |
)
|
96 |
|
97 |
# Streamlit interface
|
@@ -115,7 +113,7 @@ if lead_name:
|
|
115 |
with st.spinner("AI is generating a response..."):
|
116 |
response = agent_executor.run(initial_message)
|
117 |
st.write("AI Response:")
|
118 |
-
st.write(response) #
|
119 |
|
120 |
|
121 |
st.sidebar.title("About")
|
|
|
70 |
Observation: the result of the action
|
71 |
... (this Thought/Action/Action Input/Observation can repeat N times)
|
72 |
Thought: I now know the final answer
|
73 |
+
Final Answer: the final response you want to return. This is your output.
|
74 |
Begin!
|
75 |
|
76 |
Question: {input}
|
|
|
79 |
)
|
80 |
|
81 |
agent = create_react_agent(
|
82 |
+
llm=local_llm,
|
83 |
+
tools=tools,
|
84 |
+
prompt=prompt
|
|
|
85 |
)
|
86 |
|
87 |
+
# Create the agent executor without specifying output_keys
|
88 |
agent_executor = AgentExecutor.from_agent_and_tools(
|
89 |
agent=agent,
|
90 |
tools=tools,
|
91 |
verbose=True,
|
92 |
+
memory=ConversationBufferMemory()
|
|
|
93 |
)
|
94 |
|
95 |
# Streamlit interface
|
|
|
113 |
with st.spinner("AI is generating a response..."):
|
114 |
response = agent_executor.run(initial_message)
|
115 |
st.write("AI Response:")
|
116 |
+
st.write(response) # The response should be the final output
|
117 |
|
118 |
|
119 |
st.sidebar.title("About")
|