Update app.py
Browse files
app.py
CHANGED
@@ -30,7 +30,8 @@ local_llm = load_model()
|
|
30 |
|
31 |
# Define the tools for the agent
|
32 |
def search_leads(query):
|
33 |
-
|
|
|
34 |
|
35 |
def send_email(to_email, subject, body):
|
36 |
# For demo purposes, we'll just print the email details
|
@@ -52,7 +53,7 @@ tools = [
|
|
52 |
)
|
53 |
]
|
54 |
|
55 |
-
# Set up the agent
|
56 |
prompt = PromptTemplate.from_template(
|
57 |
"""You are an AI CyberSecurity Program Advisor. Your goal is to engage with leads and get them to book a video call for an in-person sales meeting. You have access to a list of leads and can send emails.
|
58 |
|
@@ -69,8 +70,7 @@ Action Input: the input to the action
|
|
69 |
Observation: the result of the action
|
70 |
... (this Thought/Action/Action Input/Observation can repeat N times)
|
71 |
Thought: I now know the final answer
|
72 |
-
Final Answer:
|
73 |
-
|
74 |
Begin!
|
75 |
|
76 |
Question: {input}
|
@@ -78,9 +78,19 @@ Thought: Let's approach this step-by-step:
|
|
78 |
{agent_scratchpad}"""
|
79 |
)
|
80 |
|
81 |
-
agent = create_react_agent(
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
agent_executor = AgentExecutor.from_agent_and_tools(
|
83 |
-
agent=agent,
|
|
|
|
|
|
|
|
|
84 |
)
|
85 |
|
86 |
# Streamlit interface
|
|
|
30 |
|
31 |
# Define the tools for the agent
|
32 |
def search_leads(query):
|
33 |
+
results = [lead for lead in LEADS if query.lower() in lead['name'].lower()]
|
34 |
+
return results
|
35 |
|
36 |
def send_email(to_email, subject, body):
|
37 |
# For demo purposes, we'll just print the email details
|
|
|
53 |
)
|
54 |
]
|
55 |
|
56 |
+
# Set up the agent with a specified output key
|
57 |
prompt = PromptTemplate.from_template(
|
58 |
"""You are an AI CyberSecurity Program Advisor. Your goal is to engage with leads and get them to book a video call for an in-person sales meeting. You have access to a list of leads and can send emails.
|
59 |
|
|
|
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: {final_answer} # Ensure this is defined as the output key
|
|
|
74 |
Begin!
|
75 |
|
76 |
Question: {input}
|
|
|
78 |
{agent_scratchpad}"""
|
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 |
agent_executor = AgentExecutor.from_agent_and_tools(
|
89 |
+
agent=agent,
|
90 |
+
tools=tools,
|
91 |
+
verbose=True,
|
92 |
+
memory=ConversationBufferMemory(),
|
93 |
+
output_key="final_answer" # Ensure this matches the agent's output key
|
94 |
)
|
95 |
|
96 |
# Streamlit interface
|