Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -193,16 +193,17 @@ def run_agent(client, model_name, system_prompt_template, user_input_state, conf
|
|
193 |
prompt = system_prompt + "\n\n" + user_message_content
|
194 |
|
195 |
try:
|
196 |
-
#
|
197 |
model_to_use = model_name
|
198 |
|
199 |
# Pass a list containing the single combined prompt string
|
200 |
response = client.models.generate_content(
|
201 |
-
model=model_to_use,
|
202 |
-
contents=[prompt],
|
203 |
config=config
|
204 |
)
|
205 |
-
response.raise_for_status()
|
|
|
206 |
|
207 |
# Some models return parts, concatenate them
|
208 |
response_text = "".join([part.text for part in response.candidates[0].content.parts])
|
|
|
193 |
prompt = system_prompt + "\n\n" + user_message_content
|
194 |
|
195 |
try:
|
196 |
+
# Define model_to_use by using the passed model_name parameter
|
197 |
model_to_use = model_name
|
198 |
|
199 |
# Pass a list containing the single combined prompt string
|
200 |
response = client.models.generate_content(
|
201 |
+
model=model_to_use,
|
202 |
+
contents=[prompt], # Pass a list of strings
|
203 |
config=config
|
204 |
)
|
205 |
+
# *** FIX: REMOVED response.raise_for_status() as it doesn't exist on GenerateContentResponse ***
|
206 |
+
# API errors are handled by the SDK raising exceptions caught below.
|
207 |
|
208 |
# Some models return parts, concatenate them
|
209 |
response_text = "".join([part.text for part in response.candidates[0].content.parts])
|