-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.py
55 lines (46 loc) · 1.58 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import litellm
from colorama import Fore
from dotenv import load_dotenv
from src.agents.agent import Agent
from src.prompts.prompts import SALES_CHATBOT_PROMPT
from src.tools.stripe_payment import GenerateStripePaymentLink
from src.tools.book_meeting import GenerateCalendlyInvitationLink
from src.tools.file_search import GetStoreInfo
from src.tools.product_recommendation import GetProductRecommendation
# Load environment variables from a .env file
load_dotenv()
# set langfuse as a callback, litellm will send the data to langfuse
litellm.success_callback = ["langsmith"]
# litellm.set_verbose = True
# Choose any model with LiteLLM
model = "groq/llama3-70b-8192"
# model = "groq/llama-3.1-70b-versatile"
# model = "gemini/gemini-1.5-pro"
# agent tools
tools_list = [
GenerateCalendlyInvitationLink,
GetStoreInfo,
GetProductRecommendation,
GenerateStripePaymentLink,
]
# Initiate the sale agent
agent = Agent("Sale Agent", model, tools_list, system_prompt=SALES_CHATBOT_PROMPT)
# Add initial/introduction chatbot message
agent.messages.append(
{
"role": "assistant",
"content": "Hey, This is Emily from TechNerds. How can I help you?",
}
)
print(
Fore.BLUE
+ "Enter discussion with TechNerds Sales Agent! Type 'exit' to end the conversation."
)
print(Fore.BLUE + f"Sales Bot: {agent.messages[-1]['content']}")
while True:
user_input = input(Fore.YELLOW + "You: ")
if user_input.lower() == "exit":
print(Fore.BLUE + "Sales Bot: Goodbye!")
break
response = agent.invoke(user_input)
print(Fore.BLUE + f"Sales Bot: {response}")