menikev commited on
Commit
747d33d
·
verified ·
1 Parent(s): dc28758

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -34
app.py CHANGED
@@ -8,8 +8,6 @@ from langchain.memory import ConversationBufferMemory
8
  # Mock lead data
9
  LEADS = [
10
  {"name": "John Doe", "email": "[email protected]", "company": "TechCorp"},
11
- {"name": "Jane Smith", "email": "[email protected]", "company": "InnoSoft"},
12
- {"name": "Bob Johnson", "email": "[email protected]", "company": "DataTech"},
13
  ]
14
 
15
  # Set up the open-source LLM
@@ -28,12 +26,7 @@ def load_model():
28
 
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()]
35
- return results
36
-
37
  def send_email(to_email, subject, body):
38
  # For demo purposes, we'll just print the email details
39
  st.write(f"Email sent to: {to_email}")
@@ -42,11 +35,6 @@ def send_email(to_email, subject, body):
42
  return "Email sent successfully"
43
 
44
  tools = [
45
- Tool(
46
- name="Search Leads",
47
- func=search_leads,
48
- description="Useful for searching leads by name"
49
- ),
50
  Tool(
51
  name="Send Email",
52
  func=send_email,
@@ -97,30 +85,17 @@ agent_executor = AgentExecutor.from_agent_and_tools(
97
  # Streamlit interface
98
  st.title("AI CyberSecurity Program Advisor Demo")
99
 
100
- st.write("This demo showcases an AI agent that can engage with leads and attempt to book video calls for in-person sales meetings.")
101
-
102
- lead_name = st.text_input("Enter a lead's name to engage with:")
103
-
104
- if lead_name:
105
- lead_info = search_leads(lead_name)
106
- if not lead_info:
107
- st.write(f"No lead found with the name {lead_name}")
108
- else:
109
- lead = lead_info[0]
110
- st.write(f"Lead found: {lead['name']} (Email: {lead['email']}, Company: {lead['company']})")
111
-
112
- initial_message = f"Hello {lead['name']}, I'd like to discuss our cybersecurity program with {lead['company']}. Are you available for a quick video call?"
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
 
123
  st.sidebar.title("About")
124
  st.sidebar.info("This is a demo of an AI CyberSecurity Program Advisor using an open-source LLM and LangChain. It's designed to engage with leads and attempt to book video calls for sales meetings.")
125
-
126
- # To run this script, use: streamlit run your_script_name.py
 
8
  # Mock lead data
9
  LEADS = [
10
  {"name": "John Doe", "email": "[email protected]", "company": "TechCorp"},
 
 
11
  ]
12
 
13
  # Set up the open-source LLM
 
26
 
27
  local_llm = load_model()
28
 
 
29
  # Define the tools for the agent
 
 
 
 
30
  def send_email(to_email, subject, body):
31
  # For demo purposes, we'll just print the email details
32
  st.write(f"Email sent to: {to_email}")
 
35
  return "Email sent successfully"
36
 
37
  tools = [
 
 
 
 
 
38
  Tool(
39
  name="Send Email",
40
  func=send_email,
 
85
  # Streamlit interface
86
  st.title("AI CyberSecurity Program Advisor Demo")
87
 
88
+ st.write("This demo showcases an AI agent that can engage with leads and attempt to book video calls for sales meetings.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
 
90
+ # Start a conversation with a predefined lead
91
+ lead = LEADS[0]
92
+ initial_message = f"Hello {lead['name']}, I'd like to discuss our cybersecurity program with {lead['company']}. Are you available for a quick video call?"
93
 
94
+ if st.button("Start Conversation"):
95
+ with st.spinner("AI is generating a response..."):
96
+ response = agent_executor({"input": initial_message})
97
+ st.write("AI Response:")
98
+ st.write(response["output"]) # Adjust this based on the actual output key
99
 
100
  st.sidebar.title("About")
101
  st.sidebar.info("This is a demo of an AI CyberSecurity Program Advisor using an open-source LLM and LangChain. It's designed to engage with leads and attempt to book video calls for sales meetings.")