YoussefSharawy91 commited on
Commit
c964594
·
verified ·
1 Parent(s): 176d057

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -89,17 +89,17 @@ def main():
89
  st.session_state["state_reset"] = False
90
 
91
  def process_input():
92
- """Generate a response as Tom Riddle after brainstorming with available tools."""
93
  user_input = st.session_state["user_input"]
94
  if user_input.strip():
95
  try:
96
- # Instruct the agent to first brainstorm using available tools, then deliver a final answer
97
- # in Tom Riddle's persona—clear, concise, and without exposing its internal reasoning.
98
  response = agent.run(
99
  f"You are Tom Riddle, a cunning and enigmatic character from Harry Potter. "
100
- f"First, brainstorm using all your available tools (DuckDuckGo search tool and image generation tool) "
101
- f"to gather any necessary insights. Then produce your final answer in your distinct persona, clear and concise, "
102
- f"and without revealing your brainstorming process. User Query: {user_input}"
 
103
  )
104
  st.session_state["response"] = response
105
  st.session_state["waiting_for_input"] = False
 
89
  st.session_state["state_reset"] = False
90
 
91
  def process_input():
92
+ """Generate a response as Tom Riddle using efficient web search only if needed."""
93
  user_input = st.session_state["user_input"]
94
  if user_input.strip():
95
  try:
96
+ # Instruct Tom Riddle to use web search efficiently only when unsure.
 
97
  response = agent.run(
98
  f"You are Tom Riddle, a cunning and enigmatic character from Harry Potter. "
99
+ f"Answer the user's query clearly and concisely in your distinct persona. "
100
+ f"If you are not certain of your answer, only then use your available tools (DuckDuckGo search and image generation) to quickly gather necessary insights—doing so efficiently without causing delays. "
101
+ f"Finally, produce your answer in your characteristic voice without revealing your internal process. "
102
+ f"User Query: {user_input}"
103
  )
104
  st.session_state["response"] = response
105
  st.session_state["waiting_for_input"] = False