Update app.py
Browse files
app.py
CHANGED
@@ -172,29 +172,24 @@ def generate_prompt(query: str, context_snippets: list) -> str:
|
|
172 |
|
173 |
def get_gemini_flash_response(prompt: str) -> str:
|
174 |
import google.generativeai as genai
|
175 |
-
from google.generativeai import
|
176 |
|
177 |
|
178 |
-
# Create a Gemini client using the API key from the environment.
|
179 |
-
client = genai.Client(api_key=GEMINI_API_KEY)
|
180 |
|
181 |
-
|
182 |
-
config = types.GenerateContentConfig(
|
183 |
-
max_output_tokens=500, # Adjust as needed.
|
184 |
-
temperature=0.1 # Lower temperature for more deterministic responses.
|
185 |
-
)
|
186 |
|
187 |
-
|
188 |
-
response = client.models.generate_content(
|
189 |
model="gemini-2.0-flash",
|
190 |
-
|
191 |
-
|
|
|
192 |
)
|
193 |
|
194 |
return response.text
|
195 |
|
196 |
|
197 |
|
|
|
198 |
############################################
|
199 |
# Gradio Interface Functions
|
200 |
############################################
|
|
|
172 |
|
173 |
def get_gemini_flash_response(prompt: str) -> str:
|
174 |
import google.generativeai as genai
|
175 |
+
from google.generativeai import palm
|
176 |
|
177 |
|
|
|
|
|
178 |
|
179 |
+
palm.configure(api_key=GEMINI_API_KEY)
|
|
|
|
|
|
|
|
|
180 |
|
181 |
+
response = palm.generate_text(
|
|
|
182 |
model="gemini-2.0-flash",
|
183 |
+
prompt=prompt,
|
184 |
+
temperature=0.1, # Adjust as needed
|
185 |
+
max_output_tokens=500 # Adjust as needed
|
186 |
)
|
187 |
|
188 |
return response.text
|
189 |
|
190 |
|
191 |
|
192 |
+
|
193 |
############################################
|
194 |
# Gradio Interface Functions
|
195 |
############################################
|