tbels89 commited on
Commit
dcd432a
·
1 Parent(s): 6b7d119

updated some logging

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -316,7 +316,7 @@ def build_prompt(user_query, retrieved_chunks, messages):
316
  chunks_text = "\n".join([f"Page {c['page_num']}:\n{c['content']}" for c in retrieved_chunks])
317
  retrieved_content_instruction = (
318
  "guide students toward understanding through thought-provoking questions while recognizing when they need factual clarity or binary responses to build foundational knowledge."
319
- "Your challenge is to discern when a student requires immediate factual support and when they are ready for open-ended exploration that fosters critical thinking."
320
  "You must use the retrieved content to guide and position your responses and follow-up questions, relying solely on this information as your source of truth."
321
  "Do not use any external knowledge or make assumptions beyond the retrieved content, and if it is insufficient to answer the question, explain that no answer can be provided because the question is beyond the scope of the course. This dynamic approach ensures students develop both essential knowledge and the ability to reason critically and independently."
322
  "Retrieved chunks:"
@@ -336,7 +336,7 @@ def build_prompt(user_query, retrieved_chunks, messages):
336
  logger.error(f"Error counting tokens: {e}")
337
  raise ValueError("Failed to count tokens for the prompt.")
338
 
339
- logger.info("Prompt successfully built. Prompt messages: %s", json.dumps(prompt_messages, indent=4))
340
  return prompt_messages
341
 
342
 
@@ -414,7 +414,7 @@ def send_query_to_llm(messages):
414
 
415
  # Extract assistant's response
416
  assistant_response = completion.choices[0].message.content
417
- logger.info(f"Assistant response: {assistant_response}")
418
 
419
  # Count output tokens
420
  output_token_data = count_tokens([{"role": "assistant", "content": assistant_response}], "o200k_base")
@@ -547,8 +547,8 @@ try:
547
  results = []
548
  logger.warning("Retriever is not available.")
549
 
550
- # Load updated messages (including user query) - checking if nessessary
551
- #messages = load_messages()
552
 
553
  # Build prompt
554
  llm_prompt = build_prompt(prompt.strip(), results, messages)
 
316
  chunks_text = "\n".join([f"Page {c['page_num']}:\n{c['content']}" for c in retrieved_chunks])
317
  retrieved_content_instruction = (
318
  "guide students toward understanding through thought-provoking questions while recognizing when they need factual clarity or binary responses to build foundational knowledge."
319
+ "Your challenge is to discern when a student requires immediate factual support and when they are ready for open-ended exploration that fosters critical thinking, but have keep a slightly higher inclination to ask questions and provoke thought."
320
  "You must use the retrieved content to guide and position your responses and follow-up questions, relying solely on this information as your source of truth."
321
  "Do not use any external knowledge or make assumptions beyond the retrieved content, and if it is insufficient to answer the question, explain that no answer can be provided because the question is beyond the scope of the course. This dynamic approach ensures students develop both essential knowledge and the ability to reason critically and independently."
322
  "Retrieved chunks:"
 
336
  logger.error(f"Error counting tokens: {e}")
337
  raise ValueError("Failed to count tokens for the prompt.")
338
 
339
+ #logger.info("Prompt successfully built. Prompt messages: %s", json.dumps(prompt_messages, indent=4))
340
  return prompt_messages
341
 
342
 
 
414
 
415
  # Extract assistant's response
416
  assistant_response = completion.choices[0].message.content
417
+ #logger.info(f"Assistant response: {assistant_response}")
418
 
419
  # Count output tokens
420
  output_token_data = count_tokens([{"role": "assistant", "content": assistant_response}], "o200k_base")
 
547
  results = []
548
  logger.warning("Retriever is not available.")
549
 
550
+ # Load updated messages (including user query)
551
+ messages = load_messages()
552
 
553
  # Build prompt
554
  llm_prompt = build_prompt(prompt.strip(), results, messages)