Update app.py
Browse files
app.py
CHANGED
@@ -29,8 +29,6 @@ def load_model():
|
|
29 |
local_llm = load_model()
|
30 |
|
31 |
|
32 |
-
from langchain.agents import create_react_agent, AgentExecutor, Tool
|
33 |
-
|
34 |
# Define the tools for the agent
|
35 |
def search_leads(query):
|
36 |
results = [lead for lead in LEADS if query.lower() in lead['name'].lower()]
|
@@ -56,7 +54,7 @@ tools = [
|
|
56 |
)
|
57 |
]
|
58 |
|
59 |
-
# Define the prompt
|
60 |
prompt = PromptTemplate.from_template(
|
61 |
"""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.
|
62 |
|
@@ -81,7 +79,7 @@ Thought: Let's approach this step-by-step:
|
|
81 |
{agent_scratchpad}"""
|
82 |
)
|
83 |
|
84 |
-
# Create the React agent
|
85 |
agent = create_react_agent(
|
86 |
llm=local_llm,
|
87 |
tools=tools,
|
@@ -115,9 +113,10 @@ if lead_name:
|
|
115 |
|
116 |
if st.button("Engage with Lead"):
|
117 |
with st.spinner("AI is generating a response..."):
|
118 |
-
response = agent_executor.
|
119 |
st.write("AI Response:")
|
120 |
-
st.write(response) #
|
|
|
121 |
|
122 |
|
123 |
|
|
|
29 |
local_llm = load_model()
|
30 |
|
31 |
|
|
|
|
|
32 |
# Define the tools for the agent
|
33 |
def search_leads(query):
|
34 |
results = [lead for lead in LEADS if query.lower() in lead['name'].lower()]
|
|
|
54 |
)
|
55 |
]
|
56 |
|
57 |
+
# Define the prompt
|
58 |
prompt = PromptTemplate.from_template(
|
59 |
"""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.
|
60 |
|
|
|
79 |
{agent_scratchpad}"""
|
80 |
)
|
81 |
|
82 |
+
# Create the React agent
|
83 |
agent = create_react_agent(
|
84 |
llm=local_llm,
|
85 |
tools=tools,
|
|
|
113 |
|
114 |
if st.button("Engage with Lead"):
|
115 |
with st.spinner("AI is generating a response..."):
|
116 |
+
response = agent_executor.call({"input": initial_message})
|
117 |
st.write("AI Response:")
|
118 |
+
st.write(response['output']) # Access the final output using the appropriate key
|
119 |
+
|
120 |
|
121 |
|
122 |
|