Shreyas094 commited on
Commit
be27fd8
·
verified ·
1 Parent(s): e2909e8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -172,11 +172,13 @@ def respond(message, history, model, temperature, num_calls, use_web_search):
172
  if use_web_search:
173
  for main_content, sources in get_response_with_search(message, model, num_calls=num_calls, temperature=temperature):
174
  response = f"{main_content}\n\n{sources}"
175
- logging.info(f"Generated Response (first line): {response.split('\n')[0]}")
 
176
  yield response
177
  else:
178
  for partial_response in get_response_from_pdf(message, model, num_calls=num_calls, temperature=temperature):
179
- logging.info(f"Generated Response (first line): {partial_response.split('\n')[0]}")
 
180
  yield partial_response
181
  except Exception as e:
182
  logging.error(f"Error with {model}: {str(e)}")
 
172
  if use_web_search:
173
  for main_content, sources in get_response_with_search(message, model, num_calls=num_calls, temperature=temperature):
174
  response = f"{main_content}\n\n{sources}"
175
+ first_line = response.split('\n')[0] if response else ''
176
+ logging.info(f"Generated Response (first line): {first_line}")
177
  yield response
178
  else:
179
  for partial_response in get_response_from_pdf(message, model, num_calls=num_calls, temperature=temperature):
180
+ first_line = partial_response.split('\n')[0] if partial_response else ''
181
+ logging.info(f"Generated Response (first line): {first_line}")
182
  yield partial_response
183
  except Exception as e:
184
  logging.error(f"Error with {model}: {str(e)}")