Spaces:
Runtime error
Runtime error
Commit
·
04e1f57
1
Parent(s):
c3a6237
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,16 +4,14 @@ import os
|
|
| 4 |
|
| 5 |
genai.configure(api_key=os.getenv("GOOGLE_PALM_KEY"))
|
| 6 |
|
|
|
|
| 7 |
|
| 8 |
def generate(prompt, history, system):
|
| 9 |
-
history = [['' if item is None else item for item in sub_array] for sub_array in history]
|
| 10 |
|
| 11 |
-
sub_arrays_as_strings = [' '.join(sub_array) for sub_array in history]
|
| 12 |
-
result_string = ' '.join(sub_arrays_as_strings)
|
| 13 |
response = genai.chat(
|
| 14 |
-
context=
|
| 15 |
messages=prompt)
|
| 16 |
-
|
| 17 |
return response.last
|
| 18 |
|
| 19 |
additional = [
|
|
|
|
| 4 |
|
| 5 |
genai.configure(api_key=os.getenv("GOOGLE_PALM_KEY"))
|
| 6 |
|
| 7 |
+
past = ""
|
| 8 |
|
| 9 |
def generate(prompt, history, system):
|
|
|
|
| 10 |
|
|
|
|
|
|
|
| 11 |
response = genai.chat(
|
| 12 |
+
context=past+", "+system,
|
| 13 |
messages=prompt)
|
| 14 |
+
past += response.last
|
| 15 |
return response.last
|
| 16 |
|
| 17 |
additional = [
|