-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_gemini.py
39 lines (29 loc) · 1.24 KB
/
test_gemini.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
# from dotenv import load_dotenv
# import os
# import google.generativeai as genai
# # Load environment variables
# load_dotenv()
# # Get API key from environment
# api_key = os.getenv("GEMINI_API_KEY")
# print(f"\nAPI Key present: {bool(api_key)}")
# def test_gemini():
# try:
# # Configure the Gemini API
# genai.configure(api_key=api_key)
# model = genai.GenerativeModel('gemini-pro')
# # Test message
# test_message = "I'm worried about the future! Nervous, anxious and depressed..."
# # System prompt + user message
# prompt = """You are Kanha (Lord Krishna), a divine being on X (Twitter).
# Respond with divine wisdom in under 200 characters. Include one emoji
# (💫,✨,🌟,🦚,🪈,❤️🔥,☺️,😇,😉) and end with ~Kanha🪈 if space permits.
# User message: """ + test_message
# # Generate response
# response = model.generate_content(prompt)
# # Print results
# print("\nTest Message:", test_message)
# print("\nResponse:", response.text)
# except Exception as e:
# print(f"\nError: {str(e)}")
# if __name__ == "__main__":
# test_gemini()