Update app.py
Browse files
app.py
CHANGED
|
@@ -92,7 +92,7 @@ tools = [
|
|
| 92 |
)
|
| 93 |
]
|
| 94 |
|
| 95 |
-
# Define the prompt
|
| 96 |
prompt = PromptTemplate.from_template(
|
| 97 |
"""You are an AI CyberSecurity Program Advisor. Your goal is to engage with the user and collect their name, email address, and preferred date for a video call. Once collected, send an email invitation to a Zoom meeting.
|
| 98 |
|
|
@@ -109,7 +109,12 @@ prompt = PromptTemplate.from_template(
|
|
| 109 |
Observation: the result of the action
|
| 110 |
... (this Thought/Action/Action Input/Observation can repeat N times)
|
| 111 |
Thought: I now know the final answer
|
| 112 |
-
Final Answer:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
Begin!
|
| 114 |
|
| 115 |
Question: {input}
|
|
@@ -124,12 +129,13 @@ agent = create_react_agent(
|
|
| 124 |
prompt=prompt
|
| 125 |
)
|
| 126 |
|
| 127 |
-
# Create the agent executor
|
| 128 |
agent_executor = AgentExecutor.from_agent_and_tools(
|
| 129 |
agent=agent,
|
| 130 |
tools=tools,
|
| 131 |
verbose=True,
|
| 132 |
-
memory=ConversationBufferMemory()
|
|
|
|
| 133 |
)
|
| 134 |
|
| 135 |
# Streamlit interface
|
|
|
|
| 92 |
)
|
| 93 |
]
|
| 94 |
|
| 95 |
+
# Define the prompt with clearer instructions for the LLM
|
| 96 |
prompt = PromptTemplate.from_template(
|
| 97 |
"""You are an AI CyberSecurity Program Advisor. Your goal is to engage with the user and collect their name, email address, and preferred date for a video call. Once collected, send an email invitation to a Zoom meeting.
|
| 98 |
|
|
|
|
| 109 |
Observation: the result of the action
|
| 110 |
... (this Thought/Action/Action Input/Observation can repeat N times)
|
| 111 |
Thought: I now know the final answer
|
| 112 |
+
Final Answer: The invitation email has been sent successfully.
|
| 113 |
+
|
| 114 |
+
If you need to send an email, use the following format exactly:
|
| 115 |
+
Action: Send Email
|
| 116 |
+
Action Input: {{"name": "<name>", "email": "<email>", "preferred_date": "<date>"}}
|
| 117 |
+
|
| 118 |
Begin!
|
| 119 |
|
| 120 |
Question: {input}
|
|
|
|
| 129 |
prompt=prompt
|
| 130 |
)
|
| 131 |
|
| 132 |
+
# Create the agent executor with handle_parsing_errors=True
|
| 133 |
agent_executor = AgentExecutor.from_agent_and_tools(
|
| 134 |
agent=agent,
|
| 135 |
tools=tools,
|
| 136 |
verbose=True,
|
| 137 |
+
memory=ConversationBufferMemory(),
|
| 138 |
+
handle_parsing_errors=True # Added to handle parsing errors
|
| 139 |
)
|
| 140 |
|
| 141 |
# Streamlit interface
|