raghavNCI commited on
Commit
9952378
·
1 Parent(s): ed08d36

changes v16

Browse files
Files changed (1) hide show
  1. question.py +2 -1
question.py CHANGED
@@ -46,6 +46,7 @@ def mistral_generate(prompt: str, max_new_tokens=128):
46
  response.raise_for_status()
47
  result = response.json()
48
  if isinstance(result, list) and len(result) > 0:
 
49
  return result[0].get("generated_text", "").strip()
50
  else:
51
  return ""
@@ -106,7 +107,7 @@ async def ask_question(input: QuestionInput):
106
 
107
  # Step 3: Ask Mistral to answer using the context
108
  answer_prompt = (
109
- f"<s>[INST] Use the context below to answer the question. "
110
  f"If not enough information is available, say 'Cannot answer'.\n\n"
111
  f"Context:\n{context}\n\nQuestion: {question} [/INST]"
112
  )
 
46
  response.raise_for_status()
47
  result = response.json()
48
  if isinstance(result, list) and len(result) > 0:
49
+ print("Mistral Result", result);
50
  return result[0].get("generated_text", "").strip()
51
  else:
52
  return ""
 
107
 
108
  # Step 3: Ask Mistral to answer using the context
109
  answer_prompt = (
110
+ f"<s>[INST] You are a news aggregator and generate responses like one. Say things like you already know it and you're informing the user. Use the context below to answer the question. "
111
  f"If not enough information is available, say 'Cannot answer'.\n\n"
112
  f"Context:\n{context}\n\nQuestion: {question} [/INST]"
113
  )