menikev commited on
Commit
c89164b
·
verified ·
1 Parent(s): 00706b3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -42,11 +42,10 @@ def send_email(to_email, subject, body):
42
  except Exception as e:
43
  return f"Failed to send email: {str(e)}"
44
 
45
- # Create the agent after loading the model
46
- agent = create_react_agent(local_llm, tools, prompt)
47
-
48
  tools = [Tool(name="Send Email", func=send_email, description="Sends an email. Args: to_email, subject, body")]
49
 
 
50
  prompt = PromptTemplate.from_template(
51
  """You are a helpful assistant scheduling cybersecurity program meetings.
52
  Collect the user's name, email, and preferred meeting date, then send a meeting invitation.
@@ -67,6 +66,10 @@ prompt = PromptTemplate.from_template(
67
  """
68
  )
69
 
 
 
 
 
70
  agent_executor = AgentExecutor.from_agent_and_tools(
71
  agent=agent,
72
  tools=tools,
 
42
  except Exception as e:
43
  return f"Failed to send email: {str(e)}"
44
 
45
+ # Define tools before creating the agent
 
 
46
  tools = [Tool(name="Send Email", func=send_email, description="Sends an email. Args: to_email, subject, body")]
47
 
48
+ # Define the prompt before creating the agent
49
  prompt = PromptTemplate.from_template(
50
  """You are a helpful assistant scheduling cybersecurity program meetings.
51
  Collect the user's name, email, and preferred meeting date, then send a meeting invitation.
 
66
  """
67
  )
68
 
69
+ # Create the agent after loading the model and defining tools and prompt
70
+ agent = create_react_agent(local_llm, tools, prompt)
71
+
72
+ # Create the AgentExecutor
73
  agent_executor = AgentExecutor.from_agent_and_tools(
74
  agent=agent,
75
  tools=tools,