Spaces:
Runtime error
Runtime error
Commit
·
b40d855
1
Parent(s):
db271d6
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import google.generativeai as palm
|
2 |
+
import os
|
3 |
+
palm.configure(api_key=os.environ.get("openai_key"))
|
4 |
+
|
5 |
+
defaults = {
|
6 |
+
'model': 'models/chat-bison-001',
|
7 |
+
'temperature': 0.25,
|
8 |
+
'candidate_count': 1,
|
9 |
+
'top_k': 40,
|
10 |
+
'top_p': 0.95,
|
11 |
+
}
|
12 |
+
context = "Your a computer failure assitant"
|
13 |
+
examples = [
|
14 |
+
[
|
15 |
+
"Hey my computer is broken",
|
16 |
+
"Hey what is the issue with your computer?"
|
17 |
+
]
|
18 |
+
]
|
19 |
+
messages = []
|
20 |
+
messages.append("NEXT REQUEST")
|
21 |
+
response = palm.chat(
|
22 |
+
**defaults,
|
23 |
+
context=context,
|
24 |
+
examples=examples,
|
25 |
+
messages=messages
|
26 |
+
)
|
27 |
+
print(response.last) # Response of the AI to your most recent request
|