rajkumar218 commited on
Commit
51d9927
·
1 Parent(s): 6c2fc15
Files changed (1) hide show
  1. app.py +31 -0
app.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ At the command line, only need to run once to install the package via pip:
3
+ $ pip install google-generativeai
4
+ """
5
+ import os
6
+ from dotenv import load_dotenv, find_dotenv
7
+ load_dotenv(find_dotenv())
8
+
9
+ import google.generativeai as palm
10
+
11
+ palm.configure(api_key=os.environ["PALM_API_KEY"])
12
+
13
+ defaults = {
14
+ 'model': 'models/chat-bison-001',
15
+ 'temperature': 0.25,
16
+ 'candidate_count': 1,
17
+ 'top_k': 40,
18
+ 'top_p': 0.95,
19
+ }
20
+ context = ""
21
+ examples = []
22
+ messages = []
23
+ messages.append("what is 1 + 3 ?")
24
+ response = palm.chat(
25
+ **defaults,
26
+ context=context,
27
+ examples=examples,
28
+ messages=messages
29
+ )
30
+
31
+ print(response.last) # Response of the AI to your most recent request