Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,20 +4,18 @@ from langchain_google_genai import GoogleGenerativeAIEmbeddings
|
|
| 4 |
import google.generativeai as genai
|
| 5 |
from langchain_community.vectorstores import FAISS
|
| 6 |
from langchain_google_genai import ChatGoogleGenerativeAI
|
| 7 |
-
from typing import Optional
|
| 8 |
|
| 9 |
-
genai.configure(api_key="
|
| 10 |
|
| 11 |
|
| 12 |
-
def predict(message :str ,history
|
| 13 |
model = genai.GenerativeModel("gemini-pro")
|
| 14 |
his = []
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
])
|
| 21 |
chat = model.start_chat(
|
| 22 |
history=his
|
| 23 |
)
|
|
|
|
| 4 |
import google.generativeai as genai
|
| 5 |
from langchain_community.vectorstores import FAISS
|
| 6 |
from langchain_google_genai import ChatGoogleGenerativeAI
|
|
|
|
| 7 |
|
| 8 |
+
genai.configure(api_key="")
|
| 9 |
|
| 10 |
|
| 11 |
+
def predict(message :str ,history,topic : str = "OIC") -> str:
|
| 12 |
model = genai.GenerativeModel("gemini-pro")
|
| 13 |
his = []
|
| 14 |
+
for i,j in history:
|
| 15 |
+
his.extend([
|
| 16 |
+
{"role": "user", "parts": i},
|
| 17 |
+
{"role": "model", "parts": j},
|
| 18 |
+
])
|
|
|
|
| 19 |
chat = model.start_chat(
|
| 20 |
history=his
|
| 21 |
)
|