File size: 830 Bytes
de4ceef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from langchain_google_genai import ChatGoogleGenerativeAI
from dotenv import load_dotenv
import os

load_dotenv()
google_api_key = os.getenv("GEMINI_API_KEY")
model = "gemini-2.5-flash-lite"

def run_simple_chatbot():
    """

    

    continuously prompts the user for input,

    feeds it to the llm and prints the response.

    exits when the user types 'quit'.

    """

    llm = ChatGoogleGenerativeAI(model=model, google_api_key=google_api_key)

    print("caramel AI - Chatbot built by Here and Now AI")
    print("Type 'quit' to exit the chatbot.")
    while True:
        user_input = input("You: ")
        if user_input == 'quit':
            break
        response = llm.invoke(user_input)
        print(f"Bot: {response.content}")

if __name__ == "__main__":
    run_simple_chatbot()