KURUPRASATH-J commited on
Commit
de4ceef
·
verified ·
1 Parent(s): 28c5532

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -0
app.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from langchain_google_genai import ChatGoogleGenerativeAI
2
+ from dotenv import load_dotenv
3
+ import os
4
+
5
+ load_dotenv()
6
+ google_api_key = os.getenv("GEMINI_API_KEY")
7
+ model = "gemini-2.5-flash-lite"
8
+
9
+ def run_simple_chatbot():
10
+ """
11
+
12
+ continuously prompts the user for input,
13
+ feeds it to the llm and prints the response.
14
+ exits when the user types 'quit'.
15
+ """
16
+
17
+ llm = ChatGoogleGenerativeAI(model=model, google_api_key=google_api_key)
18
+
19
+ print("caramel AI - Chatbot built by Here and Now AI")
20
+ print("Type 'quit' to exit the chatbot.")
21
+ while True:
22
+ user_input = input("You: ")
23
+ if user_input == 'quit':
24
+ break
25
+ response = llm.invoke(user_input)
26
+ print(f"Bot: {response.content}")
27
+
28
+ if __name__ == "__main__":
29
+ run_simple_chatbot()